diff --git a/src/openrct2/util/Util.cpp b/src/openrct2/util/Util.cpp index b0cf8c9ce3..dd83aa50ba 100644 --- a/src/openrct2/util/Util.cpp +++ b/src/openrct2/util/Util.cpp @@ -547,37 +547,6 @@ uint32_t util_rand() constexpr size_t CHUNK = 128 * 1024; constexpr int32_t MAX_ZLIB_REALLOC = 4 * 1024 * 1024; -/** - * @brief Deflates input using zlib - * @param data Data to be compressed - * @param data_in_size Size of data to be compressed - * @return Returns an optional std::vector of bytes, which is equal to std::nullopt when deflate has failed - */ -std::optional> util_zlib_deflate(const uint8_t* data, size_t data_in_size) -{ - int32_t ret = Z_OK; - uLongf out_size = 0; - uLong buffer_size = compressBound(static_cast(data_in_size)); - std::vector buffer(buffer_size); - do - { - if (ret == Z_BUF_ERROR) - { - buffer_size *= 2; - out_size = buffer_size; - buffer.resize(buffer_size); - } - else if (ret == Z_STREAM_ERROR) - { - log_error("Your build is shipped with broken zlib. Please use the official build."); - return std::nullopt; - } - ret = compress(buffer.data(), &out_size, data, static_cast(data_in_size)); - } while (ret != Z_OK); - buffer.resize(out_size); - return buffer; -} - // Compress the source to gzip-compatible stream, write to dest. // Mainly used for compressing the crashdumps bool util_gzip_compress(FILE* source, FILE* dest) diff --git a/src/openrct2/util/Util.h b/src/openrct2/util/Util.h index bfa2c74d98..6fa3914a0a 100644 --- a/src/openrct2/util/Util.h +++ b/src/openrct2/util/Util.h @@ -53,7 +53,6 @@ bool str_is_null_or_empty(const char* str); uint32_t util_rand(); -std::optional> util_zlib_deflate(const uint8_t* data, size_t data_in_size); bool util_gzip_compress(FILE* source, FILE* dest); std::vector Gzip(const void* data, const size_t dataLen); std::vector Ungzip(const void* data, const size_t dataLen);