Silence some compiler warnings.

This commit is contained in:
Markus F.X.J. Oberhumer 2020-01-08 04:49:27 +01:00
parent 95bf2e2e41
commit 92f072cf70
3 changed files with 8 additions and 8 deletions

View File

@ -42,6 +42,9 @@
#include "p_lx_elf.h" #include "p_lx_elf.h"
#include "ui.h" #include "ui.h"
typedef upx_uint32_t u32_t; // easier to type; more narrow
typedef upx_uint64_t u64_t; // easier to type; more narrow
#define PT_LOAD32 Elf32_Phdr::PT_LOAD #define PT_LOAD32 Elf32_Phdr::PT_LOAD
#define PT_LOAD64 Elf64_Phdr::PT_LOAD #define PT_LOAD64 Elf64_Phdr::PT_LOAD
#define PT_NOTE32 Elf32_Phdr::PT_NOTE #define PT_NOTE32 Elf32_Phdr::PT_NOTE
@ -4952,7 +4955,7 @@ PackLinuxElf32::elf_find_dynamic(unsigned int key) const
for (; (unsigned)((char const *)dynp - (char const *)dynseg) < sz_dynseg for (; (unsigned)((char const *)dynp - (char const *)dynseg) < sz_dynseg
&& Elf32_Dyn::DT_NULL!=dynp->d_tag; ++dynp) if (get_te32(&dynp->d_tag)==key) { && Elf32_Dyn::DT_NULL!=dynp->d_tag; ++dynp) if (get_te32(&dynp->d_tag)==key) {
unsigned const t= elf_get_offset_from_address(get_te32(&dynp->d_val)); unsigned const t= elf_get_offset_from_address(get_te32(&dynp->d_val));
if (t && t < file_size) { if (t && t < (unsigned)file_size) {
return t + file_image; return t + file_image;
} }
break; break;

View File

@ -33,9 +33,6 @@
#ifndef __UPX_P_LX_ELF_H //{ #ifndef __UPX_P_LX_ELF_H //{
#define __UPX_P_LX_ELF_H 1 #define __UPX_P_LX_ELF_H 1
typedef upx_uint32_t u32_t; // easier to type; more narrow
typedef upx_uint64_t u64_t; // easier to type; more narrow
class PackLinuxElf : public PackUnix class PackLinuxElf : public PackUnix
{ {
typedef PackUnix super; typedef PackUnix super;

View File

@ -1542,8 +1542,8 @@ int PackMachBase<T>::canUnpack()
ptr = (Mach_command const *)(ptr->cmdsize + (char const *)ptr), ++j) { ptr = (Mach_command const *)(ptr->cmdsize + (char const *)ptr), ++j) {
if ((unsigned)headway < ptr->cmdsize) { if ((unsigned)headway < ptr->cmdsize) {
infoWarning("bad Mach_command[%u]{@0x%lx,+0x%x}: file_size=0x%lx cmdsize=0x%lx", infoWarning("bad Mach_command[%u]{@0x%lx,+0x%x}: file_size=0x%lx cmdsize=0x%lx",
j, sizeof(mhdri) + ((char const *)ptr - (char const *)rawmseg), headway, j, (unsigned long) (sizeof(mhdri) + ((char const *)ptr - (char const *)rawmseg)), headway,
file_size, (unsigned long)ptr->cmdsize); (unsigned long) file_size, (unsigned long)ptr->cmdsize);
throwCantUnpack("file corrupted"); throwCantUnpack("file corrupted");
} }
if (lc_seg == ptr->cmd) { if (lc_seg == ptr->cmd) {
@ -1553,8 +1553,8 @@ int PackMachBase<T>::canUnpack()
|| (unsigned long)file_size < (segptr->filesize + segptr->fileoff)) { || (unsigned long)file_size < (segptr->filesize + segptr->fileoff)) {
infoWarning("bad Mach_segment_command[%u]{@0x%lx,+0x%x}: file_size=0x%lx cmdsize=0x%lx" infoWarning("bad Mach_segment_command[%u]{@0x%lx,+0x%x}: file_size=0x%lx cmdsize=0x%lx"
" filesize=0x%lx fileoff=0x%lx", " filesize=0x%lx fileoff=0x%lx",
j, sizeof(mhdri) + ((char const *)ptr - (char const *)rawmseg), headway, j, (unsigned long) (sizeof(mhdri) + ((char const *)ptr - (char const *)rawmseg)), headway,
file_size, (unsigned long)ptr->cmdsize, (unsigned long) file_size, (unsigned long)ptr->cmdsize,
(unsigned long)segptr->filesize, (unsigned long)segptr->fileoff); (unsigned long)segptr->filesize, (unsigned long)segptr->fileoff);
throwCantUnpack("file corrupted"); throwCantUnpack("file corrupted");
} }