diff options
Diffstat (limited to 'gzio.c')
-rw-r--r-- | gzio.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -150,7 +150,12 @@ local gzFile gz_open (path, mode, fd) | |||
150 | */ | 150 | */ |
151 | fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], | 151 | fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], |
152 | Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); | 152 | Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); |
153 | s->startpos = ftell(s->file); | 153 | s->startpos = 10L; |
154 | /* We use 10L instead of ftell(s->file) to because ftell causes an | ||
155 | * fflush on some systems. This version of the library doesn't use | ||
156 | * startpos anyway in write mode, so this initialization is not | ||
157 | * necessary. | ||
158 | */ | ||
154 | } else { | 159 | } else { |
155 | check_header(s); /* skip the .gz header */ | 160 | check_header(s); /* skip the .gz header */ |
156 | s->startpos = (ftell(s->file) - s->stream.avail_in); | 161 | s->startpos = (ftell(s->file) - s->stream.avail_in); |
@@ -423,7 +428,7 @@ int EXPORT gzread (file, buf, len) | |||
423 | int EXPORT gzgetc(file) | 428 | int EXPORT gzgetc(file) |
424 | gzFile file; | 429 | gzFile file; |
425 | { | 430 | { |
426 | int c; | 431 | unsigned char c; |
427 | 432 | ||
428 | return gzread(file, &c, 1) == 1 ? c : -1; | 433 | return gzread(file, &c, 1) == 1 ? c : -1; |
429 | } | 434 | } |
@@ -524,7 +529,9 @@ int EXPORT gzputc(file, c) | |||
524 | gzFile file; | 529 | gzFile file; |
525 | int c; | 530 | int c; |
526 | { | 531 | { |
527 | return gzwrite(file, &c, 1) == 1 ? c : -1; | 532 | unsigned char cc = (unsigned char) c; /* required for big endian systems */ |
533 | |||
534 | return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; | ||
528 | } | 535 | } |
529 | 536 | ||
530 | 537 | ||
@@ -627,7 +634,7 @@ z_off_t EXPORT gzseek (file, offset, whence) | |||
627 | 634 | ||
628 | offset -= size; | 635 | offset -= size; |
629 | } | 636 | } |
630 | return s->stream.total_in; | 637 | return (z_off_t)s->stream.total_in; |
631 | #endif | 638 | #endif |
632 | } | 639 | } |
633 | /* Rest of function is for reading only */ | 640 | /* Rest of function is for reading only */ |
@@ -667,7 +674,7 @@ z_off_t EXPORT gzseek (file, offset, whence) | |||
667 | if (size <= 0) return -1L; | 674 | if (size <= 0) return -1L; |
668 | offset -= size; | 675 | offset -= size; |
669 | } | 676 | } |
670 | return s->stream.total_out; | 677 | return (z_off_t)s->stream.total_out; |
671 | } | 678 | } |
672 | 679 | ||
673 | /* =========================================================================== | 680 | /* =========================================================================== |