=========================================================================== * Test inflate() with large buffers */
(compr, comprLen, uncompr, uncomprLen)
| 357 | * Test inflate() with large buffers |
| 358 | */ |
| 359 | void test_large_inflate(compr, comprLen, uncompr, uncomprLen) |
| 360 | Byte *compr, *uncompr; |
| 361 | uLong comprLen, uncomprLen; |
| 362 | { |
| 363 | int err; |
| 364 | z_stream d_stream; /* decompression stream */ |
| 365 | |
| 366 | strcpy((char*)uncompr, "garbage"); |
| 367 | |
| 368 | d_stream.zalloc = zalloc; |
| 369 | d_stream.zfree = zfree; |
| 370 | d_stream.opaque = (voidpf)0; |
| 371 | |
| 372 | d_stream.next_in = compr; |
| 373 | d_stream.avail_in = (uInt)comprLen; |
| 374 | |
| 375 | err = inflateInit(&d_stream); |
| 376 | CHECK_ERR(err, "inflateInit"); |
| 377 | |
| 378 | for (;;) { |
| 379 | d_stream.next_out = uncompr; /* discard the output */ |
| 380 | d_stream.avail_out = (uInt)uncomprLen; |
| 381 | err = inflate(&d_stream, Z_NO_FLUSH); |
| 382 | if (err == Z_STREAM_END) break; |
| 383 | CHECK_ERR(err, "large inflate"); |
| 384 | } |
| 385 | |
| 386 | err = inflateEnd(&d_stream); |
| 387 | CHECK_ERR(err, "inflateEnd"); |
| 388 | |
| 389 | if (d_stream.total_out != 2*uncomprLen + comprLen/2) { |
| 390 | fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); |
| 391 | exit(1); |
| 392 | } else { |
| 393 | printf("large_inflate(): OK\n"); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | /* =========================================================================== |
| 398 | * Test deflate() with full flush |