MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / mz_compress2

Function mz_compress2

SampleFramework11/v1.02/TinyEXR.cpp:1611–1638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1609}
1610
1611int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len,
1612 const unsigned char *pSource, mz_ulong source_len, int level) {
1613 int status;
1614 mz_stream stream;
1615 memset(&stream, 0, sizeof(stream));
1616
1617 // In case mz_ulong is 64-bits (argh I hate longs).
1618 if ((source_len | *pDest_len) > 0xFFFFFFFFU)
1619 return MZ_PARAM_ERROR;
1620
1621 stream.next_in = pSource;
1622 stream.avail_in = (mz_uint32)source_len;
1623 stream.next_out = pDest;
1624 stream.avail_out = (mz_uint32)*pDest_len;
1625
1626 status = mz_deflateInit(&stream, level);
1627 if (status != MZ_OK)
1628 return status;
1629
1630 status = mz_deflate(&stream, MZ_FINISH);
1631 if (status != MZ_STREAM_END) {
1632 mz_deflateEnd(&stream);
1633 return (status == MZ_OK) ? MZ_BUF_ERROR : status;
1634 }
1635
1636 *pDest_len = stream.total_out;
1637 return mz_deflateEnd(&stream);
1638}
1639
1640int mz_compress(unsigned char *pDest, mz_ulong *pDest_len,
1641 const unsigned char *pSource, mz_ulong source_len) {

Callers 1

mz_compressFunction · 0.85

Calls 3

mz_deflateInitFunction · 0.85
mz_deflateFunction · 0.85
mz_deflateEndFunction · 0.85

Tested by

no test coverage detected