ffi-libarchive 1.0.0 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9b6e6ed6fbbaf0e493767d47541307f64cfcffd32e23d33f0f47ab3efd6a35a
4
- data.tar.gz: c85cb44e37fdbe3bec65f7408fc7e0eb821393bec658c929f6252d2ca01c6ecf
3
+ metadata.gz: 7a37a59bb2528341adba957354cc76a776d726a715390e6fa2261b9effcca7ca
4
+ data.tar.gz: 3e94f65843192c53a13352c0790833aad2e2deea833b6d97e68e068ffc5c2bef
5
5
  SHA512:
6
- metadata.gz: f3bf10cbcfa75efc763348bce05f35f4891717a5c8aed5ab38e5ab2cd6c0d162b179fb2c3defb9af7c6e039e12f385590e66c8534b0eafd394706afc20b7ea55
7
- data.tar.gz: 07cba89aa39ec4be250d187cb75113ae1b1f2c21b20b3854926fed0bc2f7ff413ba24c526fa5a2d2c7a3e27b2a8bc6ec2b27dfab54a6b7370c3ce8aea3c4dfc9
6
+ metadata.gz: dddc27a6897a12278ef644b124c9f3e718cb837fba7e2b164cc4766041b8063139be1836525bbcfa7a13cd1be8637155c6a96a470cc4ada3448482cb2db9c14b
7
+ data.tar.gz: b2d00c86cd4563a8bc86b6bad28f7d07a6e4c90281f074866fe30a330a2b4697c5321e9708777ad429f4e779a467cc45c47f2ff3d0f0b9952cd1d7279296a4b8
@@ -123,6 +123,7 @@ module Archive
123
123
  attach_function :archive_write_set_bytes_in_last_block, %i{pointer int}, :int
124
124
 
125
125
  attach_function :archive_entry_new, [], :pointer
126
+ attach_function :archive_entry_clone, [:pointer], :pointer
126
127
  attach_function :archive_entry_free, [:pointer], :void
127
128
  attach_function :archive_entry_atime, [:pointer], :time_t
128
129
  attach_function :archive_entry_atime_nsec, %i{pointer time_t long}, :void
@@ -155,8 +156,8 @@ module Archive
155
156
  attach_function :archive_entry_fflags, %i{pointer pointer pointer}, :void
156
157
  attach_function :archive_entry_set_fflags, %i{pointer ulong ulong}, :void
157
158
  attach_function :archive_entry_fflags_text, [:pointer], :string
158
- attach_function :archive_entry_gid, [:pointer], :gid_t
159
- attach_function :archive_entry_set_gid, %i{pointer gid_t}, :void
159
+ attach_function :archive_entry_gid, [:pointer], :uint
160
+ attach_function :archive_entry_set_gid, %i{pointer uint}, :void
160
161
  attach_function :archive_entry_gname, [:pointer], :string
161
162
  attach_function :archive_entry_set_gname, %i{pointer string}, :void
162
163
  attach_function :archive_entry_hardlink, [:pointer], :string
@@ -185,8 +186,8 @@ module Archive
185
186
  attach_function :archive_entry_strmode, [:pointer], :string
186
187
  attach_function :archive_entry_symlink, [:pointer], :string
187
188
  attach_function :archive_entry_set_symlink, %i{pointer string}, :void
188
- attach_function :archive_entry_uid, [:pointer], :uid_t
189
- attach_function :archive_entry_set_uid, %i{pointer uid_t}, :void
189
+ attach_function :archive_entry_uid, [:pointer], :uint
190
+ attach_function :archive_entry_set_uid, %i{pointer uint}, :void
190
191
  attach_function :archive_entry_uname, [:pointer], :string
191
192
  attach_function :archive_entry_set_uname, %i{pointer string}, :void
192
193
  attach_function :archive_entry_copy_stat, %i{pointer pointer}, :void
@@ -17,14 +17,14 @@ module Archive
17
17
  CHARACTER_SPECIAL = 0020000 # character device
18
18
  FIFO = 0010000 # FIFO
19
19
 
20
- def self.from_pointer(entry)
21
- new entry
20
+ def self.from_pointer(entry, clone: false)
21
+ new entry, clone: clone
22
22
  end
23
23
 
24
- def initialize(entry = nil)
24
+ def initialize(entry = nil, clone: false)
25
25
  @entry_free = [true]
26
26
  if entry
27
- @entry = entry
27
+ @entry = clone ? C.archive_entry_clone(entry) : entry
28
28
  yield self if block_given?
29
29
  else
30
30
  @entry = C.archive_entry_new
@@ -34,7 +34,7 @@ module Archive
34
34
  result = yield self
35
35
  C.archive_entry_free(@entry)
36
36
  @entry = nil
37
- return result
37
+ result
38
38
  else
39
39
  @entry_free[0] = false
40
40
  ObjectSpace.define_finalizer(self, Entry.finalizer(@entry, @entry_free))
@@ -462,10 +462,10 @@ module Archive
462
462
  value = FFI::MemoryPointer.new :pointer
463
463
  size = FFI::MemoryPointer.new :size_t
464
464
  if C.archive_entry_xattr_next(entry, name, value, size) != C::OK
465
- return nil
465
+ nil
466
466
  else
467
467
  # TODO: someday size.read_size_t could work
468
- return [name.null? ? nil : name.read_string,
468
+ [name.null? ? nil : name.read_string,
469
469
  value.null? ? nil : value.get_string(0, size.read_ulong)]
470
470
  end
471
471
  end
@@ -109,11 +109,11 @@ module Archive
109
109
  raise Error, @archive if C.archive_read_header_position archive
110
110
  end
111
111
 
112
- def next_header
112
+ def next_header(clone_entry: false)
113
113
  entry_ptr = FFI::MemoryPointer.new(:pointer)
114
114
  case C.archive_read_next_header(archive, entry_ptr)
115
115
  when C::OK
116
- Entry.from_pointer entry_ptr.read_pointer
116
+ Entry.from_pointer entry_ptr.read_pointer, clone: clone_entry
117
117
  when C::EOF
118
118
  @eof = true
119
119
  nil
@@ -1,3 +1,3 @@
1
1
  module Archive
2
- VERSION = "1.0.0".freeze
2
+ VERSION = "1.0.3".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.0.0
4
+ version: 1.0.3
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: 2019-12-28 00:00:00.000000000 Z
13
+ date: 2020-06-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi