Renamed pass and total_passes to ui_pass and ui_total_passes in class Packer.
committer: mfx <mfx> 975421199 +0000
This commit is contained in:
+14
-14
@@ -283,28 +283,28 @@ void PackLinuxI386elf::pack(OutputFile *fo)
|
|||||||
Extent x;
|
Extent x;
|
||||||
unsigned k;
|
unsigned k;
|
||||||
|
|
||||||
// count
|
// count passes, set ptload vars
|
||||||
total_passes = 0;
|
ui_total_passes = 0;
|
||||||
off_t ptload0hi=0, ptload1lo=0;
|
off_t ptload0hi = 0, ptload1lo = 0;
|
||||||
int nx = 0;
|
int nx = 0;
|
||||||
for (k = 0; k < ehdri.e_phnum; ++k) {
|
for (k = 0; k < ehdri.e_phnum; ++k) {
|
||||||
if (PT_LOAD==phdri[k].p_type) {
|
if (PT_LOAD == phdri[k].p_type) {
|
||||||
x.offset = phdri[k].p_offset;
|
x.offset = phdri[k].p_offset;
|
||||||
x.size = phdri[k].p_filesz;
|
x.size = phdri[k].p_filesz;
|
||||||
if (0==ptload0hi) {
|
if (0 == ptload0hi) {
|
||||||
ptload0hi = x.size + x.offset;
|
ptload0hi = x.offset + x.size;
|
||||||
}
|
}
|
||||||
else if (0==ptload1lo) {
|
else if (0 == ptload1lo) {
|
||||||
ptload1lo = x.offset;
|
ptload1lo = x.offset;
|
||||||
}
|
}
|
||||||
total_passes++;
|
ui_total_passes++;
|
||||||
} else {
|
} else {
|
||||||
if (nx++ == 0)
|
if (nx++ == 0)
|
||||||
total_passes++;
|
ui_total_passes++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ptload0hi < ptload1lo)
|
if (ptload0hi < ptload1lo)
|
||||||
total_passes++;
|
ui_total_passes++;
|
||||||
|
|
||||||
// compress extents
|
// compress extents
|
||||||
unsigned total_in = 0;
|
unsigned total_in = 0;
|
||||||
@@ -312,15 +312,15 @@ void PackLinuxI386elf::pack(OutputFile *fo)
|
|||||||
|
|
||||||
x.offset = 0;
|
x.offset = 0;
|
||||||
x.size = sizeof(Elf_LE32_Ehdr) + sz_phdrs;
|
x.size = sizeof(Elf_LE32_Ehdr) + sz_phdrs;
|
||||||
pass = -1;
|
ui_pass = -1;
|
||||||
packExtent(x, fo, total_in, total_out);
|
packExtent(x, fo, total_in, total_out);
|
||||||
pass = 0;
|
ui_pass = 0;
|
||||||
|
|
||||||
nx = 0;
|
nx = 0;
|
||||||
for (k = 0; k < ehdri.e_phnum; ++k) if (PT_LOAD==phdri[k].p_type) {
|
for (k = 0; k < ehdri.e_phnum; ++k) if (PT_LOAD==phdri[k].p_type) {
|
||||||
x.offset = phdri[k].p_offset;
|
x.offset = phdri[k].p_offset;
|
||||||
x.size = phdri[k].p_filesz;
|
x.size = phdri[k].p_filesz;
|
||||||
if (0==nx) {
|
if (0 == nx) {
|
||||||
x.offset += sizeof(Elf_LE32_Ehdr) + sz_phdrs;
|
x.offset += sizeof(Elf_LE32_Ehdr) + sz_phdrs;
|
||||||
x.size -= sizeof(Elf_LE32_Ehdr) + sz_phdrs;
|
x.size -= sizeof(Elf_LE32_Ehdr) + sz_phdrs;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -126,9 +126,9 @@ void PackUnix::pack(OutputFile *fo)
|
|||||||
// compress blocks
|
// compress blocks
|
||||||
unsigned total_in = 0;
|
unsigned total_in = 0;
|
||||||
unsigned total_out = 0;
|
unsigned total_out = 0;
|
||||||
this->total_passes = (file_size + blocksize - 1) / blocksize;
|
ui_total_passes = (file_size + blocksize - 1) / blocksize;
|
||||||
if (this->total_passes == 1)
|
if (ui_total_passes == 1)
|
||||||
this->total_passes = 0;
|
ui_total_passes = 0;
|
||||||
fi->seek(0, SEEK_SET);
|
fi->seek(0, SEEK_SET);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-13
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
Packer::Packer(InputFile *f) :
|
Packer::Packer(InputFile *f) :
|
||||||
fi(f), file_size(-1), ph_format(-1), ph_version(-1),
|
fi(f), file_size(-1), ph_format(-1), ph_version(-1),
|
||||||
uip(NULL), pass(0), total_passes(0), linker(NULL),
|
uip(NULL), ui_pass(0), ui_total_passes(0), linker(NULL),
|
||||||
last_patch(NULL), last_patch_offset(0)
|
last_patch(NULL), last_patch_offset(0)
|
||||||
{
|
{
|
||||||
file_size = f->st.st_size;
|
file_size = f->st.st_size;
|
||||||
@@ -189,9 +189,9 @@ bool Packer::compress(upx_bytep in, upx_bytep out,
|
|||||||
if ((level >= 7) || (level >= 4 && ph.u_len >= 512*1024))
|
if ((level >= 7) || (level >= 4 && ph.u_len >= 512*1024))
|
||||||
step = 0;
|
step = 0;
|
||||||
#endif
|
#endif
|
||||||
if (this->pass >= 0)
|
if (ui_pass >= 0)
|
||||||
this->pass++;
|
ui_pass++;
|
||||||
uip->startCallback(ph.u_len, step, this->pass, this->total_passes);
|
uip->startCallback(ph.u_len, step, ui_pass, ui_total_passes);
|
||||||
uip->firstCallback();
|
uip->firstCallback();
|
||||||
|
|
||||||
//OutputFile::dump("data.raw", in, ph.u_len);
|
//OutputFile::dump("data.raw", in, ph.u_len);
|
||||||
@@ -754,7 +754,7 @@ upx_byte *Packer::optimizeReloc32(upx_byte *in, unsigned relocnum,
|
|||||||
oc = get_le32(in+jc*4) - pc;
|
oc = get_le32(in+jc*4) - pc;
|
||||||
if (oc == 0)
|
if (oc == 0)
|
||||||
continue;
|
continue;
|
||||||
else if (oc < 4)
|
else if ((int)oc < 4)
|
||||||
throwCantPack("overlapping fixups");
|
throwCantPack("overlapping fixups");
|
||||||
else if (oc < 0xF0)
|
else if (oc < 0xF0)
|
||||||
*fix++ = (unsigned char) oc;
|
*fix++ = (unsigned char) oc;
|
||||||
@@ -886,9 +886,9 @@ const upx_byte *Packer::getLoader() const
|
|||||||
|
|
||||||
int Packer::getLoaderSize() const
|
int Packer::getLoaderSize() const
|
||||||
{
|
{
|
||||||
int l;
|
int size;
|
||||||
(void) linker->getLoader(&l);
|
(void) linker->getLoader(&size);
|
||||||
return l;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1051,12 +1051,12 @@ void Packer::compressWithFilters(Filter *parm_ft, unsigned *parm_overlapoh,
|
|||||||
|
|
||||||
// update total_passes
|
// update total_passes
|
||||||
if (strategy < 0)
|
if (strategy < 0)
|
||||||
this->total_passes += 1;
|
ui_total_passes += 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (strategy > nfilters)
|
if (strategy > nfilters)
|
||||||
nfilters = strategy;
|
nfilters = strategy;
|
||||||
this->total_passes += nfilters;
|
ui_total_passes += nfilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Working buffer for compressed data. Don't waste memory.
|
// Working buffer for compressed data. Don't waste memory.
|
||||||
@@ -1090,7 +1090,7 @@ void Packer::compressWithFilters(Filter *parm_ft, unsigned *parm_overlapoh,
|
|||||||
{
|
{
|
||||||
// filter failed or was usesless
|
// filter failed or was usesless
|
||||||
if (strategy >= 0)
|
if (strategy >= 0)
|
||||||
this->total_passes -= 1;
|
ui_total_passes -= 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// filter success
|
// filter success
|
||||||
@@ -1200,8 +1200,8 @@ void Packer::scanFilters(Filter *ft, const upx_byte *buf, unsigned buf_len,
|
|||||||
if (*f == 0) // skip no-filter
|
if (*f == 0) // skip no-filter
|
||||||
continue;
|
continue;
|
||||||
ft->init(*f, addvalue);
|
ft->init(*f, addvalue);
|
||||||
//static const int pc[] = { 0xff, 0xfe, 0x80, 0x22, -1 };
|
//static const int ctos[] = { 0xff, 0xfe, 0x80, 0x22, -1 };
|
||||||
//ft->preferred_ctos = pc;
|
//ft->preferred_ctos = ctos;
|
||||||
if (ft->scan(buf, buf_len))
|
if (ft->scan(buf, buf_len))
|
||||||
{
|
{
|
||||||
printf("scanFilters: id 0x%02x size: %6d: calls %5d/%5d/%3d, cto 0x%02x\n",
|
printf("scanFilters: id 0x%02x size: %6d: calls %5d/%5d/%3d, cto 0x%02x\n",
|
||||||
|
|||||||
+2
-2
@@ -236,8 +236,8 @@ protected:
|
|||||||
|
|
||||||
// UI handler
|
// UI handler
|
||||||
UiPacker *uip;
|
UiPacker *uip;
|
||||||
int pass;
|
int ui_pass;
|
||||||
int total_passes;
|
int ui_total_passes;
|
||||||
|
|
||||||
// linker
|
// linker
|
||||||
Linker *linker;
|
Linker *linker;
|
||||||
|
|||||||
Reference in New Issue
Block a user