// Archive Stuff
-int pakfire_archive_copy_data(struct pakfire* pakfire,
- struct archive* src, struct archive* dst);
int pakfire_archive_copy_data_from_file(struct pakfire* pakfire,
struct archive* archive, FILE* f);
int pakfire_archive_copy_data_to_buffer(struct pakfire* pakfire, struct archive* a,
// Archive Stuff
-int pakfire_archive_copy_data(struct pakfire* pakfire,
- struct archive* src, struct archive* dst) {
- const void* buffer = NULL;
- size_t size = 0;
- off_t offset = 0;
-
- int r;
-
- for (;;) {
- // Read a block of data
- r = archive_read_data_block(src, &buffer, &size, &offset);
-
- // Exit if we have read everything from source
- if (r == ARCHIVE_EOF)
- return ARCHIVE_OK;
-
- // Catch any reading errors
- else if (r) {
- ERROR(pakfire, "Read error: %s\n", archive_error_string(src));
- return r;
- }
-
- // Write the read block of data
- r = archive_write_data(dst, buffer, size);
- if (r < 0) {
- ERROR(pakfire, "Write error: %s\n", archive_error_string(dst));
- return r;
- }
- }
-}
-
int pakfire_archive_copy_data_from_file(struct pakfire* pakfire,
struct archive* archive, FILE* f) {
char buffer[BUFFER_SIZE];