From abc71baaa6b0ab7cfed9e0466a74f4de341d79a2 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sun, 8 Jul 2007 11:42:45 +0200 Subject: [PATCH] Avoid some warnings. --- src/Makefile | 3 ++- src/p_armpe.cpp | 2 ++ src/p_ps1.cpp | 8 ++++++-- src/p_w32pe.cpp | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index acb60db9..0c544c10 100644 --- a/src/Makefile +++ b/src/Makefile @@ -89,7 +89,8 @@ compress_lzma$(objext) : CXXFLAGS += -Wno-cast-qual compress_lzma$(objext) : CXXFLAGS += -Wno-non-virtual-dtor compress_lzma$(objext) : CXXFLAGS += -Wno-shadow compress_lzma$(objext) : CXXFLAGS += -Wno-unused -##compress_lzma$(objext) : CXXFLAGS += -Wno-error +# needed for gcc-4.3: +compress_lzma$(objext) : CXXFLAGS += -Wno-error endif diff --git a/src/p_armpe.cpp b/src/p_armpe.cpp index d2cd8b6f..21904631 100644 --- a/src/p_armpe.cpp +++ b/src/p_armpe.cpp @@ -542,10 +542,12 @@ void PackArmPe::pack(OutputFile *fo) else if (opt->win32_pe.strip_relocs < 0) opt->win32_pe.strip_relocs = (ih.imagebase >= 0x10000); if (opt->win32_pe.strip_relocs) + { if (ih.imagebase < 0x10000) throwCantPack("--strip-relocs is not allowed when imagebase < 0x10000"); else ih.flags |= RELOCS_STRIPPED; + } if (memcmp(isection[0].name,"UPX",3) == 0) throwAlreadyPackedByUPX(); diff --git a/src/p_ps1.cpp b/src/p_ps1.cpp index 09969ee2..22d8a459 100644 --- a/src/p_ps1.cpp +++ b/src/p_ps1.cpp @@ -256,8 +256,9 @@ bool PackPs1::canPack() fi->readx(buf, sizeof(buf)); checkAlreadyPacked(buf, sizeof(buf)); - for (unsigned i = 0; i < sizeof(buf); i++) + for (size_t i = 0; i < sizeof(buf); i++) if (buf[i] != 0) + { if (!opt->force) throwCantPack("unknown data in header (try --force)"); else @@ -267,6 +268,7 @@ bool PackPs1::canPack() opt->backup = 1; break; } + } if (!checkFileHeader()) throwCantPack("unsupported header flags (try --force)"); if (!opt->force && file_size < PS_MIN_SIZE) @@ -320,7 +322,7 @@ void PackPs1::buildLoader(const Filter *) sa_tmp += overlap = ALIGN_UP((ph.overlap_overhead - sa_tmp), 4u); } - if (isCon || !isCon && M_IS_LZMA(ph.method)) + if (isCon || M_IS_LZMA(ph.method)) foundBss = findBssSection(); if (M_IS_LZMA(ph.method) && !buildPart2) @@ -574,11 +576,13 @@ void PackPs1::pack(OutputFile *fo) linker->defineSymbol("ldr_sz", M_IS_LZMA(ph.method) ? sz_lunc + 16 : (d_len-pad_code)); if (foundBss) + { if (M_IS_LZMA(ph.method)) linker->defineSymbol("wrkmem", bss_end - 160 - getDecompressorWrkmemSize() - (sz_lunc + 16)); else linker->defineSymbol("wrkmem", bss_end - 16 - (d_len - pad_code)); + } const unsigned entry = comp_data_start - e_len; diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index 331a1730..d443f140 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -629,10 +629,12 @@ void PackW32Pe::pack(OutputFile *fo) else if (opt->win32_pe.strip_relocs < 0) opt->win32_pe.strip_relocs = (ih.imagebase >= 0x400000); if (opt->win32_pe.strip_relocs) + { if (ih.imagebase < 0x400000) throwCantPack("--strip-relocs is not allowed when imagebase < 0x400000"); else ih.flags |= RELOCS_STRIPPED; + } if (memcmp(isection[0].name,"UPX",3) == 0) throwAlreadyPackedByUPX();