File tree Expand file tree Collapse file tree 2 files changed +3
-21
lines changed Expand file tree Collapse file tree 2 files changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -395,11 +395,8 @@ std::optional<zzip> zzip::load(
395395
396396 ZSTD_CCtx *cctx;
397397 ZSTD_DCtx *dctx;
398- if ( dictionary_path.empty () ) {
399- cctx = ZSTD_createCCtx ();
400- dctx = ZSTD_createDCtx ();
401- } else if ( auto it = cached_contexts.find ( dictionary_path.generic_u8string () );
402- it != cached_contexts.end () ) {
398+ if ( auto it = cached_contexts.find ( dictionary_path.generic_u8string () );
399+ it != cached_contexts.end () ) {
403400 cctx = it->second .cctx ;
404401 dctx = it->second .dctx ;
405402 } else {
Original file line number Diff line number Diff line change @@ -220,22 +220,8 @@ struct ZzipStream {
220220
221221#define RETURN_ERROR (e ) err = e; return entry
222222
223- // Skip the zzip header.
224- if ( !ZSTD_isSkippableFrame ( base, remaining_len ) ) {
225- RETURN_ERROR ( ZzipError ( zzip_path, 0 , " Zzip does not start with skippable frame." ) );
226- }
227-
228- // The first frame of a zzip should be a skippable frame of two 64 bit ints
229223 ZSTD_FrameHeader header;
230- size_t error_code = ZSTD_getFrameHeader ( &header, base, remaining_len );
231- if ( ZSTD_isError ( error_code ) ||
232- header.dictID != kFooterChecksumMagic ||
233- header.frameContentSize != 2 * sizeof ( uint64_t ) ) {
234- RETURN_ERROR ( ZzipError ( zzip_path, 0 , " Error reading zzip header." ) );
235- }
236-
237- base += ZSTD_SKIPPABLEHEADERSIZE + 2 * sizeof ( uint64_t );
238- remaining_len -= ZSTD_SKIPPABLEHEADERSIZE + 2 * sizeof ( uint64_t );
224+ size_t error_code = 0 ;
239225
240226 std::string filename;
241227 uint64_t checksum = 0 ;
@@ -402,7 +388,6 @@ static int decompress_to( std::filesystem::path const &zzip_path,
402388 } catch ( std::exception &e ) {
403389 throw FsError ( output_file, {}, std::string{ " Error writing output: " } + e.what () );
404390 }
405- return {};
406391 }
407392 if ( !zs.good () ) {
408393 zs.e ().throw_exception ();
You can’t perform that action at this time.
0 commit comments