lib: drop libarchive compat macros and use non deprecated functions
This commit is contained in:
parent
fcbd7ef042
commit
2dc22401d5
@ -56,41 +56,6 @@
|
|||||||
#define __UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
|
#define __UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* libarchive compat */
|
|
||||||
#if ARCHIVE_VERSION_NUMBER >= 3000000
|
|
||||||
|
|
||||||
#define archive_read_support_compression_all(x) \
|
|
||||||
archive_read_support_filter_all(x)
|
|
||||||
|
|
||||||
#define archive_read_support_compression_gzip(x) \
|
|
||||||
archive_read_support_filter_gzip(x)
|
|
||||||
|
|
||||||
#define archive_read_support_compression_bzip2(x) \
|
|
||||||
archive_read_support_filter_bzip2(x)
|
|
||||||
|
|
||||||
#define archive_read_support_compression_xz(x) \
|
|
||||||
archive_read_support_filter_xz(x)
|
|
||||||
|
|
||||||
#define archive_write_set_compression_gzip(x) \
|
|
||||||
archive_write_add_filter_gzip(x)
|
|
||||||
|
|
||||||
#define archive_write_set_compression_bzip2(x) \
|
|
||||||
archive_write_add_filter_bzip2(x)
|
|
||||||
|
|
||||||
#define archive_write_set_compression_xz(x) \
|
|
||||||
archive_write_add_filter_xz(x)
|
|
||||||
|
|
||||||
#define archive_read_finish(x) \
|
|
||||||
archive_read_free(x)
|
|
||||||
|
|
||||||
#define archive_write_finish(x) \
|
|
||||||
archive_write_free(x)
|
|
||||||
|
|
||||||
#define archive_compression_name(x) \
|
|
||||||
archive_filter_name(x, 0)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __arraycount
|
#ifndef __arraycount
|
||||||
#define __arraycount(x) (sizeof(x) / sizeof(*x))
|
#define __arraycount(x) (sizeof(x) / sizeof(*x))
|
||||||
#endif
|
#endif
|
||||||
|
@ -572,8 +572,8 @@ xbps_unpack_binary_pkg(struct xbps_handle *xhp, xbps_dictionary_t pkg_repod)
|
|||||||
out:
|
out:
|
||||||
if (pkg_fd != -1)
|
if (pkg_fd != -1)
|
||||||
close(pkg_fd);
|
close(pkg_fd);
|
||||||
if (ar)
|
if (ar != NULL)
|
||||||
archive_read_finish(ar);
|
archive_read_free(ar);
|
||||||
if (bpkg)
|
if (bpkg)
|
||||||
free(bpkg);
|
free(bpkg);
|
||||||
|
|
||||||
|
@ -103,8 +103,8 @@ open_archive_by_url(struct url *url)
|
|||||||
archive_read_support_format_tar(a);
|
archive_read_support_format_tar(a);
|
||||||
|
|
||||||
if (archive_read_open(a, f, fetch_archive_open, fetch_archive_read,
|
if (archive_read_open(a, f, fetch_archive_open, fetch_archive_read,
|
||||||
fetch_archive_close)) {
|
fetch_archive_close) != ARCHIVE_OK) {
|
||||||
archive_read_finish(a);
|
archive_read_free(a);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,8 +128,9 @@ open_archive(const char *url)
|
|||||||
archive_read_support_filter_zstd(a);
|
archive_read_support_filter_zstd(a);
|
||||||
archive_read_support_format_tar(a);
|
archive_read_support_format_tar(a);
|
||||||
|
|
||||||
if (archive_read_open_filename(a, url, 32768)) {
|
/* XXX: block size? */
|
||||||
archive_read_finish(a);
|
if (archive_read_open_filename(a, url, 32768) != ARCHIVE_OK) {
|
||||||
|
archive_read_free(a);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
@ -170,7 +171,7 @@ xbps_archive_fetch_file(const char *url, const char *fname)
|
|||||||
}
|
}
|
||||||
archive_read_data_skip(a);
|
archive_read_data_skip(a);
|
||||||
}
|
}
|
||||||
archive_read_finish(a);
|
archive_read_free(a);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -212,7 +213,7 @@ xbps_repo_fetch_remote(struct xbps_repo *repo, const char *url)
|
|||||||
if (i == 2)
|
if (i == 2)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
archive_read_finish(a);
|
archive_read_free(a);
|
||||||
|
|
||||||
if (xbps_object_type(repo->idxmeta) == XBPS_TYPE_DICTIONARY)
|
if (xbps_object_type(repo->idxmeta) == XBPS_TYPE_DICTIONARY)
|
||||||
repo->is_signed = true;
|
repo->is_signed = true;
|
||||||
@ -253,7 +254,7 @@ xbps_archive_fetch_file_into_fd(const char *url, const char *fname, int fd)
|
|||||||
}
|
}
|
||||||
archive_read_data_skip(a);
|
archive_read_data_skip(a);
|
||||||
}
|
}
|
||||||
archive_read_finish(a);
|
archive_read_free(a);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -373,7 +373,7 @@ xbps_repo_close(struct xbps_repo *repo)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (repo->ar != NULL) {
|
if (repo->ar != NULL) {
|
||||||
archive_read_finish(repo->ar);
|
archive_read_free(repo->ar);
|
||||||
repo->ar = NULL;
|
repo->ar = NULL;
|
||||||
}
|
}
|
||||||
if (repo->fd != -1) {
|
if (repo->fd != -1) {
|
||||||
|
@ -732,8 +732,8 @@ collect_binpkg_files(struct xbps_handle *xhp, xbps_dictionary_t pkg_repod,
|
|||||||
out:
|
out:
|
||||||
if (pkg_fd != -1)
|
if (pkg_fd != -1)
|
||||||
close(pkg_fd);
|
close(pkg_fd);
|
||||||
if (ar)
|
if (ar != NULL)
|
||||||
archive_read_finish(ar);
|
archive_read_free(ar);
|
||||||
free(bpkg);
|
free(bpkg);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user