|
@@ -16,8 +16,8 @@ static int processComments(struct archive *archiveOut, char buf[], size_t size,
|
|
|
archive_entry_set_filetype(newEntry, AE_IFREG);
|
|
|
archive_entry_set_perm(newEntry, 0664);
|
|
|
|
|
|
- Stopif(archive_write_header(archiveOut, newEntry) != ARCHIVE_OK, return -2, "Can't write entry header (comments)!\n");
|
|
|
- Stopif(archive_write_data(archiveOut, comments->data, comments->size) != comments->size, return -3, "Can't write data (comments)!\n");
|
|
|
+ Stopif(archive_write_header(archiveOut, newEntry) != ARCHIVE_OK, return 0, "Can't write entry header (comments)!\n");
|
|
|
+ Stopif(archive_write_data(archiveOut, comments->data, comments->size) != comments->size, return 0, "Can't write data (comments)!\n");
|
|
|
archive_entry_free(newEntry);
|
|
|
XMLBuffFree(comments);
|
|
|
return 1;
|
|
@@ -31,13 +31,13 @@ static int rewriteZIP(struct archive *archiveIn, struct archive *archiveOut) {
|
|
|
const char* path = archive_entry_pathname(entryIn);
|
|
|
int64_t size = archive_entry_size(entryIn);
|
|
|
char buf[size];
|
|
|
- Stopif(archive_read_data(archiveIn, buf, size) != size, return -2, "Archive entry has no size (%s)!\n", path);
|
|
|
+ Stopif(archive_read_data(archiveIn, buf, size) != size, return 0, "Archive entry has no size (%s)!\n", path);
|
|
|
|
|
|
if (strcmp(commentsFile, path) == 0){
|
|
|
- Stopif(!processComments(archiveOut, buf, size, path), return -1, "Can't process comments!\n");
|
|
|
+ Stopif(!processComments(archiveOut, buf, size, path), return 0, "Can't process comments!\n");
|
|
|
} else {
|
|
|
- Stopif(archive_write_header(archiveOut, entryIn) != ARCHIVE_OK, return -2, "Can't write entry header!\n");
|
|
|
- Stopif(archive_write_data(archiveOut, buf, size) != size, return -3, "Can't write data!\n");
|
|
|
+ Stopif(archive_write_header(archiveOut, entryIn) != ARCHIVE_OK, return 0, "Can't write entry header!\n");
|
|
|
+ Stopif(archive_write_data(archiveOut, buf, size) != size, return 0, "Can't write data!\n");
|
|
|
}
|
|
|
}
|
|
|
return 1;
|
|
@@ -49,16 +49,16 @@ static int processDOCX(char const *infile, char const *outfile) {
|
|
|
|
|
|
archiveIn = archive_read_new();
|
|
|
archive_read_support_format_zip(archiveIn);
|
|
|
- Stopif(archive_read_open_filename(archiveIn, infile, 10240), return -1, "Can't read file %s!\n", infile);
|
|
|
+ Stopif(archive_read_open_filename(archiveIn, infile, 10240), return 0, "Can't read file %s!\n", infile);
|
|
|
|
|
|
archiveOut = archive_write_new();
|
|
|
archive_write_set_format_zip(archiveOut);
|
|
|
|
|
|
- Stopif(archive_write_open_filename(archiveOut, outfile) != ARCHIVE_OK, return -1, "Can't create new archive %s!\n", outfile);
|
|
|
+ Stopif(archive_write_open_filename(archiveOut, outfile) != ARCHIVE_OK, return 0, "Can't create new archive %s!\n", outfile);
|
|
|
|
|
|
- Stopif(!rewriteZIP(archiveIn, archiveOut), return -1, "Problems rewriting zip!\n");
|
|
|
- Stopif(archive_read_free(archiveIn) != ARCHIVE_OK, return -1, "Can't free %s!\n", infile);
|
|
|
- Stopif(archive_write_free(archiveOut) != ARCHIVE_OK, return -1, "Can't free %s!\n", outfile);
|
|
|
+ Stopif(!rewriteZIP(archiveIn, archiveOut), return 0, "Problems rewriting zip!\n");
|
|
|
+ Stopif(archive_read_free(archiveIn) != ARCHIVE_OK, return 0, "Can't free %s!\n", infile);
|
|
|
+ Stopif(archive_write_free(archiveOut) != ARCHIVE_OK, return 0, "Can't free %s!\n", outfile);
|
|
|
return 1;
|
|
|
}
|
|
|
|