ffi-libarchive 1.0.0 → 1.0.3
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 +4 -4
- data/lib/ffi-libarchive/archive.rb +5 -4
- data/lib/ffi-libarchive/entry.rb +7 -7
- data/lib/ffi-libarchive/reader.rb +2 -2
- data/lib/ffi-libarchive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a37a59bb2528341adba957354cc76a776d726a715390e6fa2261b9effcca7ca
|
4
|
+
data.tar.gz: 3e94f65843192c53a13352c0790833aad2e2deea833b6d97e68e068ffc5c2bef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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], :
|
159
|
-
attach_function :archive_entry_set_gid, %i{pointer
|
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], :
|
189
|
-
attach_function :archive_entry_set_uid, %i{pointer
|
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
|
data/lib/ffi-libarchive/entry.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
465
|
+
nil
|
466
466
|
else
|
467
467
|
# TODO: someday size.read_size_t could work
|
468
|
-
|
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
|
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.
|
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:
|
13
|
+
date: 2020-06-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ffi
|