mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Move conditional side effect (reset .all_methods_use_lzma)
out of ::PackExe constructor, so that Visitor pattern avoids it.
This commit is contained in:
parent
dacd11e1cc
commit
da6a9bf3eb
|
@ -56,16 +56,16 @@ PackExe::PackExe(InputFile *f) :
|
|||
ih_exesize = ih_imagesize = ih_overlay = 0;
|
||||
stack_for_lzma = 0;
|
||||
use_clear_dirty_stack = false;
|
||||
|
||||
// disable lzma for "--brute" unless explicitly given "--lzma"
|
||||
if (opt->all_methods_use_lzma && !opt->method_lzma_seen)
|
||||
opt->all_methods_use_lzma = false;
|
||||
}
|
||||
|
||||
|
||||
const int *PackExe::getCompressionMethods(int method, int level) const
|
||||
{
|
||||
bool small = ih_imagesize <= 256*1024;
|
||||
// disable lzma for "--brute" unless explicitly given "--lzma"
|
||||
// WARNING: this side effect persists for later files!
|
||||
if (opt->all_methods_use_lzma && !opt->method_lzma_seen)
|
||||
opt->all_methods_use_lzma = false;
|
||||
return Packer::getDefaultCompressionMethods_8(method, level, small);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user