| 1610 | } |
| 1611 | |
| 1612 | int 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 | |
| 1641 | int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, |
| 1642 | const unsigned char *pSource, mz_ulong source_len) { |
no test coverage detected