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

Function mz_compress2

SampleFramework12/v1.00/TinyEXR.cpp:1612–1639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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