libarchive 0.1.1 → 0.1.2
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.
- data/COPYING.libarchive +60 -60
- data/LICENSE.libbzip2 +42 -42
- data/README.txt +6 -6
- data/ext/archive_read_support_compression.c +31 -31
- data/ext/archive_read_support_compression.h +6 -6
- data/ext/archive_read_support_format.c +32 -32
- data/ext/archive_read_support_format.h +6 -6
- data/ext/archive_write_open_rb_str.c +29 -29
- data/ext/archive_write_open_rb_str.h +6 -6
- data/ext/archive_write_set_compression.c +32 -32
- data/ext/archive_write_set_compression.h +6 -6
- data/ext/config.h.in +22 -22
- data/ext/configure +0 -0
- data/ext/configure.in +11 -11
- data/ext/depend +19 -19
- data/ext/extconf.rb +10 -6
- data/ext/install-sh +250 -250
- data/ext/libarchive.c +93 -89
- data/ext/libarchive_archive.c +84 -84
- data/ext/libarchive_entry.c +1015 -1015
- data/ext/libarchive_internal.h +155 -155
- data/ext/libarchive_reader.c +328 -328
- data/ext/libarchive_win32.h +52 -52
- data/ext/libarchive_writer.c +246 -246
- data/lib/libarchive.rb +1 -0
- data/lib/libarchive_ruby.rb +1 -0
- data/libarchive.c +1766 -1762
- metadata +38 -22
data/COPYING.libarchive
CHANGED
@@ -1,60 +1,60 @@
|
|
1
|
-
The libarchive distribution as a whole is Copyright by Tim Kientzle
|
2
|
-
and is subject to the copyright notice reproduced at the bottom of
|
3
|
-
this file.
|
4
|
-
|
5
|
-
Each individual file in this distribution should have a clear
|
6
|
-
copyright/licensing statement at the beginning of the file. If any do
|
7
|
-
not, please let me know and I will rectify it. The following is
|
8
|
-
intended to summarize the copyright status of the individual files;
|
9
|
-
the actual statements in the files are controlling.
|
10
|
-
|
11
|
-
* Except as listed below, all C sources (including .c and .h files)
|
12
|
-
and documentation files are subject to the copyright notice reproduced
|
13
|
-
at the bottom of this file.
|
14
|
-
|
15
|
-
* The following source files are also subject in whole or in part to
|
16
|
-
a 3-clause UC Regents copyright; please read the individual source
|
17
|
-
files for details:
|
18
|
-
libarchive/archive_entry.c
|
19
|
-
libarchive/archive_read_support_compression_compress.c
|
20
|
-
libarchive/archive_write_set_compression_compress.c
|
21
|
-
libarchive/mtree.5
|
22
|
-
tar/matching.c
|
23
|
-
|
24
|
-
* The following source files are in the public domain:
|
25
|
-
tar/getdate.y
|
26
|
-
|
27
|
-
* The build files---including Makefiles, configure scripts,
|
28
|
-
and auxiliary scripts used as part of the compile process---have
|
29
|
-
widely varying licensing terms. Please check individual files before
|
30
|
-
distributing them to see if those restrictions apply to you.
|
31
|
-
|
32
|
-
I intend for all new source code to use the license below and hope over
|
33
|
-
time to replace code with other licenses with new implementations that
|
34
|
-
do use the license below. The varying licensing of the build scripts
|
35
|
-
seems to be an unavoidable mess.
|
36
|
-
|
37
|
-
|
38
|
-
Copyright (c) 2003-2008 <author(s)>
|
39
|
-
All rights reserved.
|
40
|
-
|
41
|
-
Redistribution and use in source and binary forms, with or without
|
42
|
-
modification, are permitted provided that the following conditions
|
43
|
-
are met:
|
44
|
-
1. Redistributions of source code must retain the above copyright
|
45
|
-
notice, this list of conditions and the following disclaimer
|
46
|
-
in this position and unchanged.
|
47
|
-
2. Redistributions in binary form must reproduce the above copyright
|
48
|
-
notice, this list of conditions and the following disclaimer in the
|
49
|
-
documentation and/or other materials provided with the distribution.
|
50
|
-
|
51
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
52
|
-
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
53
|
-
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
54
|
-
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
55
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
56
|
-
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
57
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
58
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
59
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
60
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1
|
+
The libarchive distribution as a whole is Copyright by Tim Kientzle
|
2
|
+
and is subject to the copyright notice reproduced at the bottom of
|
3
|
+
this file.
|
4
|
+
|
5
|
+
Each individual file in this distribution should have a clear
|
6
|
+
copyright/licensing statement at the beginning of the file. If any do
|
7
|
+
not, please let me know and I will rectify it. The following is
|
8
|
+
intended to summarize the copyright status of the individual files;
|
9
|
+
the actual statements in the files are controlling.
|
10
|
+
|
11
|
+
* Except as listed below, all C sources (including .c and .h files)
|
12
|
+
and documentation files are subject to the copyright notice reproduced
|
13
|
+
at the bottom of this file.
|
14
|
+
|
15
|
+
* The following source files are also subject in whole or in part to
|
16
|
+
a 3-clause UC Regents copyright; please read the individual source
|
17
|
+
files for details:
|
18
|
+
libarchive/archive_entry.c
|
19
|
+
libarchive/archive_read_support_compression_compress.c
|
20
|
+
libarchive/archive_write_set_compression_compress.c
|
21
|
+
libarchive/mtree.5
|
22
|
+
tar/matching.c
|
23
|
+
|
24
|
+
* The following source files are in the public domain:
|
25
|
+
tar/getdate.y
|
26
|
+
|
27
|
+
* The build files---including Makefiles, configure scripts,
|
28
|
+
and auxiliary scripts used as part of the compile process---have
|
29
|
+
widely varying licensing terms. Please check individual files before
|
30
|
+
distributing them to see if those restrictions apply to you.
|
31
|
+
|
32
|
+
I intend for all new source code to use the license below and hope over
|
33
|
+
time to replace code with other licenses with new implementations that
|
34
|
+
do use the license below. The varying licensing of the build scripts
|
35
|
+
seems to be an unavoidable mess.
|
36
|
+
|
37
|
+
|
38
|
+
Copyright (c) 2003-2008 <author(s)>
|
39
|
+
All rights reserved.
|
40
|
+
|
41
|
+
Redistribution and use in source and binary forms, with or without
|
42
|
+
modification, are permitted provided that the following conditions
|
43
|
+
are met:
|
44
|
+
1. Redistributions of source code must retain the above copyright
|
45
|
+
notice, this list of conditions and the following disclaimer
|
46
|
+
in this position and unchanged.
|
47
|
+
2. Redistributions in binary form must reproduce the above copyright
|
48
|
+
notice, this list of conditions and the following disclaimer in the
|
49
|
+
documentation and/or other materials provided with the distribution.
|
50
|
+
|
51
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
52
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
53
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
54
|
+
IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
55
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
56
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
57
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
58
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
59
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
60
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/LICENSE.libbzip2
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
|
2
|
-
--------------------------------------------------------------------------
|
3
|
-
|
4
|
-
This program, "bzip2", the associated library "libbzip2", and all
|
5
|
-
documentation, are copyright (C) 1996-2007 Julian R Seward. All
|
6
|
-
rights reserved.
|
7
|
-
|
8
|
-
Redistribution and use in source and binary forms, with or without
|
9
|
-
modification, are permitted provided that the following conditions
|
10
|
-
are met:
|
11
|
-
|
12
|
-
1. Redistributions of source code must retain the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer.
|
14
|
-
|
15
|
-
2. The origin of this software must not be misrepresented; you must
|
16
|
-
not claim that you wrote the original software. If you use this
|
17
|
-
software in a product, an acknowledgment in the product
|
18
|
-
documentation would be appreciated but is not required.
|
19
|
-
|
20
|
-
3. Altered source versions must be plainly marked as such, and must
|
21
|
-
not be misrepresented as being the original software.
|
22
|
-
|
23
|
-
4. The name of the author may not be used to endorse or promote
|
24
|
-
products derived from this software without specific prior written
|
25
|
-
permission.
|
26
|
-
|
27
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
28
|
-
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
29
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
30
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
31
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
32
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
33
|
-
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
34
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
35
|
-
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
36
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
37
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
38
|
-
|
39
|
-
Julian Seward, jseward@bzip.org
|
40
|
-
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
41
|
-
|
42
|
-
--------------------------------------------------------------------------
|
1
|
+
|
2
|
+
--------------------------------------------------------------------------
|
3
|
+
|
4
|
+
This program, "bzip2", the associated library "libbzip2", and all
|
5
|
+
documentation, are copyright (C) 1996-2007 Julian R Seward. All
|
6
|
+
rights reserved.
|
7
|
+
|
8
|
+
Redistribution and use in source and binary forms, with or without
|
9
|
+
modification, are permitted provided that the following conditions
|
10
|
+
are met:
|
11
|
+
|
12
|
+
1. Redistributions of source code must retain the above copyright
|
13
|
+
notice, this list of conditions and the following disclaimer.
|
14
|
+
|
15
|
+
2. The origin of this software must not be misrepresented; you must
|
16
|
+
not claim that you wrote the original software. If you use this
|
17
|
+
software in a product, an acknowledgment in the product
|
18
|
+
documentation would be appreciated but is not required.
|
19
|
+
|
20
|
+
3. Altered source versions must be plainly marked as such, and must
|
21
|
+
not be misrepresented as being the original software.
|
22
|
+
|
23
|
+
4. The name of the author may not be used to endorse or promote
|
24
|
+
products derived from this software without specific prior written
|
25
|
+
permission.
|
26
|
+
|
27
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
28
|
+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
29
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
30
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
31
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
32
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
33
|
+
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
34
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
35
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
36
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
37
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
38
|
+
|
39
|
+
Julian Seward, jseward@bzip.org
|
40
|
+
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
41
|
+
|
42
|
+
--------------------------------------------------------------------------
|
data/README.txt
CHANGED
@@ -47,7 +47,7 @@ http://rubyforge.org/projects/libarchive
|
|
47
47
|
|
48
48
|
== Source Code
|
49
49
|
|
50
|
-
|
50
|
+
https://github.com/winebarrel/Libarchive-Ruby
|
51
51
|
|
52
52
|
== Dependency
|
53
53
|
|
@@ -61,7 +61,7 @@ gem install libarchive
|
|
61
61
|
|
62
62
|
== Example
|
63
63
|
=== reading archive
|
64
|
-
require '
|
64
|
+
require 'libarchive'
|
65
65
|
|
66
66
|
Archive.read_open_filename('foo.tar.gz') do |ar|
|
67
67
|
while entry = ar.next_header
|
@@ -78,9 +78,9 @@ gem install libarchive
|
|
78
78
|
end
|
79
79
|
|
80
80
|
=== creating archive
|
81
|
-
require '
|
81
|
+
require 'libarchive'
|
82
82
|
|
83
|
-
Archive.write_open_filename('foo.tar.bz2', Archive::COMPRESSION_BZIP2, Archive::
|
83
|
+
Archive.write_open_filename('foo.tar.bz2', Archive::COMPRESSION_BZIP2, Archive::FORMAT_TAR) do |ar|
|
84
84
|
Dir.glob('*.c').each do |fn|
|
85
85
|
ar.new_entry do |entry|
|
86
86
|
entry.copy_stat(fn)
|
@@ -98,7 +98,7 @@ gem install libarchive
|
|
98
98
|
end
|
99
99
|
|
100
100
|
=== creating archive by extarnal program
|
101
|
-
require '
|
101
|
+
require 'libarchive'
|
102
102
|
|
103
103
|
Archive.write_open_filename('foo.tar.lzo', 'lzop', Archive::FORMAT_TAR_USTAR) do |ar|
|
104
104
|
...
|
@@ -135,7 +135,7 @@ gem install libarchive
|
|
135
135
|
Libarchive/Ruby(mswin32) contains Libarchive(2.6.0) and libbzip2(1.0.5).
|
136
136
|
|
137
137
|
* Libarchive
|
138
|
-
* http://
|
138
|
+
* http://code.google.com/p/libarchive/
|
139
139
|
* see {COPYING.libarchive}[link:files/COPYING_libarchive.html]
|
140
140
|
|
141
141
|
* libbzip2
|
@@ -1,31 +1,31 @@
|
|
1
|
-
#include <errno.h>
|
2
|
-
#include <archive.h>
|
3
|
-
|
4
|
-
static struct {
|
5
|
-
int code;
|
6
|
-
int (*setter)(struct archive *);
|
7
|
-
} codes[] = {
|
8
|
-
{ ARCHIVE_COMPRESSION_NONE, archive_read_support_compression_none },
|
9
|
-
{ ARCHIVE_COMPRESSION_GZIP, archive_read_support_compression_gzip },
|
10
|
-
{ ARCHIVE_COMPRESSION_BZIP2, archive_read_support_compression_bzip2 },
|
11
|
-
{ ARCHIVE_COMPRESSION_COMPRESS, archive_read_support_compression_compress },
|
12
|
-
// XXX:
|
13
|
-
/*
|
14
|
-
{ ARCHIVE_COMPRESSION_PROGRAM, archive_read_support_compression_program },
|
15
|
-
{ ARCHIVE_COMPRESSION_LZMA, archive_read_support_compression_lzma },
|
16
|
-
*/
|
17
|
-
{ -1, NULL },
|
18
|
-
};
|
19
|
-
|
20
|
-
int archive_read_support_compression(struct archive *a, int code) {
|
21
|
-
int i;
|
22
|
-
|
23
|
-
for (i = 0; codes[i].code >= 0; i++) {
|
24
|
-
if (codes[i].code == code) {
|
25
|
-
return codes[i].setter(a);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
archive_set_error(a, EINVAL, "No such compression");
|
30
|
-
return ARCHIVE_FATAL;
|
31
|
-
}
|
1
|
+
#include <errno.h>
|
2
|
+
#include <archive.h>
|
3
|
+
|
4
|
+
static struct {
|
5
|
+
int code;
|
6
|
+
int (*setter)(struct archive *);
|
7
|
+
} codes[] = {
|
8
|
+
{ ARCHIVE_COMPRESSION_NONE, archive_read_support_compression_none },
|
9
|
+
{ ARCHIVE_COMPRESSION_GZIP, archive_read_support_compression_gzip },
|
10
|
+
{ ARCHIVE_COMPRESSION_BZIP2, archive_read_support_compression_bzip2 },
|
11
|
+
{ ARCHIVE_COMPRESSION_COMPRESS, archive_read_support_compression_compress },
|
12
|
+
// XXX:
|
13
|
+
/*
|
14
|
+
{ ARCHIVE_COMPRESSION_PROGRAM, archive_read_support_compression_program },
|
15
|
+
{ ARCHIVE_COMPRESSION_LZMA, archive_read_support_compression_lzma },
|
16
|
+
*/
|
17
|
+
{ -1, NULL },
|
18
|
+
};
|
19
|
+
|
20
|
+
int archive_read_support_compression(struct archive *a, int code) {
|
21
|
+
int i;
|
22
|
+
|
23
|
+
for (i = 0; codes[i].code >= 0; i++) {
|
24
|
+
if (codes[i].code == code) {
|
25
|
+
return codes[i].setter(a);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
archive_set_error(a, EINVAL, "No such compression");
|
30
|
+
return ARCHIVE_FATAL;
|
31
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#ifndef _ARCHIVE_READ_SUPPORT_COMPRESSION_H_
|
2
|
-
#define _ARCHIVE_READ_SUPPORT_COMPRESSION_H_
|
3
|
-
|
4
|
-
int archive_read_support_compression(struct archive *a, int code);
|
5
|
-
|
6
|
-
#endif
|
1
|
+
#ifndef _ARCHIVE_READ_SUPPORT_COMPRESSION_H_
|
2
|
+
#define _ARCHIVE_READ_SUPPORT_COMPRESSION_H_
|
3
|
+
|
4
|
+
int archive_read_support_compression(struct archive *a, int code);
|
5
|
+
|
6
|
+
#endif
|
@@ -1,32 +1,32 @@
|
|
1
|
-
#include <errno.h>
|
2
|
-
#include <archive.h>
|
3
|
-
|
4
|
-
static struct {
|
5
|
-
int code;
|
6
|
-
int (*setter)(struct archive *);
|
7
|
-
} codes[] = {
|
8
|
-
{ ARCHIVE_FORMAT_CPIO, archive_read_support_format_cpio },
|
9
|
-
{ ARCHIVE_FORMAT_TAR, archive_read_support_format_tar },
|
10
|
-
{ ARCHIVE_FORMAT_TAR_GNUTAR, archive_read_support_format_gnutar },
|
11
|
-
{ ARCHIVE_FORMAT_ISO9660, archive_read_support_format_iso9660 },
|
12
|
-
{ ARCHIVE_FORMAT_ZIP, archive_read_support_format_zip },
|
13
|
-
{ ARCHIVE_FORMAT_EMPTY, archive_read_support_format_empty },
|
14
|
-
{ ARCHIVE_FORMAT_AR, archive_read_support_format_ar },
|
15
|
-
#ifdef ARCHIVE_FORMAT_MTREE
|
16
|
-
{ ARCHIVE_FORMAT_MTREE, archive_read_support_format_mtree },
|
17
|
-
#endif
|
18
|
-
{ -1, NULL },
|
19
|
-
};
|
20
|
-
|
21
|
-
int archive_read_support_format(struct archive *a, int code) {
|
22
|
-
int i;
|
23
|
-
|
24
|
-
for (i = 0; codes[i].code >= 0; i++) {
|
25
|
-
if (codes[i].code == code) {
|
26
|
-
return codes[i].setter(a);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
archive_set_error(a, EINVAL, "No such format");
|
31
|
-
return ARCHIVE_FATAL;
|
32
|
-
}
|
1
|
+
#include <errno.h>
|
2
|
+
#include <archive.h>
|
3
|
+
|
4
|
+
static struct {
|
5
|
+
int code;
|
6
|
+
int (*setter)(struct archive *);
|
7
|
+
} codes[] = {
|
8
|
+
{ ARCHIVE_FORMAT_CPIO, archive_read_support_format_cpio },
|
9
|
+
{ ARCHIVE_FORMAT_TAR, archive_read_support_format_tar },
|
10
|
+
{ ARCHIVE_FORMAT_TAR_GNUTAR, archive_read_support_format_gnutar },
|
11
|
+
{ ARCHIVE_FORMAT_ISO9660, archive_read_support_format_iso9660 },
|
12
|
+
{ ARCHIVE_FORMAT_ZIP, archive_read_support_format_zip },
|
13
|
+
{ ARCHIVE_FORMAT_EMPTY, archive_read_support_format_empty },
|
14
|
+
{ ARCHIVE_FORMAT_AR, archive_read_support_format_ar },
|
15
|
+
#ifdef ARCHIVE_FORMAT_MTREE
|
16
|
+
{ ARCHIVE_FORMAT_MTREE, archive_read_support_format_mtree },
|
17
|
+
#endif
|
18
|
+
{ -1, NULL },
|
19
|
+
};
|
20
|
+
|
21
|
+
int archive_read_support_format(struct archive *a, int code) {
|
22
|
+
int i;
|
23
|
+
|
24
|
+
for (i = 0; codes[i].code >= 0; i++) {
|
25
|
+
if (codes[i].code == code) {
|
26
|
+
return codes[i].setter(a);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
archive_set_error(a, EINVAL, "No such format");
|
31
|
+
return ARCHIVE_FATAL;
|
32
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#ifndef _ARCHIVE_READ_SUPPORT_FORMAT_H_
|
2
|
-
#define _ARCHIVE_READ_SUPPORT_FORMAT_H_
|
3
|
-
|
4
|
-
int archive_read_support_format(struct archive *a, int code);
|
5
|
-
|
6
|
-
#endif
|
1
|
+
#ifndef _ARCHIVE_READ_SUPPORT_FORMAT_H_
|
2
|
+
#define _ARCHIVE_READ_SUPPORT_FORMAT_H_
|
3
|
+
|
4
|
+
int archive_read_support_format(struct archive *a, int code);
|
5
|
+
|
6
|
+
#endif
|
@@ -1,29 +1,29 @@
|
|
1
|
-
#include <archive.h>
|
2
|
-
#include <ruby.h>
|
3
|
-
|
4
|
-
#ifdef _WIN32
|
5
|
-
typedef long ssize_t;
|
6
|
-
#endif
|
7
|
-
|
8
|
-
static int rb_str_write_open(struct archive *a, void *client_data) {
|
9
|
-
if (archive_write_get_bytes_in_last_block(a) == -1) {
|
10
|
-
archive_write_set_bytes_in_last_block(a, 1);
|
11
|
-
}
|
12
|
-
|
13
|
-
return ARCHIVE_OK;
|
14
|
-
}
|
15
|
-
|
16
|
-
static int rb_str_write_close(struct archive *a, void *client_data) {
|
17
|
-
return ARCHIVE_OK;
|
18
|
-
}
|
19
|
-
|
20
|
-
|
21
|
-
static ssize_t rb_str_write(struct archive *a, void *client_data, const void *buff, size_t length) {
|
22
|
-
VALUE str = (VALUE) client_data;
|
23
|
-
rb_str_cat(str, buff, length);
|
24
|
-
return length;
|
25
|
-
}
|
26
|
-
|
27
|
-
int archive_write_open_rb_str(struct archive *a, VALUE str) {
|
28
|
-
return archive_write_open(a, (void *) str, rb_str_write_open, rb_str_write, rb_str_write_close);
|
29
|
-
}
|
1
|
+
#include <archive.h>
|
2
|
+
#include <ruby.h>
|
3
|
+
|
4
|
+
#ifdef _WIN32
|
5
|
+
typedef long ssize_t;
|
6
|
+
#endif
|
7
|
+
|
8
|
+
static int rb_str_write_open(struct archive *a, void *client_data) {
|
9
|
+
if (archive_write_get_bytes_in_last_block(a) == -1) {
|
10
|
+
archive_write_set_bytes_in_last_block(a, 1);
|
11
|
+
}
|
12
|
+
|
13
|
+
return ARCHIVE_OK;
|
14
|
+
}
|
15
|
+
|
16
|
+
static int rb_str_write_close(struct archive *a, void *client_data) {
|
17
|
+
return ARCHIVE_OK;
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
static ssize_t rb_str_write(struct archive *a, void *client_data, const void *buff, size_t length) {
|
22
|
+
VALUE str = (VALUE) client_data;
|
23
|
+
rb_str_cat(str, buff, length);
|
24
|
+
return length;
|
25
|
+
}
|
26
|
+
|
27
|
+
int archive_write_open_rb_str(struct archive *a, VALUE str) {
|
28
|
+
return archive_write_open(a, (void *) str, rb_str_write_open, rb_str_write, rb_str_write_close);
|
29
|
+
}
|