Skip to content

Commit ee26150

Browse files
authored
Merge pull request #83182 from akrieger/no_zeds_in_zzip
Remove zombie code from zzip from last refactor
2 parents 87b1f32 + 0325d12 commit ee26150

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

src/zzip.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff 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 {

tools/save/zzip_main.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)