all: assorted updates and cleanups

This commit is contained in:
Markus F.X.J. Oberhumer
2023-02-05 17:20:32 +01:00
parent 163377d1a0
commit b8d9c2b755
56 changed files with 691 additions and 853 deletions
+12 -14
View File
@@ -1270,9 +1270,11 @@ void Packer::compressWithFilters(upx_bytep i_ptr,
assert(nfilters < 256);
#if 0
printf("compressWithFilters: m(%d):", nmethods);
for (int i = 0; i < nmethods; i++) printf(" %#x", methods[i]);
for (int i = 0; i < nmethods; i++)
printf(" %#x", methods[i]);
printf(" f(%d):", nfilters);
for (int i = 0; i < nfilters; i++) printf(" %#x", filters[i]);
for (int i = 0; i < nfilters; i++)
printf(" %#x", filters[i]);
printf("\n");
#endif
@@ -1294,9 +1296,7 @@ void Packer::compressWithFilters(upx_bytep i_ptr,
int nfilters_success_total = 0;
for (int mm = 0; mm < nmethods; mm++) // for all methods
{
#if 0 //{
printf("\nmethod %d (%d of %d)\n", methods[mm], 1+ mm, nmethods);
#endif //}
NO_printf("\nmethod %d (%d of %d)\n", methods[mm], 1 + mm, nmethods);
assert(isValidCompressionMethod(methods[mm]));
unsigned hdr_c_len = 0;
if (hdr_ptr != nullptr && hdr_len) {
@@ -1341,10 +1341,9 @@ void Packer::compressWithFilters(upx_bytep i_ptr,
continue;
}
// filter success
#if 0
printf("\nfilter: id 0x%02x size %6d, calls %5d/%5d/%3d/%5d/%5d, cto 0x%02x\n",
ft.id, ft.buf_len, ft.calls, ft.noncalls, ft.wrongcalls, ft.firstcall, ft.lastcall, ft.cto);
#endif
NO_printf("\nfilter: id 0x%02x size %6d, calls %5d/%5d/%3d/%5d/%5d, cto 0x%02x\n",
ft.id, ft.buf_len, ft.calls, ft.noncalls, ft.wrongcalls, ft.firstcall,
ft.lastcall, ft.cto);
if (nfilters_success_total != 0 && o_tmp == o_ptr) {
o_tmp_buf.allocForCompression(i_len);
o_tmp = o_tmp_buf;
@@ -1365,11 +1364,10 @@ void Packer::compressWithFilters(upx_bytep i_ptr,
lsize = getLoaderSize();
assert(lsize > 0);
}
#if 0 //{
printf("\n%2d %02x: %d +%4d +%3d = %d (best: %d +%4d +%3d = %d)\n", ph.method, ph.filter,
ph.c_len, lsize, hdr_c_len, ph.c_len + lsize + hdr_c_len,
best_ph.c_len, best_ph_lsize, best_hdr_c_len, best_ph.c_len + best_ph_lsize + best_hdr_c_len);
#endif //}
NO_printf("\n%2d %02x: %d +%4d +%3d = %d (best: %d +%4d +%3d = %d)\n", ph.method,
ph.filter, ph.c_len, lsize, hdr_c_len, ph.c_len + lsize + hdr_c_len,
best_ph.c_len, best_ph_lsize, best_hdr_c_len,
best_ph.c_len + best_ph_lsize + best_hdr_c_len);
bool update = false;
if (ph.c_len + lsize + hdr_c_len < best_ph.c_len + best_ph_lsize + best_hdr_c_len)
update = true;