libarchive-static 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/Makefile +6 -0
- data/ext/extconf.rb +61 -0
- data/ext/libarchive-0.1.1/COPYING.libarchive +60 -0
- data/ext/libarchive-0.1.1/LICENSE.libbzip2 +42 -0
- data/ext/libarchive-0.1.1/README.txt +143 -0
- data/ext/libarchive-0.1.1/ext/Makefile.in +0 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +31 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +29 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/config.h.in +22 -0
- data/ext/libarchive-0.1.1/ext/configure +3904 -0
- data/ext/libarchive-0.1.1/ext/configure.in +11 -0
- data/ext/libarchive-0.1.1/ext/depend +19 -0
- data/ext/libarchive-0.1.1/ext/extconf.rb +6 -0
- data/ext/libarchive-0.1.1/ext/install-sh +250 -0
- data/ext/libarchive-0.1.1/ext/libarchive.c +89 -0
- data/ext/libarchive-0.1.1/ext/libarchive_archive.c +84 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.c +1015 -0
- data/ext/libarchive-0.1.1/ext/libarchive_internal.h +155 -0
- data/ext/libarchive-0.1.1/ext/libarchive_reader.c +328 -0
- data/ext/libarchive-0.1.1/ext/libarchive_win32.h +52 -0
- data/ext/libarchive-0.1.1/ext/libarchive_writer.c +246 -0
- data/ext/libarchive-0.1.1/libarchive.c +1762 -0
- data/ext/libarchive-2.8.4/Makefile.in +7076 -0
- data/ext/libarchive-2.8.4/build/autoconf/check_stdcall_func.m4 +51 -0
- data/ext/libarchive-2.8.4/build/autoconf/compile +143 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.guess +1502 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.sub +1708 -0
- data/ext/libarchive-2.8.4/build/autoconf/depcomp +630 -0
- data/ext/libarchive-2.8.4/build/autoconf/install-sh +291 -0
- data/ext/libarchive-2.8.4/build/autoconf/la_uid_t.m4 +20 -0
- data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +8406 -0
- data/ext/libarchive-2.8.4/build/autoconf/missing +376 -0
- data/ext/libarchive-2.8.4/build/pkgconfig/libarchive.pc.in +10 -0
- data/ext/libarchive-2.8.4/config.h.in +772 -0
- data/ext/libarchive-2.8.4/configure +17916 -0
- data/ext/libarchive-2.8.4/libarchive/archive.h +741 -0
- data/ext/libarchive-2.8.4/libarchive/archive_check_magic.c +134 -0
- data/ext/libarchive-2.8.4/libarchive/archive_crc32.h +66 -0
- data/ext/libarchive-2.8.4/libarchive/archive_endian.h +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.c +2202 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.h +524 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_bhfi.c +74 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_stat.c +77 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_link_resolver.c +405 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_private.h +184 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_stat.c +118 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_strmode.c +87 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_xattr.c +158 -0
- data/ext/libarchive-2.8.4/libarchive/archive_hash.h +281 -0
- data/ext/libarchive-2.8.4/libarchive/archive_platform.h +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_private.h +124 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read.c +1249 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_data_into_fd.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +198 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +570 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_private.h +62 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_set_standard_lookup.c +303 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_extract.c +182 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_fd.c +190 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_file.c +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +272 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_memory.c +156 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_private.h +199 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_all.c +60 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c +353 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c +444 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c +465 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_none.c +40 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_program.c +459 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c +287 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c +627 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c +708 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_all.c +43 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_ar.c +584 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +777 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_empty.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_iso9660.c +2830 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +1304 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_raw.c +185 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_tar.c +2418 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_xar.c +3151 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +903 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.c +453 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.h +148 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string_sprintf.c +164 -0
- data/ext/libarchive-2.8.4/libarchive/archive_util.c +391 -0
- data/ext/libarchive-2.8.4/libarchive/archive_virtual.c +94 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.c +1236 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.h +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write.c +466 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +2628 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_private.h +38 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_set_standard_lookup.c +262 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_fd.c +141 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_file.c +105 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_filename.c +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_memory.c +126 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_private.h +122 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +408 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c +492 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +477 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +257 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +438 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format.c +72 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ar.c +550 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_by_name.c +76 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +344 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +295 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +1050 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_pax.c +1386 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_shar.c +626 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ustar.c +587 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +667 -0
- data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +154 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.c +161 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.h +41 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +113 -0
- data/ext/libarchive-static-makefile +80 -0
- data/ext/libarchive-static-wrapper-makefile +22 -0
- data/ext/zlib-1.2.5/Makefile.in +257 -0
- data/ext/zlib-1.2.5/adler32.c +169 -0
- data/ext/zlib-1.2.5/compress.c +80 -0
- data/ext/zlib-1.2.5/configure +596 -0
- data/ext/zlib-1.2.5/crc32.c +442 -0
- data/ext/zlib-1.2.5/crc32.h +441 -0
- data/ext/zlib-1.2.5/deflate.c +1834 -0
- data/ext/zlib-1.2.5/deflate.h +342 -0
- data/ext/zlib-1.2.5/example.c +565 -0
- data/ext/zlib-1.2.5/gzclose.c +25 -0
- data/ext/zlib-1.2.5/gzguts.h +132 -0
- data/ext/zlib-1.2.5/gzlib.c +537 -0
- data/ext/zlib-1.2.5/gzread.c +653 -0
- data/ext/zlib-1.2.5/gzwrite.c +531 -0
- data/ext/zlib-1.2.5/infback.c +632 -0
- data/ext/zlib-1.2.5/inffast.c +340 -0
- data/ext/zlib-1.2.5/inffast.h +11 -0
- data/ext/zlib-1.2.5/inffixed.h +94 -0
- data/ext/zlib-1.2.5/inflate.c +1480 -0
- data/ext/zlib-1.2.5/inflate.h +122 -0
- data/ext/zlib-1.2.5/inftrees.c +330 -0
- data/ext/zlib-1.2.5/inftrees.h +62 -0
- data/ext/zlib-1.2.5/minigzip.c +440 -0
- data/ext/zlib-1.2.5/trees.c +1244 -0
- data/ext/zlib-1.2.5/trees.h +128 -0
- data/ext/zlib-1.2.5/uncompr.c +59 -0
- data/ext/zlib-1.2.5/zconf.h +428 -0
- data/ext/zlib-1.2.5/zlib.h +1613 -0
- data/ext/zlib-1.2.5/zutil.c +318 -0
- data/ext/zlib-1.2.5/zutil.h +274 -0
- metadata +211 -0
@@ -0,0 +1,246 @@
|
|
1
|
+
#include "libarchive_internal.h"
|
2
|
+
|
3
|
+
extern VALUE rb_mArchive;
|
4
|
+
VALUE rb_cArchiveWriter;
|
5
|
+
extern VALUE rb_eArchiveError;
|
6
|
+
extern VALUE rb_cArchiveEntry;
|
7
|
+
|
8
|
+
static void rb_libarchive_writer_close0(struct rb_libarchive_archive_container *p) {
|
9
|
+
archive_write_close(p->ar);
|
10
|
+
archive_write_finish(p->ar);
|
11
|
+
p->ar = NULL;
|
12
|
+
}
|
13
|
+
|
14
|
+
/* */
|
15
|
+
static VALUE rb_libarchive_writer_close(VALUE self) {
|
16
|
+
struct rb_libarchive_archive_container *p;
|
17
|
+
Data_Get_Struct(self, struct rb_libarchive_archive_container, p);
|
18
|
+
Check_Archive(p);
|
19
|
+
rb_libarchive_writer_close0(p);
|
20
|
+
return Qnil;
|
21
|
+
}
|
22
|
+
|
23
|
+
static VALUE rb_libarchive_writer_s_open0(int (*archive_open)(struct rb_libarchive_archive_container *, void *), void *arg, int compression, int format, const char *cmd) {
|
24
|
+
VALUE writer;
|
25
|
+
struct rb_libarchive_archive_container *p;
|
26
|
+
int r;
|
27
|
+
writer = rb_funcall(rb_cArchiveWriter, rb_intern("new"), 0);
|
28
|
+
Data_Get_Struct(writer, struct rb_libarchive_archive_container, p);
|
29
|
+
|
30
|
+
if ((p->ar = archive_write_new()) == NULL) {
|
31
|
+
rb_raise(rb_eArchiveError, "Open writer failed: %s", strerror(errno));
|
32
|
+
}
|
33
|
+
|
34
|
+
if (cmd != NULL) {
|
35
|
+
r = archive_write_set_compression_program(p->ar, cmd);
|
36
|
+
} else {
|
37
|
+
r = archive_write_set_compression(p->ar, compression);
|
38
|
+
}
|
39
|
+
|
40
|
+
if (r != ARCHIVE_OK) {
|
41
|
+
char error_string[BUFSIZ];
|
42
|
+
archive_copy_error_string(p->ar, error_string, BUFSIZ);
|
43
|
+
rb_libarchive_writer_close0(p);
|
44
|
+
rb_raise(rb_eArchiveError, "Set compression failed: %s", error_string);
|
45
|
+
}
|
46
|
+
|
47
|
+
if (archive_write_set_format(p->ar, format) != ARCHIVE_OK) {
|
48
|
+
char error_string[BUFSIZ];
|
49
|
+
archive_copy_error_string(p->ar, error_string, BUFSIZ);
|
50
|
+
rb_libarchive_writer_close0(p);
|
51
|
+
rb_raise(rb_eArchiveError, "Set format failed: %s", error_string);
|
52
|
+
}
|
53
|
+
|
54
|
+
if (archive_open(p, arg) != ARCHIVE_OK) {
|
55
|
+
char error_string[BUFSIZ];
|
56
|
+
archive_copy_error_string(p->ar, error_string, BUFSIZ);
|
57
|
+
rb_libarchive_writer_close0(p);
|
58
|
+
rb_raise(rb_eArchiveError, "Open writer failed: %s", error_string);
|
59
|
+
}
|
60
|
+
|
61
|
+
if (rb_block_given_p()) {
|
62
|
+
VALUE retval;
|
63
|
+
int status;
|
64
|
+
retval = rb_protect(rb_yield, writer, &status);
|
65
|
+
rb_libarchive_writer_close0(p);
|
66
|
+
|
67
|
+
if (status != 0) {
|
68
|
+
rb_jump_tag(status);
|
69
|
+
}
|
70
|
+
|
71
|
+
return retval;
|
72
|
+
} else {
|
73
|
+
return writer;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
static int rb_libarchive_writer_s_open_filename0(struct rb_libarchive_archive_container *p, void *arg) {
|
78
|
+
const char *filename = (const char *) arg;
|
79
|
+
return archive_write_open_filename(p->ar, filename);
|
80
|
+
}
|
81
|
+
|
82
|
+
/* */
|
83
|
+
static VALUE rb_libarchive_writer_s_open_filename(VALUE self, VALUE v_filename, VALUE v_compression, VALUE v_format) {
|
84
|
+
const char *filename = NULL;
|
85
|
+
int compression, format;
|
86
|
+
const char *cmd = NULL;
|
87
|
+
Check_Type(v_filename, T_STRING);
|
88
|
+
|
89
|
+
if (RSTRING_LEN(v_filename) < 1) {
|
90
|
+
rb_raise(rb_eArchiveError, "Open writer failed: No such file or directory");
|
91
|
+
}
|
92
|
+
|
93
|
+
filename = RSTRING_PTR(v_filename);
|
94
|
+
|
95
|
+
if (T_STRING == TYPE(v_compression)) {
|
96
|
+
compression = -1;
|
97
|
+
cmd = RSTRING_PTR(v_compression);
|
98
|
+
} else {
|
99
|
+
compression = NUM2INT(v_compression);
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
format = NUM2INT(v_format);
|
104
|
+
return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_filename0, (void *) filename, compression, format, cmd);
|
105
|
+
}
|
106
|
+
|
107
|
+
static int rb_libarchive_writer_s_open_memory0(struct rb_libarchive_archive_container *p, void *arg) {
|
108
|
+
VALUE str = (VALUE) arg;
|
109
|
+
p->memory = str;
|
110
|
+
return archive_write_open_rb_str(p->ar, str);
|
111
|
+
}
|
112
|
+
|
113
|
+
/* */
|
114
|
+
static VALUE rb_libarchive_writer_s_open_memory(VALUE self, VALUE v_memory, VALUE v_compression, VALUE v_format) {
|
115
|
+
int compression, format;
|
116
|
+
const char *cmd = NULL;
|
117
|
+
Check_Type(v_memory, T_STRING);
|
118
|
+
|
119
|
+
if (T_STRING == TYPE(v_compression)) {
|
120
|
+
compression = -1;
|
121
|
+
cmd = RSTRING_PTR(v_compression);
|
122
|
+
} else {
|
123
|
+
compression = NUM2INT(v_compression);
|
124
|
+
}
|
125
|
+
|
126
|
+
format = NUM2INT(v_format);
|
127
|
+
return rb_libarchive_writer_s_open0(rb_libarchive_writer_s_open_memory0, (void *) v_memory, compression, format, cmd);
|
128
|
+
}
|
129
|
+
|
130
|
+
/* */
|
131
|
+
static VALUE rb_libarchive_writer_new_entry(VALUE self) {
|
132
|
+
VALUE entry;
|
133
|
+
struct rb_libarchive_archive_container *p;
|
134
|
+
struct archive_entry *ae;
|
135
|
+
Data_Get_Struct(self, struct rb_libarchive_archive_container, p);
|
136
|
+
Check_Archive(p);
|
137
|
+
|
138
|
+
if ((ae = archive_entry_new()) == NULL) {
|
139
|
+
rb_raise(rb_eArchiveError, "New entry failed: %s", strerror(errno));
|
140
|
+
}
|
141
|
+
|
142
|
+
entry = rb_libarchive_entry_new(ae, 1);
|
143
|
+
|
144
|
+
if (rb_block_given_p()) {
|
145
|
+
VALUE retval;
|
146
|
+
int status;
|
147
|
+
retval = rb_protect(rb_yield, entry, &status);
|
148
|
+
rb_libarchive_entry_close(entry);
|
149
|
+
|
150
|
+
if (status != 0) {
|
151
|
+
rb_jump_tag(status);
|
152
|
+
}
|
153
|
+
|
154
|
+
return retval;
|
155
|
+
} else {
|
156
|
+
return entry;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
/* */
|
161
|
+
static VALUE rb_libarchive_writer_write_header(VALUE self, VALUE v_entry) {
|
162
|
+
struct rb_libarchive_archive_container *pa;
|
163
|
+
struct rb_libarchive_entry_container *pae;
|
164
|
+
Check_Class(v_entry, rb_cArchiveEntry);
|
165
|
+
Data_Get_Struct(self, struct rb_libarchive_archive_container, pa);
|
166
|
+
Check_Archive(pa);
|
167
|
+
Data_Get_Struct(v_entry, struct rb_libarchive_entry_container, pae);
|
168
|
+
Check_Entry(pae);
|
169
|
+
|
170
|
+
if (archive_write_header(pa->ar, pae->ae) != ARCHIVE_OK) {
|
171
|
+
rb_raise(rb_eArchiveError, "Write header failed: %s", archive_error_string(pa->ar));
|
172
|
+
}
|
173
|
+
|
174
|
+
return Qnil;
|
175
|
+
}
|
176
|
+
|
177
|
+
static ssize_t rb_libarchive_writer_write_data0(struct archive *ar, VALUE v_buff) {
|
178
|
+
const char *buff;
|
179
|
+
size_t size;
|
180
|
+
ssize_t n;
|
181
|
+
|
182
|
+
if (NIL_P(v_buff)) {
|
183
|
+
return 0;
|
184
|
+
}
|
185
|
+
|
186
|
+
Check_Type(v_buff, T_STRING);
|
187
|
+
buff = RSTRING_PTR(v_buff);
|
188
|
+
size = RSTRING_LEN(v_buff);
|
189
|
+
|
190
|
+
if (size < 1) {
|
191
|
+
return 0;
|
192
|
+
}
|
193
|
+
|
194
|
+
if ((n = archive_write_data(ar, buff, size)) < 0) {
|
195
|
+
rb_raise(rb_eArchiveError, "Write data failed: %s", archive_error_string(ar));
|
196
|
+
}
|
197
|
+
|
198
|
+
return n;
|
199
|
+
}
|
200
|
+
|
201
|
+
/* */
|
202
|
+
static VALUE rb_libarchive_writer_write_data(int argc, VALUE *argv, VALUE self) {
|
203
|
+
struct rb_libarchive_archive_container *p;
|
204
|
+
Data_Get_Struct(self, struct rb_libarchive_archive_container, p);
|
205
|
+
Check_Archive(p);
|
206
|
+
|
207
|
+
if (rb_block_given_p()) {
|
208
|
+
ssize_t len = 0;
|
209
|
+
|
210
|
+
if (argc > 0) {
|
211
|
+
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc);
|
212
|
+
}
|
213
|
+
|
214
|
+
while(1) {
|
215
|
+
VALUE retval;
|
216
|
+
ssize_t n;
|
217
|
+
retval = rb_yield(Qnil);
|
218
|
+
|
219
|
+
if ((n = rb_libarchive_writer_write_data0(p->ar, retval)) < 1) {
|
220
|
+
return LONG2NUM(len);
|
221
|
+
}
|
222
|
+
|
223
|
+
len += n;
|
224
|
+
}
|
225
|
+
} else {
|
226
|
+
VALUE v_buff;
|
227
|
+
ssize_t n;
|
228
|
+
rb_scan_args(argc, argv, "10", &v_buff);
|
229
|
+
n = rb_libarchive_writer_write_data0(p->ar, v_buff);
|
230
|
+
return LONG2NUM(n);
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
void Init_libarchive_writer() {
|
235
|
+
rb_cArchiveWriter = rb_define_class_under(rb_mArchive, "Writer", rb_cObject);
|
236
|
+
rb_define_alloc_func(rb_cArchiveWriter, rb_libarchive_archive_alloc);
|
237
|
+
rb_funcall(rb_cArchiveWriter, rb_intern("private_class_method"), 1, ID2SYM(rb_intern("new")));
|
238
|
+
rb_define_singleton_method(rb_cArchiveWriter, "open_filename", rb_libarchive_writer_s_open_filename, 3);
|
239
|
+
rb_define_singleton_method(rb_mArchive, "write_open_filename", rb_libarchive_writer_s_open_filename, 3);
|
240
|
+
rb_define_singleton_method(rb_cArchiveWriter, "open_memory", rb_libarchive_writer_s_open_memory, 3);
|
241
|
+
rb_define_singleton_method(rb_mArchive, "write_open_memory", rb_libarchive_writer_s_open_memory, 3);
|
242
|
+
rb_define_method(rb_cArchiveWriter, "close", rb_libarchive_writer_close, 0);
|
243
|
+
rb_define_method(rb_cArchiveWriter, "new_entry", rb_libarchive_writer_new_entry, 0);
|
244
|
+
rb_define_method(rb_cArchiveWriter, "write_header", rb_libarchive_writer_write_header, 1);
|
245
|
+
rb_define_method(rb_cArchiveWriter, "write_data", rb_libarchive_writer_write_data, -1);
|
246
|
+
}
|