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)
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)); }
37 struct ucl_compress_result_t
43 void reset() { memset(this, 0, sizeof(*this)); }
49 opt->all_filters = true;
52 opt->crp.crp_ucl.m_size = 999999;
56 if (!set_method(-1, 10))
60 // compression runtime parameters
63 getoptvar(&opt->crp.crp_ucl.c_flags, 0, 3, arg);
67 getoptvar(&opt->crp.crp_ucl.m_size, 10000u, 999999u, arg);
71 getoptvar(&opt->crp.crp_lzma.pos_bits, arg);
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),)
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)
102 if (M_IS_LZMA(ph.method))
104 oassign(cconf.conf_lzma.pos_bits, opt->crp.crp_lzma.pos_bits);
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;
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))
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);
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);
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);