Skip to content

Commit b18a41d

Browse files
committed
Port to libarchive 3.0
Replace the deprecated functions with their libarchive 3.0 replacements as listed at: https://github.com/libarchive/libarchive/wiki/ManPageLibarchiveChanges3
1 parent e4404c4 commit b18a41d

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

ar_read.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ static int ar_read(lua_State *L) {
8585
{ NULL, NULL }
8686
};
8787
static named_setter compression_names[] = {
88-
{ "all", archive_read_support_compression_all },
89-
{ "bzip2", archive_read_support_compression_bzip2 },
90-
{ "compress", archive_read_support_compression_compress },
91-
{ "gzip", archive_read_support_compression_gzip },
92-
{ "lzma", archive_read_support_compression_lzma },
93-
{ "none", archive_read_support_compression_none },
94-
{ "xz", archive_read_support_compression_xz },
88+
{ "all", archive_read_support_filter_all },
89+
{ "bzip2", archive_read_support_filter_bzip2 },
90+
{ "compress", archive_read_support_filter_compress },
91+
{ "gzip", archive_read_support_filter_gzip },
92+
{ "lzma", archive_read_support_filter_lzma },
93+
{ "none", archive_read_support_filter_none },
94+
{ "xz", archive_read_support_filter_xz },
9595
{ NULL, NULL }
9696
};
9797

@@ -118,7 +118,7 @@ static int ar_read(lua_State *L) {
118118
// Do it the easy way for now... perhaps in the future we will
119119
// have a parameter to support toggling which algorithms are
120120
// supported:
121-
if ( ARCHIVE_OK != archive_read_support_compression_all(*self_ref) ) {
121+
if ( ARCHIVE_OK != archive_read_support_filter_all(*self_ref) ) {
122122
err("archive_read_support_compression_all: %s", archive_error_string(*self_ref));
123123
}
124124
if ( ARCHIVE_OK != archive_read_support_format_all(*self_ref) ) {
@@ -197,7 +197,7 @@ static int ar_read_destroy(lua_State *L) {
197197

198198
if ( ARCHIVE_OK != archive_read_close(*self_ref) ) {
199199
lua_pushfstring(L, "archive_read_close: %s", archive_error_string(*self_ref));
200-
archive_read_finish(*self_ref);
200+
archive_read_free(*self_ref);
201201
__ref_count--;
202202
*self_ref = NULL;
203203
lua_error(L);
@@ -210,8 +210,8 @@ static int ar_read_destroy(lua_State *L) {
210210
lua_call(L, 2, 1); // {self}, result
211211
}
212212

213-
if ( ARCHIVE_OK != archive_read_finish(*self_ref) ) {
214-
luaL_error(L, "archive_read_finish: %s", archive_error_string(*self_ref));
213+
if ( ARCHIVE_OK != archive_read_free(*self_ref) ) {
214+
luaL_error(L, "archive_read_free: %s", archive_error_string(*self_ref));
215215
}
216216
__ref_count--;
217217
*self_ref = NULL;

ar_write.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ static int ar_write(lua_State *L) {
154154
const char *name;
155155
int (*setter)(struct archive *);
156156
} names[] = {
157-
{ "bzip2", archive_write_set_compression_bzip2 },
158-
{ "compress", archive_write_set_compression_compress },
159-
{ "gzip", archive_write_set_compression_gzip },
160-
{ "lzma", archive_write_set_compression_lzma },
161-
{ "xz", archive_write_set_compression_xz },
157+
{ "bzip2", archive_write_add_filter_bzip2 },
158+
{ "compress", archive_write_add_filter_compress },
159+
{ "gzip", archive_write_add_filter_gzip },
160+
{ "lzma", archive_write_add_filter_lzma },
161+
{ "xz", archive_write_add_filter_xz },
162162
{ NULL, NULL }
163163
};
164164
int idx = 0;
@@ -215,7 +215,7 @@ static int ar_write_destroy(lua_State *L) {
215215

216216
if ( ARCHIVE_OK != archive_write_close(*self_ref) ) {
217217
lua_pushfstring(L, "archive_write_close: %s", archive_error_string(*self_ref));
218-
archive_write_finish(*self_ref);
218+
archive_write_free(*self_ref);
219219
__ref_count--;
220220
*self_ref = NULL;
221221
lua_error(L);
@@ -228,8 +228,8 @@ static int ar_write_destroy(lua_State *L) {
228228
lua_call(L, 2, 1); // {self}, result
229229
}
230230

231-
if ( ARCHIVE_OK != archive_write_finish(*self_ref) ) {
232-
luaL_error(L, "archive_write_finish: %s", archive_error_string(*self_ref));
231+
if ( ARCHIVE_OK != archive_write_free(*self_ref) ) {
232+
luaL_error(L, "archive_write_free: %s", archive_error_string(*self_ref));
233233
}
234234
__ref_count--;
235235
*self_ref = NULL;

0 commit comments

Comments
 (0)