Changeset 24324
- Timestamp:
- 10/15/13 13:00:37 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/global.h
r24279 r24324 3255 3255 stream.avail_in = inlen; 3256 3256 stream.next_in = (void*)inbuf; 3257 3257 3258 3258 do 3259 3259 { … … 3268 3268 return 1; 3269 3269 } 3270 3271 3270 } 3272 3271 while(stream.avail_out == 0); 3272 3273 char* tmpoutbuf = *outbuf; 3273 3274 *outlen = inlen - stream.avail_out; 3274 3275 *outbuf = realloc(*outbuf, *outlen); 3276 if(*outbuf == NULL) free(tmpoutbuf); 3275 3277 3276 3278 (void)deflateEnd(&stream); … … 3323 3325 stream.next_in = (void*)inbuf; 3324 3326 3327 int round = 0; 3325 3328 do 3326 3329 { 3327 3330 stream.avail_out = maxbuf; 3328 stream.next_out = (void*)*outbuf; 3331 3332 if(flag == 0 && round > 0) 3333 { 3334 char* tmpoutbuf = *outbuf; 3335 *outbuf = realloc(*outbuf, maxbuf * (round + 1)); 3336 if(*outbuf == NULL) 3337 { 3338 free(tmpoutbuf); 3339 (void)inflateEnd(&stream); 3340 return 1; 3341 } 3342 stream.next_out = (void*)(*outbuf) + maxbuf * round; 3343 } 3344 else 3345 stream.next_out = (void*)*outbuf; 3329 3346 3330 3347 ret = inflate(&stream, Z_NO_FLUSH); … … 3340 3357 } 3341 3358 3359 round++; 3342 3360 } 3343 3361 while(stream.avail_out == 0); 3344 *outlen = maxbuf - stream.avail_out; 3345 if(flag == 0) *outbuf = realloc(*outbuf, *outlen); 3362 3363 if(flag == 0) 3364 { 3365 char* tmpoutbuf = *outbuf; 3366 *outlen = (maxbuf * round) - stream.avail_out; 3367 *outbuf = realloc(*outbuf, *outlen); 3368 if(*outbuf == NULL) free(tmpoutbuf); 3369 } 3370 else 3371 *outlen = maxbuf - stream.avail_out; 3346 3372 3347 3373 (void)inflateEnd(&stream);
Note: See TracChangeset
for help on using the changeset viewer.