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

Silence some compilation warnings.

This commit is contained in:
Markus F.X.J. Oberhumer 2010-03-31 02:16:32 +02:00
parent f4f8bd8d42
commit b6a9b0a4c9
4 changed files with 16 additions and 14 deletions

View File

@ -93,6 +93,7 @@
# error "need Visual C++ 5.0 or newer" # error "need Visual C++ 5.0 or newer"
# endif # endif
# pragma warning(error: 4096) // W2: '__cdecl' must be used with '...' # pragma warning(error: 4096) // W2: '__cdecl' must be used with '...'
# pragma warning(error: 4138) // Wx: '*/' found outside of comment
# pragma warning(disable: 4097) // W3: typedef-name 'A' used as synonym for class-name 'B' # pragma warning(disable: 4097) // W3: typedef-name 'A' used as synonym for class-name 'B'
# pragma warning(disable: 4511) // W3: 'class': copy constructor could not be generated # pragma warning(disable: 4511) // W3: 'class': copy constructor could not be generated
# pragma warning(disable: 4512) // W4: 'class': assignment operator could not be generated # pragma warning(disable: 4512) // W4: 'class': assignment operator could not be generated

View File

@ -193,7 +193,8 @@ __packed_struct(Sym)
static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); } static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); }
static unsigned int get_st_type(unsigned x) { return 0xf & x ; } static unsigned int get_st_type(unsigned x) { return 0xf & x ; }
static unsigned char make_st_info(unsigned bind, unsigned type) { return (bind<<4) + (0xf & type); } static unsigned char make_st_info(unsigned bind, unsigned type)
{ return (unsigned char) (((bind<<4) + (0xf & type)) & 0xff); }
__packed_struct_end() __packed_struct_end()
@ -269,7 +270,8 @@ __packed_struct(Sym)
static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); } static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); }
static unsigned int get_st_type(unsigned x) { return 0xf & x ; } static unsigned int get_st_type(unsigned x) { return 0xf & x ; }
static unsigned char make_st_info(unsigned bind, unsigned type) { return (bind<<4) + (0xf & type); } static unsigned char make_st_info(unsigned bind, unsigned type)
{ return (unsigned char) (((bind<<4) + (0xf & type)) & 0xff); }
__packed_struct_end() __packed_struct_end()

View File

@ -1672,7 +1672,7 @@ PackLinuxElf64::generateElfHdr(
} }
} }
void PackLinuxElf32::pack1(OutputFile */*fo*/, Filter &/*ft*/) void PackLinuxElf32::pack1(OutputFile * /*fo*/, Filter & /*ft*/)
{ {
fi->seek(0, SEEK_SET); fi->seek(0, SEEK_SET);
fi->readx(&ehdri, sizeof(ehdri)); fi->readx(&ehdri, sizeof(ehdri));
@ -1774,7 +1774,7 @@ void PackLinuxElf32ppc::pack1(OutputFile *fo, Filter &ft)
generateElfHdr(fo, stub_powerpc_linux_elf_fold, getbrk(phdri, e_phnum) ); generateElfHdr(fo, stub_powerpc_linux_elf_fold, getbrk(phdri, e_phnum) );
} }
void PackLinuxElf64::pack1(OutputFile */*fo*/, Filter &/*ft*/) void PackLinuxElf64::pack1(OutputFile * /*fo*/, Filter & /*ft*/)
{ {
fi->seek(0, SEEK_SET); fi->seek(0, SEEK_SET);
fi->readx(&ehdri, sizeof(ehdri)); fi->readx(&ehdri, sizeof(ehdri));
@ -2997,7 +2997,7 @@ void PackLinuxElf32::unpack(OutputFile *fo)
#undef MAX_ELF_HDR #undef MAX_ELF_HDR
} }
void PackLinuxElf::unpack(OutputFile */*fo*/) void PackLinuxElf::unpack(OutputFile * /*fo*/)
{ {
throwCantUnpack("internal error"); throwCantUnpack("internal error");
} }

View File

