Skip to content

deps: update zlib to 1.3.0.1-motley-71660e1 #53464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions deps/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ check_include_file(stddef.h HAVE_STDDEF_H)
option(ENABLE_SIMD_OPTIMIZATIONS "Enable all SIMD optimizations" OFF)
option(ENABLE_SIMD_AVX512 "Enable SIMD AXV512 optimizations" OFF)
option(USE_ZLIB_RABIN_KARP_HASH "Enable bitstream compatibility with canonical zlib" OFF)
option(ENABLE_INTEL_QAT_COMPRESSION "Enable Intel Quick Assist Technology use for compression" OFF)
option(BUILD_UNITTESTS "Enable standalone unit tests build" OFF)
option(BUILD_MINIZIP_BIN "Enable building minzip_bin tool" OFF)
option(BUILD_ZPIPE "Enable building zpipe tool" OFF)
Expand Down Expand Up @@ -228,6 +229,22 @@ if (ENABLE_SIMD_OPTIMIZATIONS)
endif()
endif()

if (ENABLE_INTEL_QAT_COMPRESSION)
list(APPEND ZLIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/deflate_qat.cpp)
list(APPEND ZLIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/qatzpp/io_buffers.cpp)
list(APPEND ZLIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/qatzpp/memory.cpp)
list(APPEND ZLIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/qatzpp/qat_buffer_list.cpp)
list(APPEND ZLIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/qatzpp/qat.cpp)
list(APPEND ZLIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/qatzpp/qat_instance.cpp)
list(APPEND ZLIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/qatzpp/session.cpp)
list(APPEND ZLIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/qatzpp/qat_task.cpp)

# TODO(gustavoa): Find a way to include the qatzpp headers without having the
# presubmit check throw errors.
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/contrib/qat/qatzpp)
add_compile_definitions(QAT_COMPRESSION_ENABLED)
endif()

# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
Expand All @@ -254,6 +271,15 @@ add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HD
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)

if (ENABLE_INTEL_QAT_COMPRESSION)
target_include_directories(zlib PUBLIC ${QATZPP_INCLUDE_DIRS})
target_link_libraries(zlib ${QATZPP_LIBRARY})
target_link_libraries(zlib qat)
target_include_directories(zlibstatic PUBLIC ${QATZPP_INCLUDE_DIRS})
target_link_libraries(zlibstatic ${QATZPP_LIBRARY})
target_link_libraries(zlibstatic qat)
endif()

if(NOT CYGWIN)
# This property causes shared libraries on Linux to have the full version
# encoded into their final filename. We disable this on Cygwin because
Expand Down
20 changes: 6 additions & 14 deletions deps/zlib/contrib/bench/zlib_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ Data read_file_data_or_exit(const char* name) {
return data;
}

size_t zlib_estimate_compressed_size(size_t input_size) {
return compressBound(input_size);
}

enum zlib_wrapper {
kWrapperNONE,
kWrapperZLIB,
Expand Down Expand Up @@ -128,10 +124,6 @@ void zlib_compress(
std::string* output,
bool resize_output = false)
{
if (resize_output)
output->resize(zlib_estimate_compressed_size(input_size));
size_t output_size = output->size();

z_stream stream;
memset(&stream, 0, sizeof(stream));

Expand All @@ -140,6 +132,11 @@ void zlib_compress(
if (result != Z_OK)
error_exit("deflateInit2 failed", result);

if (resize_output) {
output->resize(deflateBound(&stream, input_size));
}
size_t output_size = output->size();

stream.next_out = (Bytef*)string_data(output);
stream.avail_out = (uInt)output_size;
stream.next_in = (z_const Bytef*)input;
Expand Down Expand Up @@ -299,19 +296,14 @@ void zlib_file(const char* name,

// Pre-grow the output buffer so we don't measure string resize time.
for (int b = 0; b < blocks; ++b)
compressed[b].resize(zlib_estimate_compressed_size(block_size));
zlib_compress(type, input[b], input_length[b], &compressed[b], true);

auto start = now();
for (int b = 0; b < blocks; ++b)
for (int r = 0; r < repeats; ++r)
zlib_compress(type, input[b], input_length[b], &compressed[b]);
ctime[run] = std::chrono::duration<double>(now() - start).count();

// Compress again, resizing compressed, so we don't leave junk at the
// end of the compressed string that could confuse zlib_uncompress().
for (int b = 0; b < blocks; ++b)
zlib_compress(type, input[b], input_length[b], &compressed[b], true);

for (int b = 0; b < blocks; ++b)
output[b].resize(input_length[b]);

Expand Down
3 changes: 2 additions & 1 deletion deps/zlib/contrib/minizip/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ Name: ZIP file API for reading file entries in a ZIP archive
Short Name: minizip
URL: https://github.com/madler/zlib/tree/master/contrib/minizip
Version: 1.3.0.1
Revision: 643e17b7498d12ab8d15565662880579692f769d
License: Zlib
License File: //third_party/zlib/LICENSE
Security Critical: yes
Shipped: yes
Security Critical: yes
CPEPrefix: cpe:/a:minizip_project:minizip

Description:
Expand Down
Loading
Loading