This commit is contained in:
John Reiser
2010-03-31 14:15:18 -07:00
5 changed files with 18 additions and 16 deletions
+1
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
+4 -2
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()
+4 -5
View File
@@ -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()) {
+1 -1
View File
@@ -1402,7 +1402,7 @@ void PeFile::processResources(Resource *res)
keep_icons = new char[1 + iconsin1stdir * 9]; keep_icons = new char[1 + iconsin1stdir * 9];
*keep_icons = 0; *keep_icons = 0;
for (unsigned ic = 0; ic < iconsin1stdir; ic++) for (unsigned ic = 0; ic < iconsin1stdir; ic++)
snprintf(keep_icons + strlen(keep_icons), 9, "3/%u,", upx_snprintf(keep_icons + strlen(keep_icons), 9, "3/%u,",
get_le16(ibuf + res->offs() + 6 + ic * 14 + 12)); get_le16(ibuf + res->offs() + 6 + ic * 14 + 12));
if (*keep_icons) if (*keep_icons)
keep_icons[strlen(keep_icons) - 1] = 0; keep_icons[strlen(keep_icons) - 1] = 0;