Skip to content

Commit

Permalink
[WIP] Support zlib streams over 2 GB
Browse files Browse the repository at this point in the history
retval
  • Loading branch information
schnaader committed Feb 23, 2018
1 parent 2dd1c32 commit 24d4378
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions precomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ FILE* fpng = NULL;
FILE* fjpg = NULL;
FILE* fmp3 = NULL;

int retval;
long long retval;
long long input_file_pos;

bool DEBUG_MODE = false;
Expand Down Expand Up @@ -3160,8 +3160,8 @@ int def_bzip2(FILE *source, FILE *dest, int level) {
return BZ_OK;
}

int file_recompress(FILE* origfile, int compression_level, int windowbits, int memlevel, int& decompressed_bytes_used, int decompressed_bytes_total, bool in_memory) {
int retval;
long long file_recompress(FILE* origfile, int compression_level, int windowbits, int memlevel, int& decompressed_bytes_used, int decompressed_bytes_total, bool in_memory) {
long long retval;

if (!in_memory) {
ftempout = fopen(tempfile1,"rb");
Expand All @@ -3182,8 +3182,8 @@ int file_recompress(FILE* origfile, int compression_level, int windowbits, int m
return retval;
}

int file_recompress_bzip2(FILE* origfile, int level, int& decompressed_bytes_used, int& decompressed_bytes_total) {
int retval;
long long file_recompress_bzip2(FILE* origfile, int level, int& decompressed_bytes_used, int& decompressed_bytes_total) {
long long retval;

ftempout = fopen(tempfile1,"rb");
fseek(ftempout, 0, SEEK_END);
Expand Down Expand Up @@ -3370,7 +3370,7 @@ void try_decompression_pdf(int windowbits, int pdf_header_length, int img_width,
print_debug_percent();
cout << "Possible zLib-Stream in PDF found at position " << saved_input_file_pos << ", windowbits = " << -windowbits << endl;
printf("Compressed size: %i\n", compressed_stream_size);
printf ("Can be decompressed to %i bytes\n", retval);
cout << "Can be decompressed to " << retval << " bytes" << endl;
}
for (int index = MTF.First(); index>=0; index=MTF.Next()){
if (comp_mem_level_count[index] == -1) continue;
Expand Down Expand Up @@ -3618,7 +3618,7 @@ void try_decompression_zip(int zip_header_length) {
print_debug_percent();
cout << "Possible zLib-Stream in ZIP found at position " << saved_input_file_pos << endl;
printf("Compressed size: %i\n", compressed_stream_size);
printf ("Can be decompressed to %i bytes\n", retval);
cout << "Can be decompressed to " << retval << " bytes" << endl;
}

for (windowbits = -15; windowbits < -7; windowbits++) {
Expand Down Expand Up @@ -4798,7 +4798,7 @@ while (fin_pos < fin_length) {
retval = def_part(fin, fout, compression_level, windowbits, memlevel, decompressed_data_length, recompressed_data_length);
if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}
} else { // lines aligned to 4 byte, skip those bytes
Expand All @@ -4808,7 +4808,7 @@ while (fin_pos < fin_length) {

if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -4925,7 +4925,7 @@ while (fin_pos < fin_length) {

if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -5038,7 +5038,7 @@ while (fin_pos < fin_length) {

if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -5119,7 +5119,7 @@ while (fin_pos < fin_length) {

if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -5237,7 +5237,7 @@ while (fin_pos < fin_length) {

if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -5627,7 +5627,7 @@ while (fin_pos < fin_length) {

if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -5804,7 +5804,7 @@ while (fin_pos < fin_length) {

if (retval != BZ_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -5971,7 +5971,7 @@ while (fin_pos < fin_length) {

if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -6074,7 +6074,7 @@ while (fin_pos < fin_length) {

if (retval != Z_OK) {
printf("Error recompressing data!");
printf("retval = %i\n", retval);
cout << "retval = " << retval << endl;
exit(0);
}

Expand Down Expand Up @@ -6863,7 +6863,7 @@ void try_decompression_gzip(int gzip_header_length) {
print_debug_percent();
cout << "Possible zLib-Stream in GZip found at position " << saved_input_file_pos << endl;
printf("Compressed size: %i\n", compressed_stream_size);
printf ("Can be decompressed to %i bytes\n", retval);
cout << "Can be decompressed to " << retval << " bytes" << endl;
}

for (windowbits = -15; windowbits < -7; windowbits++) {
Expand Down Expand Up @@ -6995,7 +6995,7 @@ void try_decompression_png (int windowbits) {
print_debug_percent();
cout << "Possible zLib-Stream in PNG found at position " << saved_input_file_pos << ", windowbits = " << -windowbits << endl;
printf("Compressed size: %i\n", compressed_stream_size);
printf ("Can be decompressed to %i bytes\n", retval);
cout << "Can be decompressed to " << retval << " bytes" << endl;
}

for (int index = MTF.First(); index>=0; index=MTF.Next()){
Expand Down Expand Up @@ -7108,7 +7108,7 @@ void try_decompression_png_multi(int windowbits) {
print_debug_percent();
cout << "Possible zLib-Stream in multiPNG found at position " << saved_input_file_pos << ", windowbits = " << -windowbits << endl;
printf("Compressed size: %i\n", compressed_stream_size);
printf ("Can be decompressed to %i bytes\n", retval);
cout << "Can be decompressed to " << retval << " bytes" << endl;
}

for (int index = MTF.First(); index>=0; index=MTF.Next()){
Expand Down Expand Up @@ -8239,7 +8239,7 @@ void try_decompression_zlib(int windowbits) {
print_debug_percent();
cout << "Possible zLib-Stream (intense mode) found at position " << saved_input_file_pos << ", windowbits = " << -windowbits << endl;
printf("Compressed size: %i\n", compressed_stream_size);
printf ("Can be decompressed to %i bytes\n", retval);
cout << "Can be decompressed to " << retval << " bytes" << endl;
}

for (int index = MTF.First(); index>=0; index=MTF.Next()){
Expand Down Expand Up @@ -8369,7 +8369,7 @@ void try_decompression_brute() {
print_debug_percent();
cout << "Possible zLib-Stream (brute mode) found at position " << saved_input_file_pos << endl;
printf("Compressed size: %i\n", compressed_stream_size);
printf ("Can be decompressed to %i bytes\n", retval);
cout << "Can be decompressed to " << retval << " bytes" << endl;
}

for (windowbits = -15; windowbits < -7; windowbits++) {
Expand Down Expand Up @@ -8492,7 +8492,7 @@ void try_decompression_swf(int windowbits) {
print_debug_percent();
cout << "Possible zLib-Stream in SWF found at position " << saved_input_file_pos << ", windowbits = " << -windowbits << endl;
printf("Compressed size: %i\n", compressed_stream_size);
printf ("Can be decompressed to %i bytes\n", retval);
cout << "Can be decompressed to " << retval << " bytes" << endl;
}

for (int index = MTF.First(); index>=0; index=MTF.Next()){
Expand Down

0 comments on commit 24d4378

Please sign in to comment.