3 @@ -41,7 +41,7 @@ unsigned upx_adler32(const void *buf, un
9 return adler32(adler, (const Bytef *) buf, len); // zlib
11 return ucl_adler32(adler, (const ucl_bytep) buf, len);
18 -#if !defined(WITH_UCL)
19 +#if defined(WITH_UCL)
22 #if 0 && !defined(WITH_LZMA)
23 @@ -640,7 +640,11 @@ struct lzma_compress_config_t
28 struct ucl_compress_config_t : public REAL_ucl_compress_config_t
30 +struct ucl_compress_config_t
33 void reset() { memset(this, 0xff, sizeof(*this)); }
35 @@ -692,7 +696,9 @@ struct lzma_compress_result_t
37 struct ucl_compress_result_t
43 void reset() { memset(this, 0, sizeof(*this)); }
47 @@ -618,7 +618,9 @@ static int do_option(int optc, const cha
49 opt->all_filters = true;
52 opt->crp.crp_ucl.m_size = 999999;
56 if (!set_method(-1, 10))
57 @@ -709,6 +711,7 @@ static int do_option(int optc, const cha
60 // compression runtime parameters
63 getoptvar(&opt->crp.crp_ucl.c_flags, 0, 3, arg);
65 @@ -730,6 +733,7 @@ static int do_option(int optc, const cha
67 getoptvar(&opt->crp.crp_ucl.m_size, 10000u, 999999u, arg);
71 getoptvar(&opt->crp.crp_lzma.pos_bits, arg);
75 @@ -57,7 +57,10 @@ ifneq ($(wildcard $(UPX_UCLDIR)/include/
76 INCLUDES += -I$(UPX_UCLDIR)/include
77 LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
84 # you should set envvar UPX_LZMADIR to point to your unpacked LZMA SDK
85 include $(top_srcdir)/src/stub/src/c/Makevars.lzma
86 ifneq ($(UPX_LZMA_VERSION),)
89 @@ -199,6 +199,7 @@ bool Packer::compress(upx_bytep i_ptr, u
94 if (M_IS_NRV2B(ph.method) || M_IS_NRV2D(ph.method) || M_IS_NRV2E(ph.method))
96 if (opt->crp.crp_ucl.c_flags != -1)
97 @@ -216,6 +217,7 @@ bool Packer::compress(upx_bytep i_ptr, u
102 if (M_IS_LZMA(ph.method))
104 oassign(cconf.conf_lzma.pos_bits, opt->crp.crp_lzma.pos_bits);
105 @@ -250,6 +252,7 @@ bool Packer::compress(upx_bytep i_ptr, u
107 throwInternalError("compression failed");
110 if (M_IS_NRV2B(ph.method) || M_IS_NRV2D(ph.method) || M_IS_NRV2E(ph.method))
112 const ucl_uint *res = ph.compress_result.result_ucl.result;
113 @@ -267,6 +270,7 @@ bool Packer::compress(upx_bytep i_ptr, u
114 assert(cconf.conf_ucl.max_match == 0 || cconf.conf_ucl.max_match >= ph.max_match_found);
119 //printf("\nPacker::compress: %d/%d: %7d -> %7d\n", ph.method, ph.level, ph.u_len, ph.c_len);
120 if (!checkCompressionRatio(ph.u_len, ph.c_len))
123 @@ -506,7 +506,9 @@ void PackExe::pack(OutputFile *fo)
125 // compress (max_match = 8192)
126 upx_compress_config_t cconf; cconf.reset();
128 cconf.conf_ucl.max_match = MAXMATCH;
130 cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
131 compressWithFilters(&ft, 32, &cconf);
135 @@ -499,7 +499,9 @@ void PackPs1::pack(OutputFile *fo)
137 // compress (max_match = 65535)
138 upx_compress_config_t cconf; cconf.reset();
140 cconf.conf_ucl.max_match = 65535;
142 cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
143 compressWithFilters(&ft, sa_cnt, &cconf);
147 @@ -506,7 +506,9 @@ void PackTos::pack(OutputFile *fo)
149 // compress (max_match = 65535)
150 upx_compress_config_t cconf; cconf.reset();
152 cconf.conf_ucl.max_match = 65535;
154 cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
155 compressWithFilters(&ft, 512, &cconf);