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

Function mz_deflateInit2

SampleFramework11/v1.02/TinyEXR.cpp:1488–1526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1486}
1487
1488int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits,
1489 int mem_level, int strategy) {
1490 tdefl_compressor *pComp;
1491 mz_uint comp_flags =
1492 TDEFL_COMPUTE_ADLER32 |
1493 tdefl_create_comp_flags_from_zip_params(level, window_bits, strategy);
1494
1495 if (!pStream)
1496 return MZ_STREAM_ERROR;
1497 if ((method != MZ_DEFLATED) || ((mem_level < 1) || (mem_level > 9)) ||
1498 ((window_bits != MZ_DEFAULT_WINDOW_BITS) &&
1499 (-window_bits != MZ_DEFAULT_WINDOW_BITS)))
1500 return MZ_PARAM_ERROR;
1501
1502 pStream->data_type = 0;
1503 pStream->adler = MZ_ADLER32_INIT;
1504 pStream->msg = NULL;
1505 pStream->reserved = 0;
1506 pStream->total_in = 0;
1507 pStream->total_out = 0;
1508 if (!pStream->zalloc)
1509 pStream->zalloc = def_alloc_func;
1510 if (!pStream->zfree)
1511 pStream->zfree = def_free_func;
1512
1513 pComp = (tdefl_compressor *)pStream->zalloc(pStream->opaque, 1,
1514 sizeof(tdefl_compressor));
1515 if (!pComp)
1516 return MZ_MEM_ERROR;
1517
1518 pStream->state = (struct mz_internal_state *)pComp;
1519
1520 if (tdefl_init(pComp, NULL, NULL, comp_flags) != TDEFL_STATUS_OKAY) {
1521 mz_deflateEnd(pStream);
1522 return MZ_PARAM_ERROR;
1523 }
1524
1525 return MZ_OK;
1526}
1527
1528int mz_deflateReset(mz_streamp pStream) {
1529 if ((!pStream) || (!pStream->state) || (!pStream->zalloc) ||

Callers 1

mz_deflateInitFunction · 0.85

Calls 3

tdefl_initFunction · 0.85
mz_deflateEndFunction · 0.85

Tested by

no test coverage detected