mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Cleanups.
committer: mfx <mfx> 1036860405 +0000
This commit is contained in:
parent
f91849ec4b
commit
b6c84d19ab
|
@ -150,24 +150,26 @@ static bool is_dlm(InputFile *fi, long coff_offset)
|
|||
static void handle_allegropak(InputFile *fi, OutputFile *fo)
|
||||
{
|
||||
unsigned char buf[0x4000];
|
||||
unsigned pfsize=0, ic;
|
||||
int pfsize = 0;
|
||||
|
||||
try {
|
||||
fi->seek(-8,SEEK_END);
|
||||
fi->readx(buf,8);
|
||||
if (memcmp(buf,"slh+",4) != 0)
|
||||
fi->seek(-8, SEEK_END);
|
||||
fi->readx(buf, 8);
|
||||
if (memcmp(buf, "slh+", 4) != 0)
|
||||
return;
|
||||
pfsize = get_be32(buf+4);
|
||||
fi->seek(-(off_t)pfsize,SEEK_END);
|
||||
pfsize = get_be32_signed(buf+4);
|
||||
if (pfsize <= 8 || pfsize >= fi->st.st_size)
|
||||
return;
|
||||
fi->seek(-pfsize, SEEK_END);
|
||||
} catch (const IOException&) {
|
||||
return;
|
||||
}
|
||||
while (pfsize)
|
||||
while (pfsize > 0)
|
||||
{
|
||||
ic = pfsize < sizeof(buf) ? pfsize : sizeof(buf);
|
||||
fi->readx(buf,ic);
|
||||
fo->write(buf,ic);
|
||||
pfsize -= ic;
|
||||
const int len = UPX_MIN(pfsize, (int)sizeof(buf));
|
||||
fi->readx(buf, len);
|
||||
fo->write(buf, len);
|
||||
pfsize -= len;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ void PackTmt::pack(OutputFile *fo)
|
|||
|
||||
int PackTmt::canUnpack()
|
||||
{
|
||||
if (!PackTmt::readFileHeader())
|
||||
if (!readFileHeader())
|
||||
return false;
|
||||
fi->seek(adam_offset, SEEK_SET);
|
||||
return readPackHeader(512) ? 1 : -1;
|
||||
|
|
|
@ -323,7 +323,8 @@ public:
|
|||
void finish(upx_byte *&p,unsigned &size);
|
||||
};
|
||||
|
||||
Reloc::Reloc(upx_byte *s,unsigned si) : start(s), size(si), rel(0)
|
||||
Reloc::Reloc(upx_byte *s,unsigned si) :
|
||||
start(s), size(si), rel(NULL), rel1(NULL)
|
||||
{
|
||||
COMPILE_TIME_ASSERT(sizeof(reloc) == 8);
|
||||
memset(counts,0,sizeof(counts));
|
||||
|
@ -332,7 +333,8 @@ Reloc::Reloc(upx_byte *s,unsigned si) : start(s), size(si), rel(0)
|
|||
counts[type]++;
|
||||
}
|
||||
|
||||
Reloc::Reloc(unsigned rnum) : rel(0)
|
||||
Reloc::Reloc(unsigned rnum) :
|
||||
start(NULL), size(0), rel(NULL), rel1(NULL)
|
||||
{
|
||||
start = new upx_byte[rnum * 4 + 8192];
|
||||
counts[0] = 0;
|
||||
|
@ -790,8 +792,8 @@ private:
|
|||
Export::Export(char *_base) : base(_base), iv(_base)
|
||||
{
|
||||
COMPILE_TIME_ASSERT(sizeof(export_dir_t) == 40);
|
||||
ename = functionptrs = ordinals = 0;
|
||||
names = 0;
|
||||
ename = functionptrs = ordinals = NULL;
|
||||
names = NULL;
|
||||
memset(&edir,0,sizeof(edir));
|
||||
size = 0;
|
||||
}
|
||||
|
@ -1090,7 +1092,7 @@ class Resource
|
|||
void destroy(upx_rnode *urd,unsigned level);
|
||||
|
||||
public:
|
||||
Resource() : root(0) {}
|
||||
Resource() : root(NULL) {}
|
||||
Resource(const upx_byte *p) {init(p);}
|
||||
~Resource() {if (root) destroy (root,0);}
|
||||
void init(const upx_byte *);
|
||||
|
@ -1107,7 +1109,7 @@ public:
|
|||
upx_byte *build();
|
||||
bool clear();
|
||||
|
||||
void dump() const {dump (root,0);}
|
||||
void dump() const { dump(root,0); }
|
||||
/*
|
||||
unsigned iname() const {return current->parent->id;}
|
||||
const upx_byte *nname() const {return current->parent->name;}
|
||||
|
|
Loading…
Reference in New Issue
Block a user