Skip to content

Commit

Permalink
Added hc level options for AES front end
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chapman <[email protected]>
  • Loading branch information
richardkchapman committed Nov 8, 2023
1 parent 8f3e079 commit 9bd7efd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions system/jlib/jlzw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2875,7 +2875,7 @@ ICompressHandlerIterator *getCompressHandlerIterator()

bool addCompressorHandler(ICompressHandler *handler)
{
if (compressors.lookup(handler->queryMethod()))
if (compressors.lookup(handler->queryType()))
{
handler->Release();
return false; // already registered
Expand Down Expand Up @@ -2956,13 +2956,20 @@ MODULE_INIT(INIT_PRIORITY_STANDARD)
};
class CAESLZ4HCCompressHandler : public CCompressHandlerBase
{
StringBuffer typestring;
StringBuffer levelstring;
public:
virtual const char *queryType() const { return "AESLZ4HC"; }
CAESLZ4HCCompressHandler(unsigned level)
{
typestring.appendf("AESLZ4HC_%u", level);
levelstring.appendf("hclevel=%u", level);
}
virtual const char *queryType() const { return typestring.str(); }
virtual CompressionMethod queryMethod() const { return (CompressionMethod) (COMPRESS_METHOD_AES|COMPRESS_METHOD_LZ4HC); }
virtual ICompressor *getCompressor(const char *options)
{
assertex(options);
return new CAESCompressor(options, strlen(options),createLZ4Compressor(nullptr, true));
return new CAESCompressor(options, strlen(options),createLZ4Compressor(levelstring, true));
}
virtual IExpander *getExpander(const char *options)
{
Expand Down Expand Up @@ -3005,7 +3012,8 @@ MODULE_INIT(INIT_PRIORITY_STANDARD)
addCompressorHandler(new CLZWCompressHandler());
addCompressorHandler(new CAESCompressHandler());
addCompressorHandler(new CAESLZ4CompressHandler());
addCompressorHandler(new CAESLZ4HCCompressHandler());
addCompressorHandler(new CAESLZ4HCCompressHandler(3));
addCompressorHandler(new CAESLZ4HCCompressHandler(9));
addCompressorHandler(new CDiffCompressHandler());
addCompressorHandler(new CRDiffCompressHandler());
addCompressorHandler(new CRandRDiffCompressHandler());
Expand Down

0 comments on commit 9bd7efd

Please sign in to comment.