diff --git a/src/bele.h b/src/bele.h index cacfb78b..e78cce78 100644 --- a/src/bele.h +++ b/src/bele.h @@ -619,12 +619,12 @@ namespace N_BELE_RTP { namespace N_BELE_CTP { template -static inline const N_BELE_RTP::AbstractPolicy* getRTP(); +inline const N_BELE_RTP::AbstractPolicy* getRTP(); template <> -static inline const N_BELE_RTP::AbstractPolicy* getRTP() +inline const N_BELE_RTP::AbstractPolicy* getRTP() { return &N_BELE_RTP::be_policy; } template <> -static inline const N_BELE_RTP::AbstractPolicy* getRTP() +inline const N_BELE_RTP::AbstractPolicy* getRTP() { return &N_BELE_RTP::le_policy; } } diff --git a/src/compress_lzma.cpp b/src/compress_lzma.cpp index 6dcb6fe9..53982dea 100644 --- a/src/compress_lzma.cpp +++ b/src/compress_lzma.cpp @@ -169,6 +169,10 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outS } // namespace +#if (ACC_CC_INTELC) && defined(__linux__) +# pragma warning(disable: 424) // #424: extra ";" ignored +#endif + #include "C/Common/Alloc.cpp" #include "C/Common/CRC.cpp" //#include "C/7zip/Common/InBuffer.cpp" diff --git a/src/filter/ppcbxx.h b/src/filter/ppcbxx.h index a3052225..eab2144e 100644 --- a/src/filter/ppcbxx.h +++ b/src/filter/ppcbxx.h @@ -58,7 +58,7 @@ static int F(Filter *f) { unsigned char buf[256]; unsigned short wbuf[256]; - const size_t WW = (size_t)0 - (~(size_t)0) << W_CTO; // ??? + const size_t WW = (size_t)0 - ((~(size_t)0) << W_CTO); // ??? memset(wbuf, 0, sizeof(wbuf)); memset(buf , 0, WW); memset(buf + WW, 1, 256 - WW); diff --git a/src/linker.cpp b/src/linker.cpp index 83820c6e..57d17f42 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -414,7 +414,7 @@ int ElfLinker::addLoader(const char *sname) assert(tail); assert(tail != section); unsigned const v = ~0u << section->p2align; - if (unsigned const l = ~v & -(tail->offset + tail->size)) { + if (unsigned const l = ~v & (0u-(tail->offset + tail->size))) { alignCode(l); tail->size += l; } diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 67b80287..9dc35a7e 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -912,7 +912,7 @@ PackLinuxElf64amd::canPack() // The first PT_LOAD64 must cover the beginning of the file (0==p_offset). unsigned const e_phnum = get_native16(&ehdr->e_phnum); - Elf64_Phdr const *phdr = (Elf64_Phdr const *)(buf + e_phoff); + Elf64_Phdr const *phdr = (Elf64_Phdr const *)(buf + (unsigned) e_phoff); for (unsigned j=0; j < e_phnum; ++phdr, ++j) { if (j >= 14) return false; diff --git a/src/p_lx_exc.cpp b/src/p_lx_exc.cpp index bad4cedc..9c3e6730 100644 --- a/src/p_lx_exc.cpp +++ b/src/p_lx_exc.cpp @@ -204,7 +204,7 @@ PackLinuxI386::pack4(OutputFile *fo, Filter &ft) ((elfout.ehdr.e_phnum==3) ? (unsigned) elfout.phdr[2].p_memsz : 0) ; unsigned nw = fo->getBytesWritten(); elfout.phdr[0].p_filesz = nw; - nw = -(-elfout.phdr[0].p_align & -nw); // ALIGN_UP + nw = 0u-((0u-elfout.phdr[0].p_align) & (0u-nw)); // ALIGN_UP super::pack4(fo, ft); // write PackHeader and overlay_offset set_stub_brk(&elfout.phdr[1], nw + elfout.phdr[0].p_vaddr); diff --git a/src/p_mach.cpp b/src/p_mach.cpp index 0039dd1c..ec25e71e 100644 --- a/src/p_mach.cpp +++ b/src/p_mach.cpp @@ -195,8 +195,8 @@ PackMachPPC32::pack3(OutputFile *fo, Filter &ft) // append loader BE32 disp; unsigned const zero = 0; unsigned len = fo->getBytesWritten(); - fo->write(&zero, 3& -len); - len += (3& -len) + sizeof(disp); + fo->write(&zero, 3& (0u-len)); + len += (3& (0u-len)) + sizeof(disp); set_be32(&disp, 4+ len - sz_mach_headers); // 4: sizeof(instruction) fo->write(&disp, sizeof(disp)); diff --git a/src/p_ps1.cpp b/src/p_ps1.cpp index a5cb9132..df9041e4 100644 --- a/src/p_ps1.cpp +++ b/src/p_ps1.cpp @@ -53,7 +53,7 @@ static const #define K0_BS (0x80000000) #define K1_BS (0xa0000000) #define EXE_BS (ih.epc & K0_BS) -#define FIX_PSVR (K1_BS - EXE_BS) + (PS_HDR_SIZE - HD_CODE_OFS) +#define FIX_PSVR ((K1_BS - EXE_BS) + (PS_HDR_SIZE - HD_CODE_OFS)) // lui / addiu #define MIPS_HI(a) (((a) >> 16) + (((a) & 0x8000) >> 15)) @@ -152,7 +152,7 @@ bool PackPs1::readBkupHeader() } #define INIT_BH_BKUP(p, l) {(p)->id = '1'; (p)->len = l;} -#define ADLER16(a) ((a) >> 16 ^ ((a) & 0xffff)) +#define ADLER16(a) (((a) >> 16) ^ ((a) & 0xffff)) void PackPs1::putBkupHeader(const unsigned char *src, unsigned char *dst, unsigned *len) { @@ -390,7 +390,7 @@ void PackPs1::buildLoader(const Filter *) #define REG1(x) (((x) >> 5) & 0x1f) #define REG2(x) ((x) & 0x1f) -#define MIPS_IMM(a,b) (((a) - (((b) & 0x8000) >> 15) << 16) | (b)) +#define MIPS_IMM(a,b) ((((a) - (((b) & 0x8000) >> 15)) << 16) | (b)) // Type #define REGIMM 1 diff --git a/src/p_ps1.h b/src/p_ps1.h index d7e2a744..4de10f22 100644 --- a/src/p_ps1.h +++ b/src/p_ps1.h @@ -112,7 +112,7 @@ protected: } __attribute_packed; - typedef struct bss_nfo + struct bss_nfo { LE16 hi1, op1, lo1, op2; LE16 hi2, op3, lo2, op4; diff --git a/src/p_vmlinx.cpp b/src/p_vmlinx.cpp index 7fdc111e..aebffcf3 100644 --- a/src/p_vmlinx.cpp +++ b/src/p_vmlinx.cpp @@ -80,7 +80,7 @@ int PackVmlinuxBase::getStrategy(Filter &/*ft*/) // If user specified the filter, then use it (-2==strategy). // Else try the first two filters, and pick the better (2==strategy). return (opt->no_filter ? -3 : ((opt->filter > 0) ? -2 : 2)); -}; +} template int __acc_cdecl_qsort @@ -251,7 +251,7 @@ void PackVmlinuxBase::pack(OutputFile *fo) for (unsigned j = 0; j < ehdri.e_phnum; ++j) { if (Phdr::PT_LOAD==phdri[j].p_type) { fi->seek(phdri[j].p_offset, SEEK_SET); - fi->readx(ibuf + (phdri[j].p_paddr - paddr_min), phdri[j].p_filesz); + fi->readx(ibuf + ((unsigned) phdri[j].p_paddr - paddr_min), phdri[j].p_filesz); } } checkAlreadyPacked(ibuf + ph.u_len - 1024, 1024); @@ -291,7 +291,7 @@ void PackVmlinuxBase::pack(OutputFile *fo) fo_off += write_vmlinux_head(fo, &shdro[1]); fo->write(obuf, txt_c_len); fo_off += txt_c_len; - unsigned const a = (shdro[1].sh_addralign -1) & -txt_c_len; + unsigned const a = (shdro[1].sh_addralign -1) & (0u-txt_c_len); if (0!=a) { // align fo_off += a; shdro[1].sh_size += a; @@ -756,7 +756,7 @@ unsigned PackVmlinuxARM::write_vmlinux_head( U32 tmp_u32; unsigned const t = (0xff000000 & BeLePolicy::get32(&stub_arm_linux_kernel_vmlinux_head[4])) - | (0x00ffffff & (-1+ ((3+ ph.c_len)>>2))); + | (0x00ffffff & (0u - 1 + ((3+ ph.c_len)>>2))); tmp_u32 = t; fo->write(&tmp_u32, 4); @@ -775,7 +775,7 @@ bool PackVmlinuxARM::has_valid_vmlinux_head() //unsigned const word0 = buf[0]; unsigned const word1 = buf[1]; if (0xeb==(word1>>24) - && (0x00ffffff& word1)==(-1+ ((3+ ph.c_len)>>2))) { + && (0x00ffffff& word1)==(0u - 1 + ((3+ ph.c_len)>>2))) { return true; } return false; diff --git a/src/p_vxd.h b/src/p_vxd.h index a4e887fd..58a20254 100644 --- a/src/p_vxd.h +++ b/src/p_vxd.h @@ -59,7 +59,7 @@ protected: virtual void encodeFixups(); virtual void decodeFixups(); - virtual void encodeImage(const Filter *ft); + virtual void encodeImage(Filter *ft); virtual void decodeImage(); }; diff --git a/src/p_w32pe.h b/src/p_w32pe.h index 87742b0c..6ec3b8fb 100644 --- a/src/p_w32pe.h +++ b/src/p_w32pe.h @@ -35,7 +35,7 @@ class PackW32Pe : public PeFile { - typedef PeFile super;; + typedef PeFile super; public: PackW32Pe(InputFile *f); diff --git a/src/packer.cpp b/src/packer.cpp index 80ef348d..a854ca80 100644 --- a/src/packer.cpp +++ b/src/packer.cpp @@ -1055,15 +1055,22 @@ void Packer::initLoader(const void *pdata, int plen, int small) linker->addSection("IDENTSTR", ident, size, 0); } +#if 1 && (ACC_CC_BORLANDC) +#else void Packer::addLoader(const char *s) { if (s) linker->addLoader(s); } +#endif -// provide specialization for [T = char] +#if 1 && (ACC_CC_BORLANDC) +void __acc_cdecl_va Packer::addLoader(const char *s, ...) +#else +// provide specialization for [T = const char *] template <> void __acc_cdecl_va Packer::addLoader(const char *s, ...) +#endif { va_list ap; diff --git a/src/packer.h b/src/packer.h index 7d6ba9c0..c6609bb5 100644 --- a/src/packer.h +++ b/src/packer.h @@ -226,10 +226,13 @@ protected: virtual upx_byte *getLoader() const; virtual int getLoaderSize() const; virtual void initLoader(const void *pdata, int plen, int small=-1); +#if 1 && (ACC_CC_BORLANDC) + void __acc_cdecl_va addLoader(const char *, ...); +#elif 1 && (ACC_CC_GNUC >= 0x040100) void addLoader(const char *); -#if 1 && (ACC_CC_GNUC >= 0x040100) template void __acc_cdecl_va addLoader(const T *, ...) __attribute__((__sentinel__)); #else + void addLoader(const char *); template void __acc_cdecl_va addLoader(const T *, ...); #endif virtual int getLoaderSection(const char *name, int *slen=NULL) const; @@ -306,8 +309,11 @@ private: }; +#if 1 && (ACC_CC_BORLANDC) +#else template <> -void __acc_cdecl_va Packer::addLoader(const char *s, ...); +void __acc_cdecl_va Packer::addLoader(const char *, ...); +#endif #endif /* already included */ diff --git a/src/util.cpp b/src/util.cpp index 81f0c667..aa5bdc84 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -582,6 +582,11 @@ extern "C" { int dup(int fd) { UNUSED(fd); return -1; } #endif +// FIXME - quick hack for wrt54gl +#if 1 && (ACC_ARCH_MIPS) && (ACC_OS_POSIX_LINUX) && (ACC_LIBC_UCLIBC) +clock_t clock(void) { return 0; } +#endif + #if defined(__DJGPP__) int _is_executable(const char *, int, const char *) {