aboutsummaryrefslogtreecommitdiff
path: root/gzread.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-12-13 22:25:59 -0800
committerMark Adler <madler@alumni.caltech.edu>2011-12-13 22:29:37 -0800
commit850a198ff1879e506c961c91da30009539ed14b3 (patch)
tree14e4847af5c6536a1f662a9f6562ccfa13486709 /gzread.c
parent377173b57ef9fab5066481a87a1901bd72fa2c32 (diff)
downloadzlib-850a198ff1879e506c961c91da30009539ed14b3.tar.gz
zlib-850a198ff1879e506c961c91da30009539ed14b3.tar.bz2
zlib-850a198ff1879e506c961c91da30009539ed14b3.zip
Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF.
Z_BUF_ERROR was also being used for an unsuccessful gzungetc and for buffer lengths that didn't fit in an int. Those uses were changed to Z_DATA_ERROR in order to assure that Z_BUF_ERROR occurs only when a premature end of input occurs, indicating that gzclearerr() can be used.
Diffstat (limited to 'gzread.c')
-rw-r--r--gzread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gzread.c b/gzread.c
index 1e97e38..4bbbf52 100644
--- a/gzread.c
+++ b/gzread.c
@@ -302,7 +302,7 @@ int ZEXPORT gzread(file, buf, len)
302 /* since an int is returned, make sure len fits in one, otherwise return 302 /* since an int is returned, make sure len fits in one, otherwise return
303 with an error (this avoids the flaw in the interface) */ 303 with an error (this avoids the flaw in the interface) */
304 if ((int)len < 0) { 304 if ((int)len < 0) {
305 gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); 305 gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
306 return -1; 306 return -1;
307 } 307 }
308 308
@@ -445,7 +445,7 @@ int ZEXPORT gzungetc(c, file)
445 445
446 /* if no room, give up (must have already done a gzungetc()) */ 446 /* if no room, give up (must have already done a gzungetc()) */
447 if (state->x.have == (state->size << 1)) { 447 if (state->x.have == (state->size << 1)) {
448 gz_error(state, Z_BUF_ERROR, "out of room to push characters"); 448 gz_error(state, Z_DATA_ERROR, "out of room to push characters");
449 return -1; 449 return -1;
450 } 450 }
451 451