Undeprecate libarchive calls; Patch by Christian Hesse.
authorColin Leroy <colin@colino.net>
Thu, 19 Jun 2014 05:51:34 +0000 (07:51 +0200)
committerColin Leroy <colin@colino.net>
Thu, 19 Jun 2014 05:51:34 +0000 (07:51 +0200)
src/plugins/archive/libarchive_archive.c

index 478202c..492fea7 100644 (file)
@@ -389,7 +389,7 @@ const gchar* archive_extract(const char* archive_name, int flags) {
        in = archive_read_new();
        if ((res = archive_read_support_format_tar(in)) == ARCHIVE_OK) {
                if ((res = archive_read_support_compression_gzip(in)) == ARCHIVE_OK) {
        in = archive_read_new();
        if ((res = archive_read_support_format_tar(in)) == ARCHIVE_OK) {
                if ((res = archive_read_support_compression_gzip(in)) == ARCHIVE_OK) {
-                       if ((res = archive_read_open_file(
+                       if ((res = archive_read_open_filename(
                                in, archive_name, READ_BLOCK_SIZE)) != ARCHIVE_OK) {
                                buf = g_strdup_printf(
                                                "%s: %s\n", archive_name, archive_error_string(in));
                                in, archive_name, READ_BLOCK_SIZE)) != ARCHIVE_OK) {
                                buf = g_strdup_printf(
                                                "%s: %s\n", archive_name, archive_error_string(in));
@@ -444,7 +444,7 @@ const gchar* archive_extract(const char* archive_name, int flags) {
                                        result = archive_error_string(out);
                                archive_read_close(in);
                        }
                                        result = archive_error_string(out);
                                archive_read_close(in);
                        }
-                       archive_read_finish(in);
+                       archive_read_free(in);
                }
                else
                        result = archive_error_string(in);
                }
                else
                        result = archive_error_string(in);
@@ -478,21 +478,21 @@ const gchar* archive_create(const char* archive_name, GSList* files,
        arch = archive_write_new();
        switch (method) {
                case ZIP:
        arch = archive_write_new();
        switch (method) {
                case ZIP:
-                       if (archive_write_set_compression_gzip(arch) != ARCHIVE_OK)
+                       if (archive_write_add_filter_gzip(arch) != ARCHIVE_OK)
                                return archive_error_string(arch);
                        break;
                case BZIP2:
                                return archive_error_string(arch);
                        break;
                case BZIP2:
-                       if (archive_write_set_compression_bzip2(arch) != ARCHIVE_OK)
+                       if (archive_write_add_filter_bzip2(arch) != ARCHIVE_OK)
                                return archive_error_string(arch);
                        break;
 #if NEW_ARCHIVE_API
                case COMPRESS:
                                return archive_error_string(arch);
                        break;
 #if NEW_ARCHIVE_API
                case COMPRESS:
-                       if (archive_write_set_compression_compress(arch) != ARCHIVE_OK)
+                       if (archive_write_add_filter_compress(arch) != ARCHIVE_OK)
                                return archive_error_string(arch);
                        break;
 #endif
                case NO_COMPRESS:
                                return archive_error_string(arch);
                        break;
 #endif
                case NO_COMPRESS:
-                       if (archive_write_set_compression_none(arch) != ARCHIVE_OK)
+                       if (archive_write_add_filter_none(arch) != ARCHIVE_OK)
                                return archive_error_string(arch);
                        break;
        }
                                return archive_error_string(arch);
                        break;
        }
@@ -516,7 +516,7 @@ const gchar* archive_create(const char* archive_name, GSList* files,
                case NO_FORMAT:
                        return "Missing archive format";
        }
                case NO_FORMAT:
                        return "Missing archive format";
        }
-       if (archive_write_open_file(arch, archive_name) != ARCHIVE_OK)
+       if (archive_write_open_filename(arch, archive_name) != ARCHIVE_OK)
                return archive_error_string(arch);
 
        while (files && ! stop_action) {
                return archive_error_string(arch);
 
        while (files && ! stop_action) {
@@ -592,7 +592,7 @@ const gchar* archive_create(const char* archive_name, GSList* files,
        stop_action = FALSE;
 #endif
        archive_write_close(arch);
        stop_action = FALSE;
 #endif
        archive_write_close(arch);
-       archive_write_finish(arch);
+       archive_write_free(arch);
        return NULL;
 }
 
        return NULL;
 }