@ -275,7 +275,7 @@ void PackMachI386::addStubEntrySections(Filter const *ft)
addLoader("FOLDEXEC", NULL); addLoader("FOLDEXEC", NULL);
} }
void PackMachAMD64::addStubEntrySections(Filter const */*ft*/) void PackMachAMD64::addStubEntrySections(Filter const * /*ft*/)
{ {
addLoader("MACHMAINX", NULL); addLoader("MACHMAINX", NULL);
//addLoader(getDecompressorSections(), NULL); //addLoader(getDecompressorSections(), NULL);
@ -290,7 +290,7 @@ void PackMachAMD64::addStubEntrySections(Filter const */*ft*/)
addLoader("MACHMAINY,IDENTSTR,+40,MACHMAINZ,FOLDEXEC", NULL); addLoader("MACHMAINY,IDENTSTR,+40,MACHMAINZ,FOLDEXEC", NULL);
} }
void PackMachARMEL::addStubEntrySections(Filter const */*ft*/) void PackMachARMEL::addStubEntrySections(Filter const * /*ft*/)
{ {
addLoader("MACHMAINX", NULL); addLoader("MACHMAINX", NULL);
//addLoader(getDecompressorSections(), NULL); //addLoader(getDecompressorSections(), NULL);
@ -872,7 +872,7 @@ unsigned PackMachBase<T>::find_SEGMENT_gap(
} }
if (lc_seg==msegcmd[j].cmd if (lc_seg==msegcmd[j].cmd
&& 0!=msegcmd[j].filesize ) { && 0!=msegcmd[j].filesize ) {
unsigned const t = msegcmd[j].fileoff; unsigned const t = (unsigned) msegcmd[j].fileoff;
if ((t - hi) < (lo - hi)) { if ((t - hi) < (lo - hi)) {
lo = t; lo = t;
if (hi==lo) { if (hi==lo) {
@ -935,7 +935,7 @@ void PackMachBase<T>::pack2(OutputFile *fo, Filter &ft) // append compressed bo
if (lc_seg==msegcmd[k].cmd if (lc_seg==msegcmd[k].cmd
&& 0!=(Mach_segment_command::VM_PROT_EXECUTE & msegcmd[k].initprot) && 0!=(Mach_segment_command::VM_PROT_EXECUTE & msegcmd[k].initprot)
&& exe_filesize_max < msegcmd[k].filesize) { && exe_filesize_max < msegcmd[k].filesize) {
exe_filesize_max = msegcmd[k].filesize; exe_filesize_max = (unsigned) msegcmd[k].filesize;
} }
int nx = 0; int nx = 0;
@ -1176,7 +1176,7 @@ bool PackMachBase<T>::canPack()
fi->seek(0, SEEK_SET); fi->seek(0, SEEK_SET);
fi->readx(&mhdri, sizeof(mhdri)); fi->readx(&mhdri, sizeof(mhdri));
if ((Mach_header::MH_MAGIC + (sizeof(Addr)>>3)) !=mhdri.magic if (((unsigned) Mach_header::MH_MAGIC + (sizeof(Addr)>>3)) !=mhdri.magic
|| my_cputype !=mhdri.cputype || my_cputype !=mhdri.cputype
|| my_filetype !=mhdri.filetype || my_filetype !=mhdri.filetype
) )
@ -1421,11 +1421,10 @@ bool PackMachFat::canPack()
fi->set_extent(fat_head.arch[j].offset, fat_head.arch[j].size); fi->set_extent(fat_head.arch[j].offset, fat_head.arch[j].size);
fi->seek(0, SEEK_SET); fi->seek(0, SEEK_SET);
switch (arch[j].cputype) { switch (arch[j].cputype) {
default: { default:
infoWarning("unknown cputype 0x%x: %s", infoWarning("unknown cputype 0x%x: %s",
(unsigned)arch[j].cputype, fi->getName()); (unsigned)arch[j].cputype, fi->getName());
return false; return false;
} break;
case PackMachFat::CPU_TYPE_I386: { case PackMachFat::CPU_TYPE_I386: {
PackMachI386 packer(fi); PackMachI386 packer(fi);
if (!packer.canPack()) { if (!packer.canPack()) {
@ -1505,7 +1504,7 @@ int PackMachFat::canUnpack()
return 1; return 1;
} }
void PackMachFat::buildLoader(const Filter */*ft*/) void PackMachFat::buildLoader(const Filter * /*ft*/)
{ {
assert(false); assert(false);
} }