diff --git a/src/p_armpe.cpp b/src/p_armpe.cpp index 66b8f2ef..ab2c90b0 100644 --- a/src/p_armpe.cpp +++ b/src/p_armpe.cpp @@ -1942,14 +1942,14 @@ void PackArmPe::pack(OutputFile *fo) identsplit = ALIGN_GAP(identsplit, 0x200); ic = identsize - identsplit; - const unsigned clen = ((ph.c_len + ic) & 15) == 0 ? ph.c_len : ph.c_len + 16 - ((ph.c_len + ic) & 15); - obuf.clear(ph.c_len, clen - ph.c_len); + const unsigned c_len = ((ph.c_len + ic) & 15) == 0 ? ph.c_len : ph.c_len + 16 - ((ph.c_len + ic) & 15); + obuf.clear(ph.c_len, c_len - ph.c_len); - const unsigned s1size = ALIGN_UP(ic + clen + codesize,4) + sotls; - const unsigned s1addr = (newvsize - (ic + clen) + oam1) &~ oam1; + const unsigned s1size = ALIGN_UP(ic + c_len + codesize,4) + sotls; + const unsigned s1addr = (newvsize - (ic + c_len) + oam1) &~ oam1; const unsigned ncsection = (s1addr + s1size + oam1) &~ oam1; - const unsigned upxsection = s1addr + ic + clen; + const unsigned upxsection = s1addr + ic + c_len; Reloc rel(1024); // new relocations are put here // patch loader @@ -2101,8 +2101,8 @@ void PackArmPe::pack(OutputFile *fo) } fo->write(loader + codesize,identsize); infoWriting("loader", fo->getBytesWritten()); - fo->write(obuf,clen); - infoWriting("compressed data", clen); + fo->write(obuf,c_len); + infoWriting("compressed data", c_len); fo->write(loader,codesize); if (opt->debug.dump_stub_loader) OutputFile::dump(opt->debug.dump_stub_loader, loader, codesize); @@ -2123,7 +2123,7 @@ void PackArmPe::pack(OutputFile *fo) printf("%-13s: program hdr : %8ld bytes\n", getName(), (long) sizeof(oh)); printf("%-13s: sections : %8ld bytes\n", getName(), (long) sizeof(osection)); printf("%-13s: ident : %8ld bytes\n", getName(), (long) identsize); - printf("%-13s: compressed : %8ld bytes\n", getName(), (long) clen); + printf("%-13s: compressed : %8ld bytes\n", getName(), (long) c_len); printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) codesize); printf("%-13s: tls : %8ld bytes\n", getName(), (long) sotls); printf("%-13s: resources : %8ld bytes\n", getName(), (long) soresources); diff --git a/src/p_exe.cpp b/src/p_exe.cpp index 52c1c745..09fc790f 100644 --- a/src/p_exe.cpp +++ b/src/p_exe.cpp @@ -542,7 +542,7 @@ void PackExe::pack(OutputFile *fo) oh.ip = getLoaderSection("EXEENTRY") - 2; } -//fprintf(stderr,"\ne_len=%x d_len=%x clen=%x oo=%x ulen=%x destp=%x copys=%x images=%x",e_len,d_len,packedsize,ph.overlap_overhead,ph.u_len,destpara,copysize,ih_imagesize); +//fprintf(stderr,"\ne_len=%x d_len=%x c_len=%x oo=%x ulen=%x destp=%x copys=%x images=%x",e_len,d_len,packedsize,ph.overlap_overhead,ph.u_len,destpara,copysize,ih_imagesize); // write header + write loader + compressed file #ifdef TESTING diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 6bccc8d7..25614543 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -968,7 +968,7 @@ void PackLinuxElf32::pack2(OutputFile *fo, Filter &ft) unsigned total_in = 0; unsigned total_out = 0; - unsigned hdr_ulen = sizeof(Elf32_Ehdr) + sz_phdrs; + unsigned hdr_u_len = sizeof(Elf32_Ehdr) + sz_phdrs; ui_pass = 0; ft.addvalue = 0; @@ -993,8 +993,8 @@ void PackLinuxElf32::pack2(OutputFile *fo, Filter &ft) // sometimes marks as PF_X anyway. So filter only first segment. packExtent(x, total_in, total_out, ((0==nx && (Elf32_Phdr::PF_X & get_native32(&phdri[k].p_flags))) - ? &ft : 0 ), fo, hdr_ulen); - hdr_ulen = 0; + ? &ft : 0 ), fo, hdr_u_len); + hdr_u_len = 0; ++nx; } for (k = 0; k < e_phnum; ++k) { @@ -1070,7 +1070,7 @@ void PackLinuxElf64::pack2(OutputFile *fo, Filter &ft) unsigned total_in = 0; unsigned total_out = 0; - unsigned hdr_ulen = sizeof(Elf64_Ehdr) + sz_phdrs; + unsigned hdr_u_len = sizeof(Elf64_Ehdr) + sz_phdrs; ui_pass = 0; ft.addvalue = 0; @@ -1095,8 +1095,8 @@ void PackLinuxElf64::pack2(OutputFile *fo, Filter &ft) // sometimes marks as PF_X anyway. So filter only first segment. packExtent(x, total_in, total_out, ((0==nx && (Elf64_Phdr::PF_X & get_native64(&phdri[k].p_flags))) - ? &ft : 0 ), fo, hdr_ulen); - hdr_ulen = 0; + ? &ft : 0 ), fo, hdr_u_len); + hdr_u_len = 0; ++nx; } for (k = 0; k < e_phnum; ++k) { diff --git a/src/p_mach.cpp b/src/p_mach.cpp index 4b641289..1805fdc7 100644 --- a/src/p_mach.cpp +++ b/src/p_mach.cpp @@ -240,7 +240,7 @@ PackMachPPC32::pack2(OutputFile *fo, Filter &ft) // append compressed body unsigned total_in = 0; unsigned total_out = 0; - unsigned hdr_ulen = mhdri.sizeofcmds; + unsigned hdr_u_len = mhdri.sizeofcmds; ui_pass = 0; ft.addvalue = 0; @@ -258,8 +258,8 @@ PackMachPPC32::pack2(OutputFile *fo, Filter &ft) // append compressed body } packExtent(x, total_in, total_out, ((Mach_segment_command::VM_PROT_EXECUTE & msegcmd[k].initprot) - ? &ft : 0 ), fo, hdr_ulen ); - hdr_ulen = 0; + ? &ft : 0 ), fo, hdr_u_len ); + hdr_u_len = 0; ++nx; } for (k = 0; k < n_segment; ++k) { diff --git a/src/p_tmt.cpp b/src/p_tmt.cpp index 447a1743..fbecbbac 100644 --- a/src/p_tmt.cpp +++ b/src/p_tmt.cpp @@ -249,7 +249,7 @@ void PackTmt::pack(OutputFile *fo) patch_le32(loader,e_len,"ECX0",ph.c_len+d_len); patch_le32(loader,e_len,"EDI0",ph.u_len+ph.overlap_overhead+d_len-1); patch_le32(loader,e_len,"ESI0",ph.c_len+e_len+d_len-1); - //fprintf(stderr,"\nelen=%x dlen=%x copy_len=%x copy_to=%x oo=%x jmp_pos=%x ulen=%x clen=%x \n\n", + //fprintf(stderr,"\nelen=%x dlen=%x copy_len=%x copy_to=%x oo=%x jmp_pos=%x ulen=%x c_len=%x \n\n", // e_len,d_len,copy_len,copy_to,ph.overlap_overhead,jmp_pos,ph.u_len,ph.c_len); memcpy(&oh,&ih,sizeof(oh)); diff --git a/src/p_unix.cpp b/src/p_unix.cpp index ddae4b25..aecd26d2 100644 --- a/src/p_unix.cpp +++ b/src/p_unix.cpp @@ -305,16 +305,16 @@ void PackUnix::packExtent( unsigned &total_out, Filter *ft, OutputFile *fo, - unsigned hdr_ulen + unsigned hdr_u_len ) { unsigned const init_u_adler = ph.u_adler; unsigned const init_c_adler = ph.c_adler; MemBuffer hdr_ibuf; - if (hdr_ulen) { - hdr_ibuf.alloc(hdr_ulen); + if (hdr_u_len) { + hdr_ibuf.alloc(hdr_u_len); fi->seek(0, SEEK_SET); - int l = fi->readx(hdr_ibuf, hdr_ulen); + int l = fi->readx(hdr_ibuf, hdr_u_len); (void)l; } fi->seek(x.offset, SEEK_SET); @@ -348,7 +348,7 @@ void PackUnix::packExtent( compressWithFilters(ft, OVERHEAD, strategy, NULL, 0, 0, 0, 0, // those 5 args are the defaults - hdr_ibuf, hdr_ulen); + hdr_ibuf, hdr_u_len); } else { (void) compress(ibuf, obuf); // ignore return value @@ -371,31 +371,31 @@ void PackUnix::packExtent( // write block sizes b_info tmp; - if (hdr_ulen) { - unsigned hdr_clen; + if (hdr_u_len) { + unsigned hdr_c_len; MemBuffer hdr_obuf; - hdr_obuf.allocForCompression(hdr_ulen); - int r = upx_compress(hdr_ibuf, hdr_ulen, hdr_obuf, &hdr_clen, 0, + hdr_obuf.allocForCompression(hdr_u_len); + int r = upx_compress(hdr_ibuf, hdr_u_len, hdr_obuf, &hdr_c_len, 0, ph.method, 10, NULL, NULL); if (r != UPX_E_OK) throwInternalError("header compression failed"); - if (hdr_clen >= hdr_ulen) + if (hdr_c_len >= hdr_u_len) throwInternalError("header compression size increase"); - ph.saved_u_adler = upx_adler32(hdr_ibuf, hdr_ulen, init_u_adler); - ph.saved_c_adler = upx_adler32(hdr_obuf, hdr_clen, init_c_adler); + ph.saved_u_adler = upx_adler32(hdr_ibuf, hdr_u_len, init_u_adler); + ph.saved_c_adler = upx_adler32(hdr_obuf, hdr_c_len, init_c_adler); ph.u_adler = upx_adler32(ibuf, ph.u_len, ph.saved_u_adler); ph.c_adler = upx_adler32(obuf, ph.c_len, ph.saved_c_adler); end_u_adler = ph.u_adler; memset(&tmp, 0, sizeof(tmp)); - set_native32(&tmp.sz_unc, hdr_ulen); - set_native32(&tmp.sz_cpr, hdr_clen); + set_native32(&tmp.sz_unc, hdr_u_len); + set_native32(&tmp.sz_cpr, hdr_c_len); tmp.b_method = (unsigned char) ph.method; fo->write(&tmp, sizeof(tmp)); b_len += sizeof(b_info); - fo->write(hdr_obuf, hdr_clen); - total_out += hdr_clen; - total_in += hdr_ulen; - hdr_ulen = 0; // compress hdr one time only + fo->write(hdr_obuf, hdr_c_len); + total_out += hdr_c_len; + total_in += hdr_u_len; + hdr_u_len = 0; // compress hdr one time only } memset(&tmp, 0, sizeof(tmp)); set_native32(&tmp.sz_unc, ph.u_len); diff --git a/src/p_vmlinz.cpp b/src/p_vmlinz.cpp index 7937cf2b..859f1a0c 100644 --- a/src/p_vmlinz.cpp +++ b/src/p_vmlinz.cpp @@ -354,9 +354,9 @@ void PackBvmlinuzI386::pack(OutputFile *fo) compressWithFilters(&ft, 512); // align everything to dword boundary - it is easier to handle - unsigned clen = ph.c_len; - memset(obuf + clen, 0, 4); - clen = ALIGN_UP(clen, 4); + unsigned c_len = ph.c_len; + memset(obuf + c_len, 0, 4); + c_len = ALIGN_UP(c_len, 4); const unsigned lsize = getLoaderSize(); MemBuffer loader(lsize); @@ -370,14 +370,14 @@ void PackBvmlinuzI386::pack(OutputFile *fo) const unsigned d_len4 = ALIGN_UP(lsize - e_len, 4); const unsigned decompr_pos = ALIGN_UP(ph.u_len + ph.overlap_overhead, 16); - const unsigned copy_size = clen + d_len4; + const unsigned copy_size = c_len + d_len4; const unsigned edi = decompr_pos + d_len4 - 4; // copy to - const unsigned esi = ALIGN_UP(clen + lsize, 4) - 4; // copy from + const unsigned esi = ALIGN_UP(c_len + lsize, 4) - 4; // copy from unsigned jpos = find_le32(loader, e_len, get_le32("JMPD")); patch_le32(loader, e_len, "JMPD", decompr_pos - jpos - 4); - patch_le32(loader, e_len, "ESI1", bzimage_offset + decompr_pos - clen); + patch_le32(loader, e_len, "ESI1", bzimage_offset + decompr_pos - c_len); patch_le32(loader, e_len, "ECX0", copy_size / 4); patch_le32(loader, e_len, "EDI0", bzimage_offset + edi); patch_le32(loader, e_len, "ESI0", bzimage_offset + esi); @@ -389,16 +389,16 @@ void PackBvmlinuzI386::pack(OutputFile *fo) patch_le32(loader, e_len, "STAK", stack_offset_during_uncompression); boot_sect_t * const bs = (boot_sect_t *) ((unsigned char *) setup_buf); - bs->sys_size = (ALIGN_UP(lsize + clen, 16) / 16) & 0xffff; + bs->sys_size = (ALIGN_UP(lsize + c_len, 16) / 16) & 0xffff; fo->write(setup_buf, setup_buf.getSize()); fo->write(loader, e_len); - fo->write(obuf, clen); + fo->write(obuf, c_len); fo->write(loader + e_len, lsize - e_len); #if 0 printf("%-13s: setup : %8ld bytes\n", getName(), (long) setup_buf.getSize()); printf("%-13s: entry : %8ld bytes\n", getName(), (long) e_len); - printf("%-13s: compressed : %8ld bytes\n", getName(), (long) clen); + printf("%-13s: compressed : %8ld bytes\n", getName(), (long) c_len); printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) (lsize - e_len)); #endif diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index 73157be3..f613fdb1 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -1954,14 +1954,14 @@ void PackW32Pe::pack(OutputFile *fo) identsplit = ALIGN_GAP(identsplit, 0x200); ic = identsize - identsplit; - const unsigned clen = ((ph.c_len + ic) & 15) == 0 ? ph.c_len : ph.c_len + 16 - ((ph.c_len + ic) & 15); - obuf.clear(ph.c_len, clen - ph.c_len); + const unsigned c_len = ((ph.c_len + ic) & 15) == 0 ? ph.c_len : ph.c_len + 16 - ((ph.c_len + ic) & 15); + obuf.clear(ph.c_len, c_len - ph.c_len); - const unsigned s1size = ALIGN_UP(ic + clen + codesize,4) + sotls; - const unsigned s1addr = (newvsize - (ic + clen) + oam1) &~ oam1; + const unsigned s1size = ALIGN_UP(ic + c_len + codesize,4) + sotls; + const unsigned s1addr = (newvsize - (ic + c_len) + oam1) &~ oam1; const unsigned ncsection = (s1addr + s1size + oam1) &~ oam1; - const unsigned upxsection = s1addr + ic + clen; + const unsigned upxsection = s1addr + ic + c_len; const unsigned myimport = ncsection + soresources - rvamin; // patch loader @@ -2192,8 +2192,8 @@ void PackW32Pe::pack(OutputFile *fo) } fo->write(loader + codesize,identsize); infoWriting("loader", fo->getBytesWritten()); - fo->write(obuf,clen); - infoWriting("compressed data", clen); + fo->write(obuf,c_len); + infoWriting("compressed data", c_len); fo->write(loader,codesize); if (opt->debug.dump_stub_loader) OutputFile::dump(opt->debug.dump_stub_loader, loader, codesize); @@ -2215,7 +2215,7 @@ void PackW32Pe::pack(OutputFile *fo) printf("%-13s: program hdr : %8ld bytes\n", getName(), (long) sizeof(oh)); printf("%-13s: sections : %8ld bytes\n", getName(), (long) sizeof(osection)); printf("%-13s: ident : %8ld bytes\n", getName(), (long) identsize); - printf("%-13s: compressed : %8ld bytes\n", getName(), (long) clen); + printf("%-13s: compressed : %8ld bytes\n", getName(), (long) c_len); printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) codesize); printf("%-13s: tls : %8ld bytes\n", getName(), (long) sotls); printf("%-13s: resources : %8ld bytes\n", getName(), (long) soresources);