Minor cleanups.
committer: mfx <mfx> 968538234 +0000
This commit is contained in:
+8
-4
@@ -43,7 +43,7 @@ MemBuffer::MemBuffer(unsigned size=0) :
|
||||
|
||||
MemBuffer::~MemBuffer()
|
||||
{
|
||||
free();
|
||||
this->free();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,11 @@ unsigned MemBuffer::getSize() const
|
||||
|
||||
void MemBuffer::alloc(unsigned size, unsigned base_offset)
|
||||
{
|
||||
#if 0
|
||||
// don't automaticlly free a used buffer
|
||||
this->free();
|
||||
#endif
|
||||
assert(alloc_ptr == NULL);
|
||||
//free();
|
||||
assert((int)size > 0);
|
||||
size = base_offset + size;
|
||||
alloc_ptr = (unsigned char *) malloc(size);
|
||||
@@ -94,7 +97,7 @@ void MemBuffer::allocForCompression(unsigned uncompressed_size)
|
||||
// Idea:
|
||||
// We allocate the buffer at an offset of 4096 so
|
||||
// that we could do an in-place decompression for
|
||||
// verifying our overlap overhead at the end
|
||||
// verifying our overlap_overhead at the end
|
||||
// of packing.
|
||||
//
|
||||
// See Packer::verifyOverlappingDecompression().
|
||||
@@ -105,7 +108,8 @@ void MemBuffer::allocForCompression(unsigned uncompressed_size)
|
||||
|
||||
void MemBuffer::allocForUncompression(unsigned uncompressed_size)
|
||||
{
|
||||
alloc(uncompressed_size + 512, 0); // 512 safety bytes
|
||||
//alloc(uncompressed_size + 512, 0); // 512 safety bytes
|
||||
alloc(uncompressed_size + 3, 0); // 3 safety bytes for asm_fast
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -285,6 +285,7 @@ void PackDjgpp2::pack(OutputFile *fo)
|
||||
ft.verifyUnfilter();
|
||||
#else
|
||||
// new version using compressWithFilters()
|
||||
|
||||
// prepare packheader
|
||||
ph.u_len = usize;
|
||||
ph.filter = 0;
|
||||
|
||||
+7
-4
@@ -34,7 +34,7 @@
|
||||
static const
|
||||
#include "stub/l_exe.h"
|
||||
|
||||
#define RSFCRI 4096 // reserved space for compressed relocation info
|
||||
#define RSFCRI 4096 // Reserved Space For Compressed Relocation Info
|
||||
#define MAXMATCH 0x2000
|
||||
#define MAXRELOCS (0x8000-MAXMATCH)
|
||||
|
||||
@@ -452,11 +452,13 @@ void PackExe::pack(OutputFile *fo)
|
||||
}
|
||||
|
||||
putPackHeader(loader,lsize);
|
||||
upx_bytep p = find_le32(loader,lsize,get_le32("IPCS"));
|
||||
if (p == NULL && (flag & USEJUMP))
|
||||
throwBadLoader();
|
||||
if (flag & USEJUMP)
|
||||
{
|
||||
upx_bytep p = find_le32(loader,lsize,get_le32("IPCS"));
|
||||
if (p == NULL)
|
||||
throwBadLoader();
|
||||
memcpy(p,&ih.ip,4);
|
||||
}
|
||||
else
|
||||
{
|
||||
patch_le16(loader,lsize,"IP",ih.ip);
|
||||
@@ -495,6 +497,7 @@ void PackExe::pack(OutputFile *fo)
|
||||
oh.p512 = (outputlen + 511) >> 9;
|
||||
|
||||
//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,overlapoh,ph.u_len,destpara,copysize,imagesize);
|
||||
|
||||
// write header + write loader + compressed file
|
||||
#ifdef TESTING
|
||||
if (opt->debug)
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
#ifdef WANT_STL
|
||||
|
||||
#if defined(__DJGPP__) || defined(__MINGW32__) || defined(__sparc__)
|
||||
// provide missing oom_handler
|
||||
void (*__malloc_alloc_template<0>::__malloc_alloc_oom_handler)() = 0;
|
||||
# if !defined(__USE_MALLOC)
|
||||
// instantiate default allocator
|
||||
template class __default_alloc_template<false, 0>;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user