ffi-libarchive 1.1.3 → 1.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ffi-libarchive/archive.rb +27 -1
- data/lib/ffi-libarchive/reader.rb +15 -0
- 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: c36407f25d172183c558945197b30ab3de6ce623da69bcb95cd64eef1776ca6e
|
4
|
+
data.tar.gz: 6205aba975a305bef359027e6337c80829d2409dd25028ce4562af61e3d58e84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2378c1c786464e9d5b77b6d27f97f5171349f6c5b37a3bccbbe4b597b98cefc972e27a89e22e7232d3554128e8929b296398fa04678d7943aa5e1ed32db6111
|
7
|
+
data.tar.gz: 0b30a8db432b3d7e8bb55b64fc284c9e74a343e67812aba08eee46ea15493e8a4998326aa9bbf258eeafe165bf01d90be60d7bb3ec4d430ffe9d19801bf73f19
|
@@ -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
|
-
|
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
|
@@ -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)
|
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.
|
4
|
+
version: 1.1.13
|
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: 2023-08-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ffi
|