| 7 | #define ZLIB_OBJ_CLOSED ::hx::Throw(HX_CSTRING("Compress closed")) |
| 8 | |
| 9 | hx::zip::Compress hx::zip::Compress_obj::create(int level) |
| 10 | { |
| 11 | auto handle = std::unique_ptr<z_stream>(new z_stream()); |
| 12 | auto error = deflateInit(handle.get(), level); |
| 13 | |
| 14 | if (error != Z_OK) |
| 15 | { |
| 16 | hx::Throw(HX_CSTRING("ZLib Error")); |
| 17 | } |
| 18 | |
| 19 | return new hx::zip::zlib::ZLibCompress(handle.release()); |
| 20 | } |
| 21 | |
| 22 | Array<uint8_t> hx::zip::Compress_obj::run(cpp::marshal::View<uint8_t> src, int level) |
| 23 | { |