Skip to content

Commit

Permalink
Add support for Zstd archive format
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Feb 6, 2025
1 parent ee98288 commit d634ede
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/bit7z/bitformat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ extern const BitInFormat Nsis; ///< NSIS Archive Format
extern const BitInFormat Lzma; ///< LZMA Archive Format
extern const BitInFormat Lzma86; ///< LZMA86 Archive Format
extern const BitInFormat Ppmd; ///< PPMD Archive Format
extern const BitInFormat Zstd; ///< ZSTD Archive Format
extern const BitInFormat Vhdx; ///< VHDX Archive Format
extern const BitInFormat COFF; ///< COFF Archive Format
extern const BitInFormat Ext; ///< EXT Archive Format
Expand Down
1 change: 1 addition & 0 deletions src/bitformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace BitFormat {
BitCompressionMethod::Lzma2,
FormatFeatures::CompressionLevel );
const BitInFormat Ppmd( 0x0D );
const BitInFormat Zstd( 0x0E );
const BitInFormat Vhdx( 0xC4 );
const BitInFormat COFF( 0xC6 );
const BitInFormat Ext( 0xC7 );
Expand Down
5 changes: 5 additions & 0 deletions src/internal/formatdetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ auto find_format_by_extension( const tstring& extension ) -> const BitInFormat*
case str_hash( BIT7Z_STRING( "z" ) ):
case str_hash( BIT7Z_STRING( "taz" ) ):
return &BitFormat::Z;
case str_hash( BIT7Z_STRING( "zst" ) ):
return &BitFormat::Zstd;
default:
return nullptr;
}
Expand Down Expand Up @@ -239,6 +241,7 @@ auto find_format_by_signature( uint64_t signature ) noexcept -> const BitInForma
constexpr auto kXarSignature = 0x78617221001C0000ULL; // xar! 0x00 0x1C
constexpr auto kZSignature1 = 0x1F9D000000000000ULL; // 0x1F 0x9D
constexpr auto kZSignature2 = 0x1FA0000000000000ULL; // 0x1F 0xA0
constexpr auto kZstdSignature = 0x28B52FFD00000000ULL;

switch ( signature ) {
case kRarSignature:
Expand Down Expand Up @@ -326,6 +329,8 @@ auto find_format_by_signature( uint64_t signature ) noexcept -> const BitInForma
case kZSignature1: // 1F 9D
case kZSignature2: // 1F A0
return &BitFormat::Z;
case kZstdSignature:
return &BitFormat::Zstd;
default:
return nullptr;
}
Expand Down

0 comments on commit d634ede

Please sign in to comment.