1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Don't use "long". Cleanups.

This commit is contained in:
Markus F.X.J. Oberhumer 2016-09-22 00:47:35 +02:00
parent 473cfb54be
commit 763b3c05af
4 changed files with 6 additions and 10 deletions

View File

@ -287,7 +287,7 @@ inline const T& UPX_MIN(const T& a, const T& b) { if (a < b) return a; return b;
// gets destructed when leaving scope or on exceptions.
#define Array(type, var, size) \
MemBuffer var ## _membuf(mem_size(sizeof(type), size)); \
type * const var = ((type *) var ## _membuf.getVoidPtr())
type * const var = ACC_STATIC_CAST(type *, var ## _membuf.getVoidPtr())
#define ByteArray(var, size) Array(unsigned char, var, size)

View File

@ -540,14 +540,14 @@ unsigned Packer::findOverlapOverhead(const upx_bytep buf,
// file i/o utils
**************************************************************************/
void Packer::handleStub(InputFile *fif, OutputFile *fo, long size)
void Packer::handleStub(InputFile *fif, OutputFile *fo, unsigned size)
{
if (fo)
{
if (size > 0)
{
// copy stub from exe
info("Copying original stub: %ld bytes", size);
info("Copying original stub: %u bytes", size);
ByteArray(stub, size);
fif->seek(0,SEEK_SET);
fif->readx(stub,size);
@ -661,7 +661,7 @@ void Packer::initPackHeader()
ph.method = M_NONE;
ph.level = -1;
ph.u_adler = ph.c_adler = ph.saved_u_adler = ph.saved_c_adler = upx_adler32(NULL,0);
ph.buf_offset = -1;
ph.buf_offset = 0;
ph.u_file_size = file_size;
}

View File

@ -80,7 +80,7 @@ public:
unsigned saved_c_adler;
// info fields set by fillPackHeader()
long buf_offset;
unsigned buf_offset;
// info fields set by Packer::compress()
upx_compress_result_t compress_result;
@ -264,7 +264,7 @@ protected:
virtual void defineFilterSymbols(const Filter *ft);
// stub and overlay util
static void handleStub(InputFile *fi, OutputFile *fo, long size);
static void handleStub(InputFile *fi, OutputFile *fo, unsigned size);
virtual void checkOverlay(unsigned overlay);
virtual void copyOverlay(OutputFile *fo, unsigned overlay,
MemBuffer *buf, bool do_seek=true);

View File

@ -241,11 +241,7 @@ void UiPacker::startCallback(unsigned u_len, unsigned step, int pass, int total_
return;
}
#if (ACC_CC_MSC && (_MSC_VER == 1300))
cb.nprogress = &UiPacker::progress_callback;
#else
cb.nprogress = progress_callback;
#endif
cb.user = this; // parameter for static function UiPacker::progress_callback()
if (s->mode == M_CB_TERM) {