From a5be5134c8d5205cefa30ca208ac4a288d378cc1 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Sat, 8 Jul 2023 16:29:54 -0400 Subject: [PATCH] clean: remove zstd related code which is unused since the migration to libzim --- CMake_Unix.cmake | 1 - goldendict.pro | 2 +- src/decompress.cc | 43 ------------------------- src/decompress.hh | 2 -- website/docs/howto/build_from_source.md | 2 +- 5 files changed, 2 insertions(+), 48 deletions(-) diff --git a/CMake_Unix.cmake b/CMake_Unix.cmake index 358b710a..431a3826 100644 --- a/CMake_Unix.cmake +++ b/CMake_Unix.cmake @@ -40,7 +40,6 @@ pkg_check_modules(PKGCONFIG_DEPS IMPORTED_TARGET vorbis # .ogg vorbisfile liblzma - libzstd ) target_link_libraries(${GOLDENDICT} PRIVATE diff --git a/goldendict.pro b/goldendict.pro index c17d664a..7600ed97 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -552,7 +552,7 @@ SOURCES += src/common/wildcard.cc CONFIG( zim_support ) { DEFINES += MAKE_ZIM_SUPPORT - LIBS += -llzma -lzstd -lzim + LIBS += -llzma -lzim win32{ Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ diff --git a/src/decompress.cc b/src/decompress.cc index 9e348317..4a7b7b07 100644 --- a/src/decompress.cc +++ b/src/decompress.cc @@ -4,7 +4,6 @@ #ifdef MAKE_ZIM_SUPPORT #include "lzma.h" -#include "zstd.h" #endif #define CHUNK_SIZE 2048 @@ -132,46 +131,4 @@ char buf[CHUNK_SIZE]; return str; } -string decompressZstd( const char *bufptr, unsigned length ) -{ - string str; - char buf[CHUNK_SIZE]; - size_t res; -// string err; - ZSTD_DStream *zds; - ZSTD_inBuffer in_buf = { bufptr, length, 0 }; - ZSTD_outBuffer out_buf = { buf, CHUNK_SIZE, 0 }; - - zds = ZSTD_createDStream(); - if( !zds ) - return str; - - res = ZSTD_initDStream( zds ); - if( ZSTD_isError( res ) ) - { -// err = string( ZSTD_getErrorName( res ) ); - ZSTD_freeDStream( zds ); - return str; - } - - do - { - out_buf.pos = 0; - res = ZSTD_decompressStream( zds, &out_buf, &in_buf ); - if( ZSTD_isError( res ) ) - { -// err = string( ZSTD_getErrorName( res ) ); - ZSTD_freeDStream( zds ); - return string(); - } - - str.append( buf, out_buf.pos ); - } - while( out_buf.pos >= out_buf.size ); - - ZSTD_freeDStream( zds ); - - return str; -} - #endif diff --git a/src/decompress.hh b/src/decompress.hh index c57593ff..c5b6254b 100644 --- a/src/decompress.hh +++ b/src/decompress.hh @@ -17,8 +17,6 @@ string decompressBzip2( const char * bufptr, unsigned length ); string decompressLzma2( const char * bufptr, unsigned length, bool raw_decoder = false ); -string decompressZstd( const char * bufptr, unsigned length ); - #endif #endif // DECOMPRESS_HH diff --git a/website/docs/howto/build_from_source.md b/website/docs/howto/build_from_source.md index da87e7ea..a9b09414 100644 --- a/website/docs/howto/build_from_source.md +++ b/website/docs/howto/build_from_source.md @@ -29,11 +29,11 @@ In other words, those libraries * x11 (linux only) And a few compression libraries: + * xz (lzma) * bzip2 * lzo2 * zlib -* zstd ## CMake Build