Skip to content

Commit

Permalink
Merge remote-tracking branch 'cesium/main' into spdlog-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
josephbirkner committed Feb 23, 2024
2 parents ed6226b + 916c63e commit 504c28c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 62 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
[submodule "extern/libjpeg-turbo"]
path = extern/libjpeg-turbo
url = https://github.com/CesiumGS/libjpeg-turbo.git
[submodule "extern/zlib"]
path = extern/zlib
url = https://github.com/madler/zlib.git
[submodule "extern/meshoptimizer"]
path = extern/meshoptimizer
url = https://github.com/zeux/meshoptimizer
[submodule "extern/zlib-ng"]
path = extern/zlib-ng
url = https://github.com/zlib-ng/zlib-ng.git
1 change: 0 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

- Added `contains` method to `BoundingSphere`.
- Added `GlobeRectangle::MAXIMUM` static field.
- Switched from `zlib` to `zlib-ng` in order to improve the performance of decompressing gzipped data.

##### Fixes :wrench:

Expand Down
12 changes: 6 additions & 6 deletions CesiumUtility/src/Gunzip.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "CesiumUtility/Gunzip.h"
#define ZLIB_CONST
#include "zlib-ng.h"
#include "zlib.h"

#define CHUNK 65536

Expand All @@ -16,13 +16,13 @@ bool CesiumUtility::gunzip(
std::vector<std::byte>& out) {
int ret;
unsigned int index = 0;
zng_stream strm;
z_stream strm;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;
ret = zng_inflateInit2(&strm, 16 + MAX_WBITS);
ret = inflateInit2(&strm, 16 + MAX_WBITS);
if (ret != Z_OK) {
return false;
}
Expand All @@ -34,18 +34,18 @@ bool CesiumUtility::gunzip(
out.resize(index + CHUNK);
strm.next_out = reinterpret_cast<Bytef*>(&out[index]);
strm.avail_out = CHUNK;
ret = zng_inflate(&strm, Z_NO_FLUSH);
ret = inflate(&strm, Z_NO_FLUSH);
switch (ret) {
case Z_NEED_DICT:
case Z_DATA_ERROR:
case Z_MEM_ERROR:
zng_inflateEnd(&strm);
inflateEnd(&strm);
return false;
}
index += CHUNK - strm.avail_out;
} while (ret != Z_STREAM_END);

zng_inflateEnd(&strm);
inflateEnd(&strm);
out.resize(index);
return true;
}
48 changes: 0 additions & 48 deletions CesiumUtility/test/TestGunzip.cpp

This file was deleted.

5 changes: 2 additions & 3 deletions extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,8 @@ add_subdirectory(libmorton)

# The zlib cmake build makes its working directory dirty.
# So we make a copy of it to avoid that annoyance.
set(WITH_GTEST OFF CACHE INTERNAL "Disable zlib-ng testing")
file(COPY "${CMAKE_CURRENT_LIST_DIR}/zlib-ng/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/zlib-ng-src")
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/zlib-ng-src ${CMAKE_CURRENT_BINARY_DIR}/zlib-ng)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/zlib/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/zlib-src")
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/zlib-src ${CMAKE_CURRENT_BINARY_DIR}/zlib)

if(DEFINED CMAKE_TOOLCHAIN_FILE)
if(NOT IS_ABSOLUTE ${CMAKE_TOOLCHAIN_FILE})
Expand Down
1 change: 1 addition & 0 deletions extern/zlib
Submodule zlib added at 04f42c
1 change: 0 additions & 1 deletion extern/zlib-ng
Submodule zlib-ng deleted from 742537

0 comments on commit 504c28c

Please sign in to comment.