Add option --prefer-ucl.
This commit is contained in:
+3
-3
@@ -109,7 +109,7 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
cb, method, level, cconf, cresult);
|
cb, method, level, cconf, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
r = upx_nrv_compress(src, src_len, dst, dst_len,
|
r = upx_nrv_compress(src, src_len, dst, dst_len,
|
||||||
cb, method, level, cconf, cresult);
|
cb, method, level, cconf, cresult);
|
||||||
#endif
|
#endif
|
||||||
@@ -154,7 +154,7 @@ int upx_decompress ( const upx_bytep src, unsigned src_len,
|
|||||||
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
|
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
|
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_UCL)
|
#if (WITH_UCL)
|
||||||
@@ -201,7 +201,7 @@ int upx_test_overlap ( const upx_bytep buf,
|
|||||||
r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_UCL)
|
#if (WITH_UCL)
|
||||||
|
|||||||
+12
-7
@@ -332,14 +332,9 @@ static bool set_method(int m, int l)
|
|||||||
{
|
{
|
||||||
if (!Packer::isValidCompressionMethod(m))
|
if (!Packer::isValidCompressionMethod(m))
|
||||||
return false;
|
return false;
|
||||||
#if 1
|
|
||||||
// something like "--brute --lzma" should not disable "--brute"
|
// something like "--brute --lzma" should not disable "--brute"
|
||||||
if (!opt->all_methods)
|
if (!opt->all_methods)
|
||||||
#endif
|
|
||||||
{
|
|
||||||
opt->method = m;
|
opt->method = m;
|
||||||
opt->all_methods = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (l > 0)
|
if (l > 0)
|
||||||
opt->level = l;
|
opt->level = l;
|
||||||
@@ -587,6 +582,12 @@ static int do_option(int optc, const char *arg)
|
|||||||
if (M_IS_LZMA(opt->method))
|
if (M_IS_LZMA(opt->method))
|
||||||
opt->method = -1;
|
opt->method = -1;
|
||||||
break;
|
break;
|
||||||
|
case 723:
|
||||||
|
opt->prefer_ucl = false;
|
||||||
|
break;
|
||||||
|
case 724:
|
||||||
|
opt->prefer_ucl = true;
|
||||||
|
break;
|
||||||
|
|
||||||
// compression level
|
// compression level
|
||||||
case '1':
|
case '1':
|
||||||
@@ -983,7 +984,9 @@ static const struct mfx_option longopts[] =
|
|||||||
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
||||||
{"nrv2e", 0x10, 0, 705}, // --nrv2e
|
{"nrv2e", 0x10, 0, 705}, // --nrv2e
|
||||||
{"lzma", 0x10, 0, 721}, // --lzma
|
{"lzma", 0x10, 0, 721}, // --lzma
|
||||||
{"no-lzma", 0x10, 0, 722}, // (disable all_methods_use_lzma)
|
{"no-lzma", 0x10, 0, 722}, // disable all_methods_use_lzma
|
||||||
|
{"prefer-nrv", 0x10, 0, 723},
|
||||||
|
{"prefer-ucl", 0x10, 0, 724},
|
||||||
// compression settings
|
// compression settings
|
||||||
{"all-filters", 0x10, 0, 523},
|
{"all-filters", 0x10, 0, 523},
|
||||||
{"all-methods", 0x10, 0, 524},
|
{"all-methods", 0x10, 0, 524},
|
||||||
@@ -1142,7 +1145,9 @@ static const struct mfx_option longopts[] =
|
|||||||
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
||||||
{"nrv2e", 0x10, 0, 705}, // --nrv2e
|
{"nrv2e", 0x10, 0, 705}, // --nrv2e
|
||||||
{"lzma", 0x10, 0, 721}, // --lzma
|
{"lzma", 0x10, 0, 721}, // --lzma
|
||||||
{"no-lzma", 0x10, 0, 722}, // (disable all_methods_use_lzma)
|
{"no-lzma", 0x10, 0, 722}, // disable all_methods_use_lzma
|
||||||
|
{"prefer-nrv", 0x10, 0, 723},
|
||||||
|
{"prefer-ucl", 0x10, 0, 724},
|
||||||
// compression settings
|
// compression settings
|
||||||
// compression runtime parameters
|
// compression runtime parameters
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ struct options_t {
|
|||||||
bool all_methods_use_lzma;
|
bool all_methods_use_lzma;
|
||||||
bool all_filters; // try all available filters ?
|
bool all_filters; // try all available filters ?
|
||||||
bool no_filter; // force no filter
|
bool no_filter; // force no filter
|
||||||
|
bool prefer_ucl; // prefer UCL
|
||||||
bool exact; // user requires byte-identical decompression
|
bool exact; // user requires byte-identical decompression
|
||||||
|
|
||||||
// other options
|
// other options
|
||||||
|
|||||||
Reference in New Issue
Block a user