Changeset 525d09d for libwandio/ior-zlib.c
- Timestamp:
- 09/30/14 15:14:02 (8 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- c69aecb
- Parents:
- 092a09c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libwandio/ior-zlib.c
r60f3c4c r525d09d 56 56 int outoffset; 57 57 enum err_t err; 58 size_t sincelastend; 58 59 }; 59 60 … … 83 84 DATA(io)->strm.opaque = NULL; 84 85 DATA(io)->err = ERR_OK; 86 DATA(io)->sincelastend = 1; 85 87 86 88 inflateInit2(&DATA(io)->strm, 15 | 32); … … 108 110 sizeof(DATA(io)->inbuff)); 109 111 if (bytes_read == 0) { 110 /* EOF */ 112 /* If we get EOF immediately after a 113 * Z_STREAM_END, then we assume we've reached 114 * the end of the file. If there was data 115 * between the Z_STREAM_END and the EOF, the 116 * file has more likely been truncated. 117 */ 118 if (DATA(io)->sincelastend > 0) { 119 fprintf(stderr, "Unexpected EOF while reading compressed file -- file is probably incomplete\n"); 120 errno = EIO; 121 DATA(io)->err = ERR_ERROR; 122 return -1; 123 } 124 125 /* EOF */ 111 126 if (DATA(io)->strm.avail_out == (uint32_t)len) { 112 127 DATA(io)->err = ERR_EOF; 113 128 return 0; 114 129 } … … 128 143 DATA(io)->strm.next_in = DATA(io)->inbuff; 129 144 DATA(io)->strm.avail_in = bytes_read; 145 DATA(io)->sincelastend += bytes_read; 130 146 } 131 147 /* Decompress some data into the output buffer */ … … 144 160 inflateInit2(&DATA(io)->strm, 15 | 32); 145 161 DATA(io)->err = ERR_OK; 162 DATA(io)->sincelastend = 0; 146 163 break; 147 164 default:
Note: See TracChangeset
for help on using the changeset viewer.