MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_flush

Function test_flush

freebsd/contrib/zstd/zlibWrapper/examples/example_original.c:392–425  ·  view source on GitHub ↗

=========================================================================== * Test deflate() with full flush */

(compr, comprLen)

Source from the content-addressed store, hash-verified

390 * Test deflate() with full flush
391 */
392void test_flush(compr, comprLen)
393 Byte *compr;
394 uLong *comprLen;
395{
396 z_stream c_stream; /* compression stream */
397 int err;
398 uInt len = (uInt)strlen(hello)+1;
399
400 c_stream.zalloc = zalloc;
401 c_stream.zfree = zfree;
402 c_stream.opaque = (voidpf)0;
403
404 err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
405 CHECK_ERR(err, "deflateInit");
406
407 c_stream.next_in = (z_const unsigned char *)hello;
408 c_stream.next_out = compr;
409 c_stream.avail_in = 3;
410 c_stream.avail_out = (uInt)*comprLen;
411 err = deflate(&c_stream, Z_FULL_FLUSH);
412 CHECK_ERR(err, "deflate");
413
414 compr[3]++; /* force an error in first compressed block */
415 c_stream.avail_in = len - 3;
416
417 err = deflate(&c_stream, Z_FINISH);
418 if (err != Z_STREAM_END) {
419 CHECK_ERR(err, "deflate");
420 }
421 err = deflateEnd(&c_stream);
422 CHECK_ERR(err, "deflateEnd");
423
424 *comprLen = c_stream.total_out;
425}
426
427/* ===========================================================================
428 * Test inflateSync()

Callers 1

mainFunction · 0.70

Calls 2

deflateFunction · 0.85
deflateEndFunction · 0.85

Tested by

no test coverage detected