ffi-libarchive 1.1.3 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad607029b63e0c23ad8bf7ab667c246ec99d122ae09a60430657b1fa6ddd8126
4
- data.tar.gz: 57c455b2d4e159da7ccee28faa0f4c347d98e6b92a8ffe70b5c00e6b02a60414
3
+ metadata.gz: a7094a13cfebde03bfffdb80ebafdddd86995535898ca553808d06626dac1290
4
+ data.tar.gz: ce502afcd053c2af3680ce85c8d6fe866f64fad788a5e354c193520f12c936d4
5
5
  SHA512:
6
- metadata.gz: 35b3c1c4737846dedf71efa6925f6c594ff997156cd793a2df39e001d7d874fc74f20a36f38aa0c593718c28ef9bbd64029ec28aadf6e8d2317469e002aaf330
7
- data.tar.gz: 5d054df7e653dd6e14f1897cddd0859cdf90e3f26970f2d09701ee0a2ae8c2a89496fe1035850426f7634e01d7fad91cb5ab7b5c7392849d03c8eceace2fe15c
6
+ metadata.gz: 40adfc4eef27b5a0712ec75dd4861fff389d7ec70c28372059b56b0b7f4142fc1c64bca5164ef07ff13b1eec8b90aa153bc1523f7d178da570a38f8119e0a315
7
+ data.tar.gz: 8eadb8844908a5e2fe48b571252ee4413476068188eefb896901cc140177acb01bd541ad7971922e88425240926c22e96eb7d5899d84581cfb274336a6c2173f
@@ -12,11 +12,17 @@ module Archive
12
12
 
13
13
  attach_function :archive_version_number, [], :int
14
14
  attach_function :archive_version_string, [], :string
15
- attach_function :archive_error_string, [:pointer], :string
15
+
16
+ attach_function :archive_compression, [:pointer], :int
17
+ attach_function :archive_compression_name, [:pointer], :string
16
18
  attach_function :archive_errno, [:pointer], :int
19
+ attach_function :archive_error_string, [:pointer], :string
20
+ attach_function :archive_format, [:pointer], :int
21
+ attach_function :archive_format_name, [:pointer], :string
17
22
 
18
23
  attach_function :archive_read_new, [], :pointer
19
24
  attach_function :archive_read_open_filename, %i{pointer string size_t}, :int
25
+ attach_function :archive_read_open_fd, %i{pointer int size_t}, :int
20
26
  attach_function :archive_read_open_memory, %i{pointer pointer size_t}, :int
21
27
  attach_function :archive_read_open1, [:pointer], :int
22
28
  attach_function :archive_read_support_compression_program, %i{pointer string}, :int
@@ -76,7 +82,7 @@ module Archive
76
82
  attach_function :archive_read_extract, %i{pointer pointer int}, :int
77
83
  attach_function :archive_read_header_position, [:pointer], :int
78
84
  attach_function :archive_read_next_header, %i{pointer pointer}, :int
79
- attach_function :archive_read_data, %i{pointer pointer size_t}, :size_t
85
+ attach_function :archive_read_data, %i{pointer pointer size_t}, :ssize_t
80
86
  attach_function :archive_read_data_into_fd, %i{pointer int}, :int
81
87
 
82
88
  attach_function :archive_write_new, [], :pointer
@@ -284,6 +290,10 @@ module Archive
284
290
  Reader.open_filename file_name, command, &block
285
291
  end
286
292
 
293
+ def self.read_open_fd(fd, command = nil, &block)
294
+ Reader.open_fd fd, command, &block
295
+ end
296
+
287
297
  def self.read_open_memory(string, command = nil, &block)
288
298
  Reader.open_memory string, command, &block
289
299
  end
@@ -355,6 +365,14 @@ module Archive
355
365
  end
356
366
  protected :archive
357
367
 
368
+ def compression
369
+ C.archive_compression(@archive)
370
+ end
371
+
372
+ def compression_name
373
+ C.archive_compression_name(@archive)
374
+ end
375
+
358
376
  def error_string
359
377
  C.archive_error_string(@archive)
360
378
  end
@@ -362,5 +380,13 @@ module Archive
362
380
  def errno
363
381
  C.archive_errno(@archive)
364
382
  end
383
+
384
+ def format
385
+ C.archive_format(@archive)
386
+ end
387
+
388
+ def format_name
389
+ C.archive_format_name(@archive)
390
+ end
365
391
  end
366
392
  end
@@ -15,6 +15,19 @@ module Archive
15
15
  end
16
16
  end
17
17
 
18
+ def self.open_fd(fd, command = nil, strip_components: 0)
19
+ if block_given?
20
+ reader = open_fd fd, command, strip_components: strip_components
21
+ begin
22
+ yield reader
23
+ ensure
24
+ reader.close
25
+ end
26
+ else
27
+ new fd: fd, command: command, strip_components: strip_components
28
+ end
29
+ end
30
+
18
31
  def self.open_memory(string, command = nil)
19
32
  if block_given?
20
33
  reader = open_memory string, command
@@ -66,6 +79,8 @@ module Archive
66
79
  case
67
80
  when params[:file_name]
68
81
  raise Error, @archive if C.archive_read_open_filename(archive, params[:file_name], 1024) != C::OK
82
+ when params[:fd]
83
+ raise Error, @archive if C.archive_read_open_fd(archive, params[:fd], 1024) != C::OK
69
84
  when params[:memory]
70
85
  str = params[:memory]
71
86
  @data = FFI::MemoryPointer.new(str.bytesize + 1)
@@ -1,3 +1,3 @@
1
1
  module Archive
2
- VERSION = "1.1.3".freeze
2
+ VERSION = "1.1.14".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libarchive
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bellone
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-09-16 00:00:00.000000000 Z
13
+ date: 2024-01-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi