| 1726 | } |
| 1727 | |
| 1728 | void rem_port::initCompression() |
| 1729 | { |
| 1730 | #ifdef WIRE_COMPRESS_SUPPORT |
| 1731 | if (port_protocol >= PROTOCOL_VERSION13 && !port_compressed && zlib()) |
| 1732 | { |
| 1733 | port_send_stream.zalloc = ZLib::allocFunc; |
| 1734 | port_send_stream.zfree = ZLib::freeFunc; |
| 1735 | port_send_stream.opaque = Z_NULL; |
| 1736 | int ret = zlib().deflateInit(&port_send_stream, Z_DEFAULT_COMPRESSION); |
| 1737 | if (ret != Z_OK) |
| 1738 | (Arg::Gds(isc_deflate_init) << Arg::Num(ret)).raise(); |
| 1739 | port_send_stream.next_out = NULL; |
| 1740 | |
| 1741 | port_recv_stream.zalloc = ZLib::allocFunc; |
| 1742 | port_recv_stream.zfree = ZLib::freeFunc; |
| 1743 | port_recv_stream.opaque = Z_NULL; |
| 1744 | port_recv_stream.avail_in = 0; |
| 1745 | port_recv_stream.next_in = Z_NULL; |
| 1746 | ret = zlib().inflateInit(&port_recv_stream); |
| 1747 | if (ret != Z_OK) |
| 1748 | { |
| 1749 | zlib().deflateEnd(&port_send_stream); |
| 1750 | (Arg::Gds(isc_inflate_init) << Arg::Num(ret)).raise(); |
| 1751 | } |
| 1752 | |
| 1753 | try |
| 1754 | { |
| 1755 | port_compressed.reset(FB_NEW_POOL(getPool()) UCHAR[port_buff_size * 2]); |
| 1756 | } |
| 1757 | catch (const Exception&) |
| 1758 | { |
| 1759 | zlib().deflateEnd(&port_send_stream); |
| 1760 | zlib().inflateEnd(&port_recv_stream); |
| 1761 | throw; |
| 1762 | } |
| 1763 | |
| 1764 | memset(port_compressed, 0, port_buff_size * 2); |
| 1765 | port_recv_stream.next_in = &port_compressed[REM_RECV_OFFSET(port_buff_size)]; |
| 1766 | |
| 1767 | #ifdef COMPRESS_DEBUG |
| 1768 | fprintf(stderr, "Completed init port %p\n", this); |
| 1769 | #endif |
| 1770 | } |
| 1771 | #endif |
| 1772 | } |
| 1773 | |
| 1774 | |
| 1775 | void InternalCryptKey::setSymmetric(CheckStatusWrapper* status, const char* type, |
no test coverage detected