pakfire_progressbar_update(data->progressbar, position);
}
-static int __pakfire_extract_entry(struct pakfire* pakfire, struct pakfire_extract* data,
- struct archive_entry* entry) {
+static int __pakfire_extract(struct pakfire* pakfire, struct archive* a,
+ struct archive_entry* entry, void* p) {
struct pakfire_file* file = NULL;
char buffer[PATH_MAX];
int r;
+ struct pakfire_extract* data = (struct pakfire_extract*)p;
+
// Fetch path
const char* path = archive_entry_pathname(entry);
pakfire_progressbar_start(data.progressbar, size);
}
- struct archive_entry* entry = NULL;
-
- // Walk through the archive
- while (1) {
- r = archive_read_next_header(archive, &entry);
-
- // End when we have reached the end of the archive
- if (r == ARCHIVE_EOF) {
- r = 0;
- break;
- }
-
- // Raise any other errors
- else if (r) {
- ERROR(pakfire, "Could not read next header: %s\n",
- archive_error_string(archive));
- goto ERROR;
- }
-
- // Extract the entry
- r = __pakfire_extract_entry(pakfire, &data, entry);
- if (r)
- goto ERROR;
- }
+ // Walk through the entire archive
+ r = pakfire_walk(pakfire, archive, __pakfire_extract, NULL, &data);
+ if (r)
+ goto ERROR;
// Finish the progressbar
if (data.progressbar)