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

Tune some MSVC warnings.

This commit is contained in:
Markus F.X.J. Oberhumer 2016-12-16 20:38:57 +01:00
parent c51864ca39
commit 0b4ac35bc9
7 changed files with 16 additions and 11 deletions

View File

@ -19,7 +19,7 @@ environment:
init:
- git config --global core.autocrlf input
- where bash & where cat & where curl & where file & where git & where gzip & where readlink & where sed & where sha256sum & where tar
- where bash & where cat & where cp & where curl & where file & where git & where gzip & where mkdir & where mv & where readlink & where rm & where rmdir & where sed & where sha256sum & where tar
# - bash --version & git --version & sed --version & tar --version
- git --version & bash --version
# - dir "c:\Program Files\Git\usr\bin"

View File

@ -59,7 +59,12 @@ ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_MAX == 255) // -funsigned-char
ACC_COMPILE_TIME_ASSERT_HEADER((char)(-1) > 0) // -funsigned-char
#if (ACC_CC_MSC)
# pragma warning(error: 4127)
# pragma warning(error: 4146)
# pragma warning(error: 4319)
# pragma warning(error: 4805)
# pragma warning(disable: 4244) // -Wconversion
# pragma warning(disable: 4267) // -Wconversion
#endif
// FIXME - quick hack for arm-wince-gcc-3.4 (Debian pocketpc-*.deb packages)

View File

@ -3373,7 +3373,7 @@ void PackLinuxElf64::unpack(OutputFile *fo)
}
}
bool const is_shlib = 0; // XXX: THIS IS BROKEN; see 32-bit ::unpack
if (is_shlib
if __acc_cte(is_shlib
|| ((unsigned)(get_te64(&ehdri.e_entry) - load_va) + up4(lsize) +
ph.getPackHeaderSize() + sizeof(overlay_offset))
< up4(file_size)) {

View File

@ -563,12 +563,11 @@ PackMachBase<T>::compare_segment_command(void const *const aa, void const *const
template <class T>
void PackMachBase<T>::pack4(OutputFile *fo, Filter &ft) // append PackHeader
{
Mach_main_command cmdMAIN;
// offset of p_info in compressed file
overlay_offset = sizeof(mhdro) + sizeof(segZERO)
+ sizeof(segXHDR) + sizeof(secXHDR)
+ sizeof(segTEXT) + sizeof(secTEXT)
+ sizeof(cmdUUID) + sizeof(cmdSRCVER) + sizeof(cmdVERMIN) + sizeof(cmdMAIN)
+ sizeof(cmdUUID) + sizeof(cmdSRCVER) + sizeof(cmdVERMIN) + sizeof(Mach_main_command)
+ sizeof(Mach_dyld_info_only_command) + sizeof(Mach_dysymtab_command)
+ sizeof(Mach_load_dylinker_command) + sizeof(Mach_load_dylib_command)
+ sizeof(Mach_function_starts_command) + sizeof(Mach_data_in_code_command)
@ -1377,7 +1376,7 @@ void PackMachBase<T>::pack1(OutputFile *const fo, Filter &/*ft*/) // generate e
segZERO.cmdsize = sizeof(segZERO);
strncpy((char *)segZERO.segname, "__PAGEZERO", sizeof(segZERO.segname));
segZERO.vmsize = PAGE_SIZE;
if (sizeof(segZERO.vmsize) == 8
if __acc_cte(sizeof(segZERO.vmsize) == 8
&& mhdro.filetype == Mach_header::MH_EXECUTE
&& mhdro.cputype == Mach_header::CPU_TYPE_X86_64) {
segZERO.vmsize <<= 20; // (1ul<<32)

View File

@ -123,8 +123,9 @@
S_16BYTE_LITERALS,
S_DTRACE_DOF
};
static const unsigned S_ATTR_PURE_INSTRUCTIONS = 0x80000000;
enum { // section flags (high 24 bits)
S_ATTR_PURE_INSTRUCTIONS = 0x80000000,
//S_ATTR_PURE_INSTRUCTIONS = 0x80000000,
S_ATTR_NO_TOC = 0x40000000,
S_ATTR_STRIP_STATIC_SYMS = 0x20000000,
S_ATTR_NO_DEAD_STRIP = 0x10000000,

View File

@ -142,7 +142,7 @@ void PackW64Pep::buildLoader(const Filter *ft)
"RELOC64J",
NULL
);
if (0)
if __acc_cte(0)
{
addLoader(big_relocs&6 ? "PERLOHI0" : "",
big_relocs&4 ? "PERELLO0" : "",

View File

@ -393,7 +393,7 @@ void PeFile32::processRelocs() // pass1
for (ic = 1; ic <= 3; ic++)
{
qsort(fix[ic], xcounts[ic], 4, le32_compare);
unsigned prev = ~0;
unsigned prev = ~0u;
unsigned jc = 0;
for (unsigned kc = 0; kc < xcounts[ic]; kc++)
if (fix[ic][kc] != prev)
@ -491,7 +491,7 @@ void PeFile64::processRelocs() // pass1
for (ic = 1; ic <= 15; ic++)
{
qsort(fix[ic], xcounts[ic], 4, le32_compare);
unsigned prev = ~0;
unsigned prev = ~0u;
unsigned jc = 0;
for (unsigned kc = 0; kc < xcounts[ic]; kc++)
if (fix[ic][kc] != prev)
@ -1341,7 +1341,7 @@ void PeFile::processTls2(Reloc *rel,const Interval *iv,unsigned newaddr,
return;
// add new relocation entries
if (tls_handler_offset_reloc > 0)
if __acc_cte(tls_handler_offset_reloc > 0)
rel->add(tls_handler_offset + tls_handler_offset_reloc, reloc_type);
unsigned ic;
@ -1808,7 +1808,7 @@ static bool match(unsigned itype, const unsigned char *ntype,
};
// FIXME this comparison is not too exact
while (1)
for (;;)
{
char const *delim1 = strchr(keep, '/');
char const *delim2 = strchr(keep, ',');