diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/zran.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/zran.c b/examples/zran.c index 9c3e5dc..d3f5a36 100644 --- a/examples/zran.c +++ b/examples/zran.c | |||
@@ -402,8 +402,12 @@ ptrdiff_t deflate_index_extract(FILE *in, struct deflate_index *index, | |||
402 | // Update the appropriate count. | 402 | // Update the appropriate count. |
403 | if (offset) | 403 | if (offset) |
404 | offset -= got; | 404 | offset -= got; |
405 | else | 405 | else { |
406 | left -= got; | 406 | left -= got; |
407 | if (left == 0) | ||
408 | // Request satisfied. | ||
409 | break; | ||
410 | } | ||
407 | 411 | ||
408 | // If we're at the end of a gzip member and there's more to read, | 412 | // If we're at the end of a gzip member and there's more to read, |
409 | // continue to the next gzip member. | 413 | // continue to the next gzip member. |
@@ -450,7 +454,7 @@ ptrdiff_t deflate_index_extract(FILE *in, struct deflate_index *index, | |||
450 | 454 | ||
451 | // Continue until we have the requested data, the deflate data has | 455 | // Continue until we have the requested data, the deflate data has |
452 | // ended, or an error is encountered. | 456 | // ended, or an error is encountered. |
453 | } while (ret == Z_OK && left); | 457 | } while (ret == Z_OK); |
454 | inflateEnd(&strm); | 458 | inflateEnd(&strm); |
455 | 459 | ||
456 | // Return the number of uncompressed bytes read into buf, or the error. | 460 | // Return the number of uncompressed bytes read into buf, or the error. |