summaryrefslogtreecommitdiff
path: root/gzread.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-10-02 13:24:43 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-10-02 13:34:29 -0700
commit26a99cd8957db86bdc75d9d1ebf00146cb20c87c (patch)
tree2f65d57da589c9e5475902fdf08a4aa8c4294bda /gzread.c
parent3c9d261809bfafc4350147ade7b74022dd144d32 (diff)
downloadzlib-26a99cd8957db86bdc75d9d1ebf00146cb20c87c.tar.gz
Add a transparent write mode to gzopen() when 'T' is in the mode.
Diffstat (limited to 'gzread.c')
-rw-r--r--gzread.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gzread.c b/gzread.c
index 4701f9e..521e26f 100644
--- a/gzread.c
+++ b/gzread.c
@@ -535,16 +535,12 @@ int ZEXPORT gzdirect(file)
return 0;
state = (gz_statep)file;
- /* check that we're reading */
- if (state->mode != GZ_READ)
- return 0;
-
/* if the state is not known, but we can find out, then do so (this is
mainly for right after a gzopen() or gzdopen()) */
- if (state->how == LOOK && state->x.have == 0)
+ if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
(void)gz_look(state);
- /* return 1 if reading direct, 0 if decompressing a gzip stream */
+ /* return 1 if transparent, 0 if processing a gzip stream */
return state->direct;
}