]> git.lizzy.rs Git - zlib.git/commitdiff
Simplify gzseek() now that raw after gzip is ignored.
authorMark Adler <madler@alumni.caltech.edu>
Tue, 27 Sep 2011 01:34:07 +0000 (18:34 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Tue, 27 Sep 2011 01:34:07 +0000 (18:34 -0700)
gzguts.h
gzlib.c
gzread.c

index 0f8fb79f87d4f65e7f5667129c763e3a361199f2..63b0c3f4a63a56e25e34e5b1601df57a2f6f2abd 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
@@ -98,7 +98,6 @@ typedef struct {
     unsigned have;          /* amount of output data unused at next */
     int eof;                /* true if end of input file reached */
     z_off64_t start;        /* where the gzip data started, for rewinding */
-    z_off64_t raw;          /* where the raw data started, for seeking */
     int how;                /* 0: get header, 1: copy, 2: decompress */
     int direct;             /* true if last read direct, false if gzip */
         /* just for writing */
diff --git a/gzlib.c b/gzlib.c
index c59bcda345b8f0b49982bdb35952f7a1f442007f..b26b0c2ffc110775c7034c1920df424e982bf39b 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -310,7 +310,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
 
     /* if within raw area while reading, just go there */
     if (state->mode == GZ_READ && state->how == COPY &&
-        state->pos + offset >= state->raw) {
+            state->pos + offset >= 0) {
         ret = LSEEK(state->fd, offset - state->have, SEEK_CUR);
         if (ret == -1)
             return -1;
index 960bf12671545a1a7aeac61f1ec41e165dc449ae..a41e5d940e9e71449e93a8444e8d53c9b0fcfc4d 100644 (file)
--- a/gzread.c
+++ b/gzread.c
@@ -144,10 +144,9 @@ local int gz_look(state)
         return 0;
     }
 
-    /* doing raw i/o, save start of raw data for seeking, copy any leftover
-       input to output -- this assumes that the output buffer is larger than
-       the input buffer, which also assures space for gzungetc() */
-    state->raw = state->pos;
+    /* doing raw i/o, copy any leftover input to output -- this assumes that
+       the output buffer is larger than the input buffer, which also assures
+       space for gzungetc() */
     state->next = state->out;
     if (strm->avail_in) {
         memcpy(state->next, strm->next_in, strm->avail_in);