From 0aff9d8df4e2fa75d2fc4d45bfaec72f9a07b480 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sun, 8 Aug 2010 16:20:16 +0200 Subject: [PATCH] Use consistent syntax for boolean preprocessor expressions. --- src/bele.h | 4 +-- src/bele_policy.h | 2 +- src/bptr.h | 2 +- src/c_file.cpp | 2 +- src/c_init.cpp | 8 ++--- src/c_none.cpp | 2 +- src/c_screen.cpp | 10 +++--- src/compress.cpp | 24 +++++++------- src/compress.h | 11 ++++--- src/compress_lzma.cpp | 12 +++---- src/compress_ucl.cpp | 12 +++---- src/compress_zlib.cpp | 2 +- src/conf.h | 27 +++++++--------- src/console.h | 38 +++++++++++------------ src/except.h | 4 +-- src/file.cpp | 2 +- src/file.h | 2 +- src/filter.h | 2 +- src/help.cpp | 18 +++++------ src/lefile.h | 2 +- src/linker.h | 2 +- src/main.cpp | 10 +++--- src/mem.cpp | 2 +- src/mem.h | 2 +- src/options.h | 2 +- src/p_armpe.h | 3 +- src/p_com.cpp | 2 +- src/p_com.h | 2 +- src/p_djgpp2.h | 2 +- src/p_elf.h | 2 +- src/p_exe.cpp | 4 +-- src/p_exe.h | 2 +- src/p_lx_elf.h | 2 +- src/p_lx_exc.h | 2 +- src/p_lx_interp.h | 2 +- src/p_lx_sh.h | 2 +- src/p_mach.h | 12 +++---- src/p_ps1.h | 2 +- src/p_sys.h | 2 +- src/p_tmt.h | 2 +- src/p_tos.cpp | 8 ++--- src/p_tos.h | 2 +- src/p_unix.h | 2 +- src/p_vmlinx.h | 2 +- src/p_vmlinz.h | 2 +- src/p_vxd.h | 2 +- src/p_w16ne.h | 2 +- src/p_w32pe.h | 3 +- src/p_wcle.h | 2 +- src/packer.cpp | 8 ++--- src/packer.h | 2 +- src/packer_c.cpp | 2 +- src/packmast.h | 2 +- src/pefile.h | 2 +- src/s_djgpp2.cpp | 16 +++++----- src/s_object.cpp | 4 +-- src/s_vcsa.cpp | 16 +++++----- src/s_win32.cpp | 8 ++--- src/screen.h | 18 +++++------ src/snprintf.cpp | 12 +++---- src/snprintf.h | 2 +- src/stdcxx.cpp | 2 +- src/stdcxx.h | 10 +++--- src/stub/scripts/UNUSED/bin2h.pl | 2 +- src/stub/scripts/bin2h.py | 2 +- src/stub/src/amd64-darwin.macho-main.c | 2 +- src/stub/src/amd64-linux.elf-main.c | 2 +- src/stub/src/arch/i086/lzma_d.S | 2 +- src/stub/src/arch/mips/r3000/bits.ash | 2 +- src/stub/src/arch/mips/r3000/macros.ash | 4 +-- src/stub/src/arch/powerpc/32/ppc_regs.h | 2 +- src/stub/src/arch/powerpc/32/regs.h | 2 +- src/stub/src/arm-darwin.macho-main.c | 2 +- src/stub/src/arm.v4a-wince.pe.S | 10 +++--- src/stub/src/i386-bsd.elf-main.c | 2 +- src/stub/src/i386-bsd.elf.execve-main.c | 14 ++++----- src/stub/src/i386-darwin.macho-main.c | 2 +- src/stub/src/i386-linux.elf-main.c | 2 +- src/stub/src/i386-linux.elf.execve-main.c | 14 ++++----- src/stub/src/i386-linux.elf.interp-main.c | 2 +- src/stub/src/i386-linux.elf.shell-main.c | 2 +- src/stub/src/i386-openbsd.elf-main.c | 2 +- src/stub/src/include/bsd.h | 2 +- src/stub/src/include/darwin.h | 2 +- src/stub/src/include/linux.h | 2 +- src/stub/src/powerpc-darwin.macho-main.c | 2 +- src/stub/src/powerpc-linux.elf-main.c | 2 +- src/ui.cpp | 12 +++---- src/ui.h | 2 +- src/util.cpp | 8 ++--- src/util.h | 2 +- src/work.cpp | 22 ++++++------- 92 files changed, 251 insertions(+), 253 deletions(-) diff --git a/src/bele.h b/src/bele.h index f4a9b922..2719be83 100644 --- a/src/bele.h +++ b/src/bele.h @@ -27,7 +27,7 @@ #ifndef __UPX_BELE_H -#define __UPX_BELE_H +#define __UPX_BELE_H 1 /************************************************************************* @@ -543,7 +543,7 @@ int __acc_cdecl_qsort le64_compare_signed(const void *, const void *); // just for testing... -#if !defined(ACC_CFG_NO_UNALIGNED) +#if !(ACC_CFG_NO_UNALIGNED) #if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x030200) typedef acc_uint16e_t LE16_unaligned __attribute__((__aligned__(1))); typedef acc_uint32e_t LE32_unaligned __attribute__((__aligned__(1))); diff --git a/src/bele_policy.h b/src/bele_policy.h index 09772723..28223ec4 100644 --- a/src/bele_policy.h +++ b/src/bele_policy.h @@ -39,7 +39,7 @@ // CTP - Compile-Time Polymorphism (templates) # define V static inline # define S static int __acc_cdecl_qsort -# define C +# define C /*empty*/ #elif defined(BELE_RTP) // RTP - Run-Time Polymorphism (virtual functions) # define V virtual diff --git a/src/bptr.h b/src/bptr.h index 6039b2ce..61d0bf46 100644 --- a/src/bptr.h +++ b/src/bptr.h @@ -27,7 +27,7 @@ #ifndef __UPX_BPTR_H -#define __UPX_BPTR_H +#define __UPX_BPTR_H 1 /************************************************************************* diff --git a/src/c_file.cpp b/src/c_file.cpp index db79ca13..335f89a6 100644 --- a/src/c_file.cpp +++ b/src/c_file.cpp @@ -28,7 +28,7 @@ #include "conf.h" -#if defined(USE_CONSOLE) +#if (USE_CONSOLE) /************************************************************************* // diff --git a/src/c_init.cpp b/src/c_init.cpp index 9f230323..96b166d8 100644 --- a/src/c_init.cpp +++ b/src/c_init.cpp @@ -30,7 +30,7 @@ FILE *con_term = NULL; -#if defined(USE_CONSOLE) +#if (USE_CONSOLE) /************************************************************************* // @@ -84,14 +84,14 @@ static int do_init(FILE *f) if (!acc_isatty(STDIN_FILENO) || !acc_isatty(STDOUT_FILENO) || !acc_isatty(STDERR_FILENO)) return con_mode; -#if defined(USE_ANSI) +#if (USE_ANSI) try_init(&console_ansi_mono,f); try_init(&console_ansi_color,f); #endif -#if defined(USE_SCREEN) +#if (USE_SCREEN) try_init(&console_screen,f); #endif -#if defined(USE_AALIB) +#if (USE_AALIB) try_init(&console_aalib,f); #endif diff --git a/src/c_none.cpp b/src/c_none.cpp index e4f475a9..1df17833 100644 --- a/src/c_none.cpp +++ b/src/c_none.cpp @@ -28,7 +28,7 @@ #include "conf.h" -#if defined(USE_CONSOLE) +#if (USE_CONSOLE) /************************************************************************* // diff --git a/src/c_screen.cpp b/src/c_screen.cpp index c159838b..1cbfb845 100644 --- a/src/c_screen.cpp +++ b/src/c_screen.cpp @@ -28,7 +28,7 @@ #include "conf.h" -#if defined(USE_SCREEN) +#if (USE_SCREEN) #include "screen.h" @@ -130,15 +130,15 @@ static int init(FILE *f, int o, int now) if (!screen) screen = do_construct(screen_djgpp2_construct(),fd); #endif -#if defined(USE_SCREEN_WIN32) +#if (USE_SCREEN_WIN32) if (!screen) screen = do_construct(screen_win32_construct(),fd); #endif -#if defined(USE_SCREEN_VCSA) +#if (USE_SCREEN_VCSA) if (!screen) screen = do_construct(screen_vcsa_construct(),fd); #endif -#if defined(USE_SCREEN_CURSES) +#if (USE_SCREEN_CURSES) if (!screen && o == CON_SCREEN) screen = do_construct(screen_curses_construct(),fd); #endif @@ -298,7 +298,7 @@ static void print0(FILE *f, const char *ss) static bool intro(FILE *f) { UNUSED(f); -#if defined(USE_FRAMES) +#if (USE_FRAMES) if (screen->intro) return screen->intro(screen,screen_show_frames); #endif diff --git a/src/compress.cpp b/src/compress.cpp index a9cb9319..713da721 100644 --- a/src/compress.cpp +++ b/src/compress.cpp @@ -43,7 +43,7 @@ unsigned upx_adler32(const void *buf, unsigned len, unsigned adler) assert(buf != NULL); #if 0 return adler32(adler, (const Bytef *) buf, len); // zlib -#elif defined(WITH_UCL) +#elif (WITH_UCL) return ucl_adler32(adler, (const ucl_bytep) buf, len); #else # error @@ -59,7 +59,7 @@ unsigned upx_crc32(const void *buf, unsigned len, unsigned crc) assert(buf != NULL); #if 0 return crc32(crc, (const Bytef *) buf, len); // zlib -#elif defined(WITH_UCL) +#elif (WITH_UCL) return ucl_crc32(crc, (const ucl_bytep) buf, len); #else # error @@ -108,17 +108,17 @@ int upx_compress ( const upx_bytep src, unsigned src_len, if (0) { } -#if defined(WITH_LZMA) +#if (WITH_LZMA) else if (M_IS_LZMA(method)) r = upx_lzma_compress(src, src_len, dst, dst_len, cb, method, level, cconf, cresult); #endif -#if defined(WITH_NRV) +#if (WITH_NRV) else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) r = upx_nrv_compress(src, src_len, dst, dst_len, cb, method, level, cconf, cresult); #endif -#if defined(WITH_UCL) +#if (WITH_UCL) else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) r = upx_ucl_compress(src, src_len, dst, dst_len, cb, method, level, cconf, cresult); @@ -154,19 +154,19 @@ int upx_decompress ( const upx_bytep src, unsigned src_len, if (0) { } -#if defined(WITH_LZMA) +#if (WITH_LZMA) else if (M_IS_LZMA(method)) r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult); #endif -#if defined(WITH_NRV) +#if (WITH_NRV) else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult); #endif -#if defined(WITH_UCL) +#if (WITH_UCL) else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) r = upx_ucl_decompress(src, src_len, dst, dst_len, method, cresult); #endif -#if defined(WITH_ZLIB) +#if (WITH_ZLIB) else if (M_IS_DEFLATE(method)) r = upx_zlib_decompress(src, src_len, dst, dst_len, method, cresult); #endif @@ -201,15 +201,15 @@ int upx_test_overlap ( const upx_bytep buf, if (0) { } -#if defined(WITH_LZMA) +#if (WITH_LZMA) else if (M_IS_LZMA(method)) r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult); #endif -#if defined(WITH_NRV) +#if (WITH_NRV) else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult); #endif -#if defined(WITH_UCL) +#if (WITH_UCL) else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) r = upx_ucl_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult); #endif diff --git a/src/compress.h b/src/compress.h index b2ed214f..1cb7cba0 100644 --- a/src/compress.h +++ b/src/compress.h @@ -27,14 +27,14 @@ #ifndef __UPX_COMPRESS_H -#define __UPX_COMPRESS_H +#define __UPX_COMPRESS_H 1 /************************************************************************* // **************************************************************************/ -#if defined(WITH_LZMA) +#if (WITH_LZMA) const char *upx_lzma_version_string(void); int upx_lzma_compress ( const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned* dst_len, @@ -55,7 +55,7 @@ int upx_lzma_test_overlap ( const upx_bytep buf, #endif -#if defined(WITH_NRV) +#if (WITH_NRV) const char *upx_nrv_version_string(void); int upx_nrv_compress ( const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned* dst_len, @@ -76,7 +76,7 @@ int upx_nrv_test_overlap ( const upx_bytep buf, #endif -#if defined(WITH_UCL) +#if (WITH_UCL) const char *upx_ucl_version_string(void); int upx_ucl_compress ( const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned* dst_len, @@ -96,7 +96,8 @@ int upx_ucl_test_overlap ( const upx_bytep buf, const upx_compress_result_t *cresult ); #endif -#if defined(WITH_ZLIB) + +#if (WITH_ZLIB) const char *upx_zlib_version_string(void); int upx_zlib_compress ( const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned* dst_len, diff --git a/src/compress_lzma.cpp b/src/compress_lzma.cpp index 21782527..688a5ded 100644 --- a/src/compress_lzma.cpp +++ b/src/compress_lzma.cpp @@ -47,7 +47,7 @@ void lzma_compress_config_t::reset() } -#if !defined(WITH_LZMA) +#if !(WITH_LZMA) extern int compress_lzma_dummy; int compress_lzma_dummy = 0; #else @@ -291,7 +291,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len, unsigned char props_buf[LZMA_PROPS_SIZE]; SizeT props_buf_size; props_buf_size = LZMA_PROPS_SIZE; -#if defined(USE_LZMA_PROPERTIES) +#if (USE_LZMA_PROPERTIES) if (dst_avail < 1) goto error; dst[0] = 0; // filled below @@ -312,7 +312,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len, assert(x_len <= dst_avail); *dst_len += x_len; if (rh == SZ_OK) { -#if defined(USE_LZMA_PROPERTIES) +#if (USE_LZMA_PROPERTIES) dst[-1] = props_buf[0]; #endif r = UPX_E_OK; @@ -513,7 +513,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len, goto error; } assert(os.b_pos == 5); -#if defined(USE_LZMA_PROPERTIES) +#if (USE_LZMA_PROPERTIES) os.b_pos = 1; #else os.b_pos = 0; @@ -586,7 +586,7 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len, SRes rh; ELzmaStatus status; -#if defined(USE_LZMA_PROPERTIES) +#if (USE_LZMA_PROPERTIES) rh = LzmaProps_Decode(&s.Properties, src, src_len); if (rh != 0) goto error; @@ -684,7 +684,7 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len, int r = UPX_E_ERROR; int rh; -#if defined(USE_LZMA_PROPERTIES) +#if (USE_LZMA_PROPERTIES) if (src_len < 2) goto error; rh = LzmaDecodeProperties(&s.Properties, src, src_len); diff --git a/src/compress_ucl.cpp b/src/compress_ucl.cpp index 4ee5993c..fadba7fd 100644 --- a/src/compress_ucl.cpp +++ b/src/compress_ucl.cpp @@ -28,23 +28,23 @@ #include "conf.h" #include "compress.h" -#if !defined(WITH_UCL) +#if !(WITH_UCL) extern int compress_ucl_dummy; int compress_ucl_dummy = 0; #else -#if 1 && !defined(UCL_USE_ASM) && (ACC_ARCH_I386) +#if 1 && !(UCL_USE_ASM) && (ACC_ARCH_I386) # if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC) -# define UCL_USE_ASM +# define UCL_USE_ASM 1 # endif #endif -#if defined(UCL_NO_ASM) +#if (UCL_NO_ASM) # undef UCL_USE_ASM #endif -#if defined(ACC_CFG_NO_UNALIGNED) +#if (ACC_CFG_NO_UNALIGNED) # undef UCL_USE_ASM #endif -#if 1 && defined(UCL_USE_ASM) +#if 1 && (UCL_USE_ASM) # include # define ucl_nrv2b_decompress_safe_8 ucl_nrv2b_decompress_asm_safe_8 # define ucl_nrv2b_decompress_safe_le16 ucl_nrv2b_decompress_asm_safe_le16 diff --git a/src/compress_zlib.cpp b/src/compress_zlib.cpp index 4651a10f..4a6144db 100644 --- a/src/compress_zlib.cpp +++ b/src/compress_zlib.cpp @@ -41,7 +41,7 @@ void zlib_compress_config_t::reset() } -#if !defined(WITH_ZLIB) +#if !(WITH_ZLIB) extern int compress_zlib_dummy; int compress_zlib_dummy = 0; #else diff --git a/src/conf.h b/src/conf.h index 30294cfe..963576db 100644 --- a/src/conf.h +++ b/src/conf.h @@ -27,7 +27,7 @@ #ifndef __UPX_CONF_H -#define __UPX_CONF_H +#define __UPX_CONF_H 1 #include "version.h" @@ -167,10 +167,10 @@ #undef linux #undef small #undef tos -#if defined(ACC_CC_DMC) +#if (ACC_CC_DMC) # undef tell #endif -#if !defined(ACC_CC_PGI) +#if !(ACC_CC_PGI) # undef unix #endif #if defined(__DJGPP__) @@ -189,14 +189,14 @@ # undef WITH_LZMA #endif #if defined(UPX_OFFICIAL_BUILD) -# if !defined(WITH_LZMA) || !defined(WITH_NRV) || !defined(WITH_UCL) +# if !(WITH_LZMA) || !(WITH_NRV) || !(WITH_UCL) # error # endif #endif -#if defined(WITH_NRV) +#if (WITH_NRV) # include #endif -#if defined(WITH_UCL) +#if (WITH_UCL) # define ucl_compress_config_t REAL_ucl_compress_config_t # include # include @@ -206,11 +206,6 @@ # undef ucl_compress_config_t # undef ucl_compress_config_p #endif -#if !defined(__UPX_CHECKER) -# if defined(__UCL_CHECKER) || defined(__NRV_CHECKER) -# define __UPX_CHECKER -# endif -#endif #if !defined(UINT_MAX) || (UINT_MAX < 0xffffffffL) # error "UINT_MAX" #endif @@ -224,7 +219,7 @@ **************************************************************************/ // malloc debuggers -#if defined(WITH_VALGRIND) +#if (WITH_VALGRIND) # include #endif @@ -263,11 +258,11 @@ #endif -#if !defined(HAVE_STRCASECMP) && defined(HAVE_STRICMP) -# define strcasecmp stricmp +#if !(HAVE_STRCASECMP) && (HAVE_STRICMP) +# define strcasecmp stricmp #endif -#if !defined(HAVE_STRNCASECMP) && defined(HAVE_STRNICMP) -# define strncasecmp strnicmp +#if !(HAVE_STRNCASECMP) && (HAVE_STRNICMP) +# define strncasecmp strnicmp #endif diff --git a/src/console.h b/src/console.h index 25f8d22d..6ce8dbe3 100644 --- a/src/console.h +++ b/src/console.h @@ -39,41 +39,41 @@ #undef USE_SCREEN_WIN32 #undef USE_FRAMES -#if defined(WITH_GUI) && !defined(NO_CONSOLE) -# define NO_CONSOLE +#if 1 && (WITH_GUI) && !defined(NO_CONSOLE) +# define NO_CONSOLE 1 #endif #if 1 && defined(__linux__) -# define USE_SCREEN -# define USE_SCREEN_VCSA -# if !defined(HAVE_LINUX_KD_H) +# define USE_SCREEN 1 +# define USE_SCREEN_VCSA 1 +# if !(HAVE_LINUX_KD_H) # undef USE_SCREEN # undef USE_SCREEN_VCSA # endif -# if !defined(HAVE_LINUX_KDEV_T_H) || !defined(HAVE_LINUX_MAJOR_H) +# if !(HAVE_LINUX_KDEV_T_H) || !(HAVE_LINUX_MAJOR_H) # undef USE_SCREEN # undef USE_SCREEN_VCSA # endif #endif #if 1 && defined(__DJGPP__) -# define USE_SCREEN +# define USE_SCREEN 1 #elif 1 && (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64) -# define USE_SCREEN -# define USE_SCREEN_WIN32 +# define USE_SCREEN 1 +# define USE_SCREEN_WIN32 1 #elif 1 && (ACC_OS_EMX && defined(__RSXNT__)) -# define USE_SCREEN -# define USE_SCREEN_WIN32 +# define USE_SCREEN 1 +# define USE_SCREEN_WIN32 1 #endif -#if 0 || defined(NO_ANSI) +#if 0 || (NO_ANSI) # undef USE_ANSI #endif -#if 0 || defined(NO_SCREEN) +#if 0 || (NO_SCREEN) # undef USE_SCREEN #endif -#if 0 || defined(NO_FRAMES) || !defined(USE_SCREEN) +#if 0 || (NO_FRAMES) || !(USE_SCREEN) # undef USE_FRAMES #endif #if 1 @@ -81,11 +81,11 @@ #endif -#if 0 || defined(USE_ANSI) || defined(USE_SCREEN) -# define USE_CONSOLE +#if 0 || (USE_ANSI) || (USE_SCREEN) +# define USE_CONSOLE 1 #endif -#if 0 || defined(NO_CONSOLE) || !defined(USE_CONSOLE) +#if 0 || (NO_CONSOLE) || !(USE_CONSOLE) # undef USE_CONSOLE # undef USE_ANSI # undef USE_SCREEN @@ -110,7 +110,7 @@ enum { }; -#if defined(USE_CONSOLE) +#if (USE_CONSOLE) typedef struct { @@ -165,7 +165,7 @@ void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...); extern FILE *con_term; -#if defined(USE_CONSOLE) +#if (USE_CONSOLE) extern int con_mode; extern console_t *con; diff --git a/src/except.h b/src/except.h index cecb055d..f3806bb7 100644 --- a/src/except.h +++ b/src/except.h @@ -27,7 +27,7 @@ #ifndef __UPX_EXCEPT_H -#define __UPX_EXCEPT_H +#define __UPX_EXCEPT_H 1 #ifdef __cplusplus @@ -204,7 +204,7 @@ public: // (noreturn) is probably not the correct semantics for throwing exceptions #define NORET __attribute__((__noreturn__)) #else -#define NORET +#define NORET /*empty*/ #endif void throwCantPack(const char *msg) NORET; diff --git a/src/file.cpp b/src/file.cpp index 8d04f0af..aff42bf1 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -37,7 +37,7 @@ void File::chmod(const char *name, int mode) { -#if defined(HAVE_CHMOD) +#if (HAVE_CHMOD) if (::chmod(name,mode) != 0) throwIOException(name,errno); #else diff --git a/src/file.h b/src/file.h index e55d40f3..071a0676 100644 --- a/src/file.h +++ b/src/file.h @@ -27,7 +27,7 @@ #ifndef __UPX_FILE_H -#define __UPX_FILE_H +#define __UPX_FILE_H 1 class MemBuffer; diff --git a/src/filter.h b/src/filter.h index 78d60dac..c1934d59 100644 --- a/src/filter.h +++ b/src/filter.h @@ -27,7 +27,7 @@ #ifndef __UPX_FILTER_H -#define __UPX_FILTER_H +#define __UPX_FILTER_H 1 class Filter; class FilterImp; diff --git a/src/help.cpp b/src/help.cpp index 95fd8eca..9039a1d6 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -310,13 +310,13 @@ void show_help(int verbose) // "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.\n" ""); -#if defined(DEBUG) || defined(TESTING) +#if (DEBUG) || (TESTING) fg = con_fg(f,FG_RED); con_fprintf(f,"\nWARNING: this version is compiled with" -#if defined(DEBUG) +#if (DEBUG) " -DDEBUG" #endif -#if defined(TESTING) +#if (TESTING) " -DTESTING" #endif "\n"); @@ -380,22 +380,22 @@ void show_version(int x) UNUSED(v); fprintf(fp, "upx %s\n", UPX_VERSION_STRING); -#if defined(WITH_NRV) +#if (WITH_NRV) v = upx_nrv_version_string(); if (v != NULL && v[0]) fprintf(fp, "NRV data compression library %s\n", v); #endif -#if defined(WITH_UCL) +#if (WITH_UCL) v = upx_ucl_version_string(); if (v != NULL && v[0]) fprintf(fp, "UCL data compression library %s\n", v); #endif -#if defined(WITH_ZLIB) +#if (WITH_ZLIB) v = upx_zlib_version_string(); if (v != NULL && v[0]) fprintf(fp, "zlib data compression library %s\n", v); #endif -#if defined(WITH_LZMA) +#if (WITH_LZMA) v = upx_lzma_version_string(); if (v != NULL && v[0]) fprintf(fp, "LZMA SDK version %s\n", v); @@ -404,10 +404,10 @@ void show_version(int x) fprintf(fp, "Copyright (C) 1996-2010 Laszlo Molnar\n"); fprintf(fp, "Copyright (C) 2000-2010 John F. Reiser\n"); fprintf(fp, "Copyright (C) 2002-2010 Jens Medoch\n"); -#if defined(WITH_ZLIB) +#if (WITH_ZLIB) fprintf(fp, "Copyright (C) 1995" "-2005 Jean-loup Gailly and Mark Adler\n"); #endif -#if defined(WITH_LZMA) +#if (WITH_LZMA) fprintf(fp, "Copyright (C) 1999" "-2006 Igor Pavlov\n"); #endif fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname); diff --git a/src/lefile.h b/src/lefile.h index ae41500e..ee36bd42 100644 --- a/src/lefile.h +++ b/src/lefile.h @@ -27,7 +27,7 @@ #ifndef __UPX_LEFILE_H -#define __UPX_LEFILE_H +#define __UPX_LEFILE_H 1 class InputFile; class OutputFile; diff --git a/src/linker.h b/src/linker.h index a05e80bf..ca67b3d8 100644 --- a/src/linker.h +++ b/src/linker.h @@ -27,7 +27,7 @@ #ifndef __UPX_LINKER_H -#define __UPX_LINKER_H +#define __UPX_LINKER_H 1 /************************************************************************* diff --git a/src/main.cpp b/src/main.cpp index e4ec5121..e232e4ba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,7 +62,7 @@ void options_t::reset() o->console = CON_FILE; #if defined(__DJGPP__) o->console = CON_INIT; -#elif defined(USE_SCREEN_WIN32) +#elif (USE_SCREEN_WIN32) o->console = CON_INIT; #elif 1 && defined(__linux__) o->console = CON_INIT; @@ -1419,7 +1419,7 @@ void upx_sanity_check(void) // main entry point **************************************************************************/ -#if !defined(WITH_GUI) +#if !(WITH_GUI) #if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__) extern "C" { extern long _stksize; long _stksize = 256 * 1024L; } @@ -1469,7 +1469,7 @@ int __acc_cdecl_main main(int argc, char *argv[]) set_term(stderr); -#if defined(WITH_UCL) +#if (WITH_UCL) if (ucl_init() != UCL_E_OK) { show_head(); @@ -1480,7 +1480,7 @@ int __acc_cdecl_main main(int argc, char *argv[]) e_exit(EXIT_INIT); } #endif -#if defined(WITH_NRV) +#if (WITH_NRV) if (nrv_init() != NRV_E_OK || NRV_VERSION != nrv_version()) { show_head(); @@ -1573,7 +1573,7 @@ int __acc_cdecl_main main(int argc, char *argv[]) return exit_code; } -#endif /* !defined(WITH_GUI) */ +#endif /* !(WITH_GUI) */ /* diff --git a/src/mem.cpp b/src/mem.cpp index 13ea82f9..90b7a1e1 100644 --- a/src/mem.cpp +++ b/src/mem.cpp @@ -41,7 +41,7 @@ static int mcheck_init() if (use_mcheck < 0) { use_mcheck = 1; -#if defined(WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND) +#if (WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND) if (RUNNING_ON_VALGRIND) { //fprintf(stderr, "upx: detected RUNNING_ON_VALGRIND\n"); diff --git a/src/mem.h b/src/mem.h index 1baec6cd..1578365e 100644 --- a/src/mem.h +++ b/src/mem.h @@ -27,7 +27,7 @@ #ifndef __UPX_MEM_H -#define __UPX_MEM_H +#define __UPX_MEM_H 1 /************************************************************************* diff --git a/src/options.h b/src/options.h index 43e4cf92..2b9dd876 100644 --- a/src/options.h +++ b/src/options.h @@ -27,7 +27,7 @@ #ifndef __UPX_OPTIONS_H -#define __UPX_OPTIONS_H +#define __UPX_OPTIONS_H 1 /************************************************************************* diff --git a/src/p_armpe.h b/src/p_armpe.h index ea087ef2..5acc7f52 100644 --- a/src/p_armpe.h +++ b/src/p_armpe.h @@ -27,7 +27,8 @@ #ifndef __UPX_P_ARMPE_H -#define __UPX_P_ARMPE_H +#define __UPX_P_ARMPE_H 1 + /************************************************************************* // arm/pe diff --git a/src/p_com.cpp b/src/p_com.cpp index 30fb1897..320141ce 100644 --- a/src/p_com.cpp +++ b/src/p_com.cpp @@ -36,7 +36,7 @@ static const #include "stub/i086-dos16.com.h" -//#define TESTING +//#define TESTING 1 /************************************************************************* diff --git a/src/p_com.h b/src/p_com.h index c094de55..54b1ad23 100644 --- a/src/p_com.h +++ b/src/p_com.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_COM_H -#define __UPX_P_COM_H +#define __UPX_P_COM_H 1 /************************************************************************* diff --git a/src/p_djgpp2.h b/src/p_djgpp2.h index 7885a8f9..32348f02 100644 --- a/src/p_djgpp2.h +++ b/src/p_djgpp2.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_DJGPP2_H -#define __UPX_P_DJGPP2_H +#define __UPX_P_DJGPP2_H 1 /************************************************************************* diff --git a/src/p_elf.h b/src/p_elf.h index e0750105..da7ab075 100644 --- a/src/p_elf.h +++ b/src/p_elf.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_ELF_H -#define __UPX_P_ELF_H +#define __UPX_P_ELF_H 1 /************************************************************************* diff --git a/src/p_exe.cpp b/src/p_exe.cpp index eb2528af..4ddf570b 100644 --- a/src/p_exe.cpp +++ b/src/p_exe.cpp @@ -514,7 +514,7 @@ void PackExe::pack(OutputFile *fo) if (ph.max_run_found + ph.max_match_found > 0x8000) throwCantPack("decompressor limit exceeded, send a bugreport"); -#ifdef TESTING +#if TESTING if (opt->debug.debug_level) { printf("image+relocs %d -> %d\n",ih_imagesize+relocsize,ph.c_len); @@ -631,7 +631,7 @@ void PackExe::pack(OutputFile *fo) //fprintf(stderr,"\ne_len=%x d_len=%x c_len=%x oo=%x ulen=%x destp=%x copys=%x images=%x",e_len,d_len,packedsize,ph.overlap_overhead,ph.u_len,destpara,copysize,ih_imagesize); // write header + write loader + compressed file -#ifdef TESTING +#if TESTING if (opt->debug.debug_level) printf("\n%d %d %d %d\n",(int)sizeof(oh),e_len,packedsize,d_len); #endif diff --git a/src/p_exe.h b/src/p_exe.h index 47ee1dc7..0e8e4fac 100644 --- a/src/p_exe.h +++ b/src/p_exe.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_EXE_H -#define __UPX_P_EXE_H +#define __UPX_P_EXE_H 1 /************************************************************************* diff --git a/src/p_lx_elf.h b/src/p_lx_elf.h index c7403a8d..155e155d 100644 --- a/src/p_lx_elf.h +++ b/src/p_lx_elf.h @@ -31,7 +31,7 @@ #ifndef __UPX_P_LX_ELF_H //{ -#define __UPX_P_LX_ELF_H +#define __UPX_P_LX_ELF_H 1 class PackLinuxElf : public PackUnix diff --git a/src/p_lx_exc.h b/src/p_lx_exc.h index 697496c9..e1591efe 100644 --- a/src/p_lx_exc.h +++ b/src/p_lx_exc.h @@ -30,7 +30,7 @@ #ifndef __UPX_P_LX_EXC_H -#define __UPX_P_LX_EXC_H +#define __UPX_P_LX_EXC_H 1 /************************************************************************* diff --git a/src/p_lx_interp.h b/src/p_lx_interp.h index 629c8881..ca6db7b1 100644 --- a/src/p_lx_interp.h +++ b/src/p_lx_interp.h @@ -31,7 +31,7 @@ #ifndef __UPX_P_LX_INTERP_H //{ -#define __UPX_P_LX_INTERP_H +#define __UPX_P_LX_INTERP_H 1 /************************************************************************* diff --git a/src/p_lx_sh.h b/src/p_lx_sh.h index 84855bf9..20de5aa1 100644 --- a/src/p_lx_sh.h +++ b/src/p_lx_sh.h @@ -31,7 +31,7 @@ #ifndef __UPX_P_LX_SH_H //{ -#define __UPX_P_LX_SH_H +#define __UPX_P_LX_SH_H 1 /************************************************************************* diff --git a/src/p_mach.h b/src/p_mach.h index f6478383..26b7063d 100644 --- a/src/p_mach.h +++ b/src/p_mach.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_MACHO_H -#define __UPX_P_MACHO_H +#define __UPX_P_MACHO_H 1 __packed_struct(Mach_fat_header) @@ -640,7 +640,7 @@ protected: BE32 flavor; BE32 count; /* sizeof(following_thread_state)/4 */ Mach_ppc_thread_state state; - #define WANT_MACH_THREAD_ENUM + #define WANT_MACH_THREAD_ENUM 1 #include "p_mach_enum.h" __packed_struct_end() @@ -689,7 +689,7 @@ protected: LE32 flavor; LE32 count; /* sizeof(following_thread_state)/4 */ Mach_i386_thread_state state; - #define WANT_MACH_THREAD_ENUM + #define WANT_MACH_THREAD_ENUM 1 #include "p_mach_enum.h" __packed_struct_end() @@ -738,7 +738,7 @@ protected: LE32 flavor; LE32 count; /* sizeof(following_thread_state)/4 */ Mach_AMD64_thread_state state; - #define WANT_MACH_THREAD_ENUM + #define WANT_MACH_THREAD_ENUM 1 #include "p_mach_enum.h" __packed_struct_end() @@ -788,7 +788,7 @@ protected: LE32 flavor; LE32 count; /* sizeof(following_thread_state)/4 */ Mach_ARM_thread_state state; - #define WANT_MACH_THREAD_ENUM + #define WANT_MACH_THREAD_ENUM 1 #include "p_mach_enum.h" __packed_struct_end() @@ -841,7 +841,7 @@ protected: // linker Linker *linker; -#define WANT_MACH_HEADER_ENUM +#define WANT_MACH_HEADER_ENUM 1 #include "p_mach_enum.h" }; diff --git a/src/p_ps1.h b/src/p_ps1.h index 7d478c03..275e5fd0 100644 --- a/src/p_ps1.h +++ b/src/p_ps1.h @@ -31,7 +31,7 @@ #ifndef __UPX_P_PS1_H -#define __UPX_P_PS1_H +#define __UPX_P_PS1_H 1 /************************************************************************* diff --git a/src/p_sys.h b/src/p_sys.h index 52e7804b..8adeca04 100644 --- a/src/p_sys.h +++ b/src/p_sys.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_SYS_H -#define __UPX_P_SYS_H +#define __UPX_P_SYS_H 1 /************************************************************************* diff --git a/src/p_tmt.h b/src/p_tmt.h index ff691434..ff128b53 100644 --- a/src/p_tmt.h +++ b/src/p_tmt.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_TMT_H -#define __UPX_P_TMT_H +#define __UPX_P_TMT_H 1 /************************************************************************* diff --git a/src/p_tos.cpp b/src/p_tos.cpp index 52a4ddfd..49802446 100644 --- a/src/p_tos.cpp +++ b/src/p_tos.cpp @@ -446,7 +446,7 @@ void PackTos::pack(OutputFile *fo) overlay = file_size - (FH_SIZE + i_text + i_data + i_sym); fi->readx(ibuf+t,overlay); -#if 0 || defined(TESTING) +#if 0 || (TESTING) printf("text: %d, data: %d, sym: %d, bss: %d, flags=0x%x\n", i_text, i_data, i_sym, i_bss, (int)ih.fh_flag); printf("xx1 reloc: %d, overlay: %d, fixup: %d\n", relocsize, overlay, overlay >= 4 ? (int)get_be32(ibuf+t) : -1); @@ -476,7 +476,7 @@ void PackTos::pack(OutputFile *fo) symbols.need_reloc = true; } -#if 0 || defined(TESTING) +#if 0 || (TESTING) printf("xx2: %d relocs: %d, overlay: %d, t: %d\n", nrelocs, relocsize, overlay, t); #endif @@ -487,7 +487,7 @@ void PackTos::pack(OutputFile *fo) ih.fh_sym = 0; // we stripped all symbols memcpy(ibuf+t, &ih, FH_SIZE); t += FH_SIZE; -#if 0 || defined(TESTING) +#if 0 || (TESTING) printf("xx3 reloc: %d, overlay: %d, t: %d\n", relocsize, overlay, t); #endif assert(t <= isize); @@ -686,7 +686,7 @@ void PackTos::pack(OutputFile *fo) // add an empty relocation fixup to workaround a bug in some TOS versions oh.fh_reloc = 0; -#if 0 || defined(TESTING) +#if 0 || (TESTING) printf("old text: %6d, data: %6d, bss: %6d, reloc: %d, overlay: %d\n", i_text, i_data, i_bss, relocsize, overlay); printf("new text: %6d, data: %6d, bss: %6d, flag=0x%x\n", diff --git a/src/p_tos.h b/src/p_tos.h index 9b497f98..34dd17b5 100644 --- a/src/p_tos.h +++ b/src/p_tos.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_TOS_H -#define __UPX_P_TOS_H +#define __UPX_P_TOS_H 1 /************************************************************************* diff --git a/src/p_unix.h b/src/p_unix.h index bc4bcbf0..8af6b2c8 100644 --- a/src/p_unix.h +++ b/src/p_unix.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_UNIX_H -#define __UPX_P_UNIX_H +#define __UPX_P_UNIX_H 1 /************************************************************************* diff --git a/src/p_vmlinx.h b/src/p_vmlinx.h index bdbf0e63..c3311ec5 100644 --- a/src/p_vmlinx.h +++ b/src/p_vmlinx.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_VMLINX_H -#define __UPX_P_VMLINX_H +#define __UPX_P_VMLINX_H 1 #include "p_elf.h" diff --git a/src/p_vmlinz.h b/src/p_vmlinz.h index f2e6e763..a1acb985 100644 --- a/src/p_vmlinz.h +++ b/src/p_vmlinz.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_VMLINZ_H -#define __UPX_P_VMLINZ_H +#define __UPX_P_VMLINZ_H 1 /************************************************************************* diff --git a/src/p_vxd.h b/src/p_vxd.h index 78d4d60f..28095a34 100644 --- a/src/p_vxd.h +++ b/src/p_vxd.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_VXD_H -#define __UPX_P_VXD_H +#define __UPX_P_VXD_H 1 /************************************************************************* diff --git a/src/p_w16ne.h b/src/p_w16ne.h index e67f89b9..4b1342b6 100644 --- a/src/p_w16ne.h +++ b/src/p_w16ne.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_W16NE_H -#define __UPX_P_W16NE_H +#define __UPX_P_W16NE_H 1 /************************************************************************* diff --git a/src/p_w32pe.h b/src/p_w32pe.h index 42abcf9d..6b4e8d7d 100644 --- a/src/p_w32pe.h +++ b/src/p_w32pe.h @@ -27,7 +27,8 @@ #ifndef __UPX_P_W32PE_H -#define __UPX_P_W32PE_H +#define __UPX_P_W32PE_H 1 + /************************************************************************* // w32/pe diff --git a/src/p_wcle.h b/src/p_wcle.h index 4871782d..474ec229 100644 --- a/src/p_wcle.h +++ b/src/p_wcle.h @@ -27,7 +27,7 @@ #ifndef __UPX_P_WCLE_H -#define __UPX_P_WCLE_H +#define __UPX_P_WCLE_H 1 /************************************************************************* diff --git a/src/packer.cpp b/src/packer.cpp index 246d58d9..b58ab184 100644 --- a/src/packer.cpp +++ b/src/packer.cpp @@ -26,7 +26,7 @@ */ -//#define WANT_STL +//#define WANT_STL 1 #include "conf.h" #include "file.h" #include "packer.h" @@ -211,7 +211,7 @@ bool Packer::compress(upx_bytep i_ptr, unsigned i_len, upx_bytep o_ptr, cconf.conf_ucl.max_offset = opt->crp.crp_ucl.max_offset; if (opt->crp.crp_ucl.max_match != UINT_MAX && opt->crp.crp_ucl.max_match < cconf.conf_ucl.max_match) cconf.conf_ucl.max_match = opt->crp.crp_ucl.max_match; -#if defined(WITH_NRV) +#if (WITH_NRV) if (ph.level >= 7 || (ph.level >= 4 && ph.u_len >= 512*1024)) step = 0; #endif @@ -625,7 +625,7 @@ unsigned Packer::getRandomId() const #endif while (id == 0) { -#if !defined(HAVE_GETTIMEOFDAY) || defined(__DJGPP__) +#if !(HAVE_GETTIMEOFDAY) || defined(__DJGPP__) id ^= (unsigned) time(NULL); id ^= ((unsigned) clock()) << 12; #else @@ -634,7 +634,7 @@ unsigned Packer::getRandomId() const id ^= (unsigned) tv.tv_sec; id ^= ((unsigned) tv.tv_usec) << 12; // shift into high-bits #endif -#if defined(HAVE_GETPID) +#if (HAVE_GETPID) id ^= (unsigned) getpid(); #endif id ^= (unsigned) fi->st.st_ino; diff --git a/src/packer.h b/src/packer.h index e2dd661b..b0a03ab9 100644 --- a/src/packer.h +++ b/src/packer.h @@ -27,7 +27,7 @@ #ifndef __UPX_PACKER_H -#define __UPX_PACKER_H +#define __UPX_PACKER_H 1 #include "mem.h" diff --git a/src/packer_c.cpp b/src/packer_c.cpp index a56cffab..f6e20d64 100644 --- a/src/packer_c.cpp +++ b/src/packer_c.cpp @@ -39,7 +39,7 @@ bool Packer::isValidCompressionMethod(int method) { if (M_IS_LZMA(method)) { -#if !defined(WITH_LZMA) +#if !(WITH_LZMA) assert(0 && "Internal error - LZMA not compiled in"); #else return true; diff --git a/src/packmast.h b/src/packmast.h index 98055998..4ddfa193 100644 --- a/src/packmast.h +++ b/src/packmast.h @@ -27,7 +27,7 @@ #ifndef __UPX_PACKMASTER_H -#define __UPX_PACKMASTER_H +#define __UPX_PACKMASTER_H 1 class Packer; class InputFile; diff --git a/src/pefile.h b/src/pefile.h index 22baaa19..55f59f3a 100644 --- a/src/pefile.h +++ b/src/pefile.h @@ -27,7 +27,7 @@ #ifndef __UPX_PEFILE_H -#define __UPX_PEFILE_H +#define __UPX_PEFILE_H 1 /************************************************************************* diff --git a/src/s_djgpp2.cpp b/src/s_djgpp2.cpp index f7ee0812..6692a7e5 100644 --- a/src/s_djgpp2.cpp +++ b/src/s_djgpp2.cpp @@ -28,7 +28,7 @@ #include "conf.h" -#if defined(USE_SCREEN) && defined(__DJGPP__) +#if (USE_SCREEN) && defined(__DJGPP__) #include "screen.h" @@ -37,7 +37,7 @@ #define mask_fg 0x0f #define mask_bg 0xf0 -/* #define USE_SCROLLBACK */ +/* #define USE_SCROLLBACK 1 */ /************************************************************************* @@ -70,7 +70,7 @@ struct screen_data_t unsigned char init_attr; unsigned char empty_attr; unsigned short empty_cell; -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK /* scrollback buffer */ unsigned short sb_buf[32][256]; int sb_size; @@ -89,7 +89,7 @@ static struct }; -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK static __inline__ void sb_add(screen_t *this, int *val, int inc) { *val = (*val + inc) & (this->data->sb_size - 1); @@ -304,7 +304,7 @@ static int init(screen_t *this, int fd) return -1; this->data->mode = -1; -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK this->data->sb_size = 32; this->data->sb_base = 0; this->data->sb_sp = 0; @@ -404,7 +404,7 @@ static int scrollUp(screen_t *this, int lines) if (lines <= 0 || lines > sr) return 0; -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK /* copy to scrollback buffer */ for (y = 0; y < lines; y++) { @@ -449,7 +449,7 @@ static int scrollDown(screen_t *this, int lines) /* copy top lines from scrollback buffer */ for (y = lines; --y >= 0; ) { -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK const unsigned short *buf = sb_pop(this); if (buf == NULL) clearLine(this,y); @@ -556,7 +556,7 @@ screen_t *screen_djgpp2_construct(void) } -#endif /* defined(USE_SCREEN) && defined(__DJGPP__) */ +#endif /* (USE_SCREEN) && defined(__DJGPP__) */ /* diff --git a/src/s_object.cpp b/src/s_object.cpp index 7a66eb19..1e4d0355 100644 --- a/src/s_object.cpp +++ b/src/s_object.cpp @@ -28,7 +28,7 @@ #include "conf.h" -#if defined(USE_SCREEN) +#if (USE_SCREEN) #define this local_this @@ -92,7 +92,7 @@ screen_t *sobject_construct(const screen_t *c, size_t data_size) } -#endif /* defined(USE_SCREEN) */ +#endif /* (USE_SCREEN) */ /* diff --git a/src/s_vcsa.cpp b/src/s_vcsa.cpp index de2b8173..5e3b9337 100644 --- a/src/s_vcsa.cpp +++ b/src/s_vcsa.cpp @@ -28,7 +28,7 @@ #include "conf.h" -#if defined(USE_SCREEN) && defined(USE_SCREEN_VCSA) +#if (USE_SCREEN) && (USE_SCREEN_VCSA) #include "screen.h" @@ -37,7 +37,7 @@ #define mask_fg 0x0f #define mask_bg 0xf0 -/* #define USE_SCROLLBACK */ +/* #define USE_SCROLLBACK 1 */ /************************************************************************* @@ -68,7 +68,7 @@ struct screen_data_t unsigned char init_attr; unsigned char map[256]; unsigned short empty_line[256]; -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK /* scrollback buffer */ unsigned short sb_buf[32][256]; int sb_size; @@ -78,7 +78,7 @@ struct screen_data_t }; -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK static __inline__ void sb_add(screen_t *this, int *val, int inc) { *val = (*val + inc) & (this->data->sb_size - 1); @@ -311,7 +311,7 @@ static int init(screen_t *this, int fd) this->data->fd = -1; this->data->mode = -1; this->data->page = 0; -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK this->data->sb_size = 32; this->data->sb_base = 0; this->data->sb_sp = 0; @@ -427,7 +427,7 @@ static int scrollUp(screen_t *this, int lines) if (lines <= 0 || lines > sr) return 0; -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK /* copy to scrollback buffer */ for (y = 0; y < lines; y++) { @@ -479,7 +479,7 @@ static int scrollDown(screen_t *this, int lines) /* copy top lines from scrollback buffer */ for (y = lines; --y >= 0; ) { -#ifdef USE_SCROLLBACK +#if USE_SCROLLBACK const unsigned short *buf = sb_pop(this); if (buf == NULL) clearLine(this,y); @@ -608,7 +608,7 @@ screen_t *screen_vcsa_construct(void) } -#endif /* defined(USE_SCREEN) && defined(USE_SCREEN_VCSA) */ +#endif /* (USE_SCREEN) && (USE_SCREEN_VCSA) */ /* diff --git a/src/s_win32.cpp b/src/s_win32.cpp index 60e4b4b3..0042e022 100644 --- a/src/s_win32.cpp +++ b/src/s_win32.cpp @@ -28,7 +28,7 @@ #include "conf.h" -#if defined(USE_SCREEN_WIN32) +#if (USE_SCREEN_WIN32) #include "screen.h" @@ -52,7 +52,7 @@ # define timeval win32_timeval /* struct timeval already in */ #endif #include -#if defined(HAVE_CONIO_H) +#if (HAVE_CONIO_H) # include #endif @@ -449,7 +449,7 @@ static int getScrollCounter(const screen_t *this) static int s_kbhit(screen_t *this) { UNUSED(this); -#if defined(HAVE_CONIO_H) +#if (HAVE_CONIO_H) # if defined(__RSXNT__) return 0; # elif defined(__BORLANDC__) || defined(__WATCOMC__) @@ -526,7 +526,7 @@ screen_t *screen_win32_construct(void) } -#endif /* defined(USE_SCREEN) && (ACC_OS_WIN32 || ACC_OS_WIN64) */ +#endif /* (USE_SCREEN_WIN32) */ /* diff --git a/src/screen.h b/src/screen.h index ec1e1185..1fe02af6 100644 --- a/src/screen.h +++ b/src/screen.h @@ -27,9 +27,9 @@ #ifndef __UPX_SCREEN_H -#define __UPX_SCREEN_H +#define __UPX_SCREEN_H 1 -#if defined(USE_SCREEN) +#if (USE_SCREEN) /************************************************************************* @@ -113,7 +113,7 @@ void screen_show_frames(screen_t *); #undef LOGU #undef LOGS -#if defined(SCREEN_DEBUG) +#if (SCREEN_DEBUG) static void LOG(const char *format, ...) { static FILE *logfile = NULL; @@ -129,13 +129,13 @@ static void LOG(const char *format, ...) fflush(logfile); va_end(args); } -# define LOGI(x) LOG(#x " %ld\n", (long)(x)) -# define LOGU(x) LOG(#x " %lu\n", (long)(x)) -# define LOGS(x) LOG(#x " %s\n", x) +# define LOGI(x) LOG(#x " %ld\n", (long)(x)) +# define LOGU(x) LOG(#x " %lu\n", (long)(x)) +# define LOGS(x) LOG(#x " %s\n", x) #else -# define LOGI(x) -# define LOGU(x) -# define LOGS(x) +# define LOGI(x) /*empty*/ +# define LOGU(x) /*empty*/ +# define LOGS(x) /*empty*/ #endif #endif /* if #0 */ diff --git a/src/snprintf.cpp b/src/snprintf.cpp index 9c9c3465..7427846c 100644 --- a/src/snprintf.cpp +++ b/src/snprintf.cpp @@ -89,7 +89,7 @@ # define float error no_float # define double error no_float # endif -#elif 0 || defined(HAVE_LONG_DOUBLE) +#elif 0 || (HAVE_LONG_DOUBLE) # define LDOUBLE long double #else # define LDOUBLE double @@ -263,7 +263,7 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen, // floating format support **************************************************************************/ -#if !defined(NO_FLOAT) +#if !(NO_FLOAT) static LDOUBLE abs_val(LDOUBLE value) { @@ -490,7 +490,7 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, } -#endif /* !defined(NO_FLOAT) */ +#endif /* !(NO_FLOAT) */ /************************************************************************* @@ -501,7 +501,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args { char ch; LLONG value; -#if !defined(NO_FLOAT) +#if !(NO_FLOAT) LDOUBLE fvalue; #endif const char *strvalue; @@ -665,7 +665,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args value = (long)va_arg (args, unsigned int); fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); break; -#if !defined(NO_FLOAT) +#if !(NO_FLOAT) case 'f': if (cflags == DP_C_LDOUBLE) fvalue = va_arg (args, LDOUBLE); @@ -698,7 +698,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args case 'g': assert(0); exit(255); -#endif /* !defined(NO_FLOAT) */ +#endif /* !(NO_FLOAT) */ case 'c': dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); break; diff --git a/src/snprintf.h b/src/snprintf.h index c73daf60..de7b7689 100644 --- a/src/snprintf.h +++ b/src/snprintf.h @@ -27,7 +27,7 @@ #ifndef __UPX_SNPRINTF_H -#define __UPX_SNPRINTF_H +#define __UPX_SNPRINTF_H 1 #ifdef __cplusplus extern "C" { diff --git a/src/stdcxx.cpp b/src/stdcxx.cpp index 8901929f..6e35fdd2 100644 --- a/src/stdcxx.cpp +++ b/src/stdcxx.cpp @@ -26,7 +26,7 @@ */ -//#define WANT_STL +//#define WANT_STL 1 #include "conf.h" #include "stdcxx.h" diff --git a/src/stdcxx.h b/src/stdcxx.h index 89eb8fd6..3e1190ce 100644 --- a/src/stdcxx.h +++ b/src/stdcxx.h @@ -27,7 +27,7 @@ #ifndef __UPX_STDCXX_H -#define __UPX_STDCXX_H +#define __UPX_STDCXX_H 1 #ifdef __cplusplus @@ -93,9 +93,9 @@ using namespace std; #elif (ACC_CC_DMC) namespace std { class bad_alloc { }; } #elif (ACC_CC_GNUC && ACC_OS_EMX) -#define std +#define std /*empty*/ #elif (ACC_CC_SYMANTECC) -#define std +#define std /*empty*/ class bad_alloc { }; #endif @@ -107,11 +107,11 @@ class bad_alloc { }; #ifdef WANT_STL #if defined(__linux__) -# define _NOTHREADS +# define _NOTHREADS 1 #endif #if defined(__GNUC__) # define __THROW_BAD_ALLOC throw bad_alloc() -# define __USE_MALLOC +# define __USE_MALLOC 1 # define enable upx_stl_enable #endif #if defined(_MSC_VER) diff --git a/src/stub/scripts/UNUSED/bin2h.pl b/src/stub/scripts/UNUSED/bin2h.pl index 05aa1287..9c44e7f5 100644 --- a/src/stub/scripts/UNUSED/bin2h.pl +++ b/src/stub/scripts/UNUSED/bin2h.pl @@ -48,7 +48,7 @@ binmode(INFILE); # check file size @st = stat($ifile); if (1 && $st[7] <= 0) { - print STDERR "$ifile: ERROR: emtpy file\n"; + print STDERR "$ifile: ERROR: empty file\n"; exit(1); } if (1 && $st[7] > 64*1024) { diff --git a/src/stub/scripts/bin2h.py b/src/stub/scripts/bin2h.py index ad405351..e5912b0b 100644 --- a/src/stub/scripts/bin2h.py +++ b/src/stub/scripts/bin2h.py @@ -284,7 +284,7 @@ def main(argv): # check file size st = os.stat(ifile) if 1 and st.st_size <= 0: - print >> sys.stderr, "%s: ERROR: emtpy file" % (ifile) + print >> sys.stderr, "%s: ERROR: empty file" % (ifile) sys.exit(1) if 1 and st.st_size > 128*1024: print >> sys.stderr, "%s: ERROR: file is too big (%d bytes)" % (ifile, st.st_size) diff --git a/src/stub/src/amd64-darwin.macho-main.c b/src/stub/src/amd64-darwin.macho-main.c index fe3d3a2f..41877fda 100644 --- a/src/stub/src/amd64-darwin.macho-main.c +++ b/src/stub/src/amd64-darwin.macho-main.c @@ -76,7 +76,7 @@ xread(Extent *x, void *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) { diff --git a/src/stub/src/amd64-linux.elf-main.c b/src/stub/src/amd64-linux.elf-main.c index 9ccbec35..4e563d6d 100644 --- a/src/stub/src/amd64-linux.elf-main.c +++ b/src/stub/src/amd64-linux.elf-main.c @@ -78,7 +78,7 @@ xread(Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) { diff --git a/src/stub/src/arch/i086/lzma_d.S b/src/stub/src/arch/i086/lzma_d.S index c74a1069..725614d8 100644 --- a/src/stub/src/arch/i086/lzma_d.S +++ b/src/stub/src/arch/i086/lzma_d.S @@ -102,7 +102,7 @@ section LZMA_DEC00 ignore_reloc_overflow lzma_properties -#define ret +#define ret /*empty*/ section LZMA_DEC10 .arch i8086, nojumps #define SMALL 1 diff --git a/src/stub/src/arch/mips/r3000/bits.ash b/src/stub/src/arch/mips/r3000/bits.ash index 55234fb8..98c5382a 100644 --- a/src/stub/src/arch/mips/r3000/bits.ash +++ b/src/stub/src/arch/mips/r3000/bits.ash @@ -32,7 +32,7 @@ #ifndef _MR3K_STD_CONF_ -#define _MR3K_STD_CONF_ +#define _MR3K_STD_CONF_ 1 #define JOHN 1 #define ALT_SMALL 1 diff --git a/src/stub/src/arch/mips/r3000/macros.ash b/src/stub/src/arch/mips/r3000/macros.ash index 7807ac27..3504b09e 100644 --- a/src/stub/src/arch/mips/r3000/macros.ash +++ b/src/stub/src/arch/mips/r3000/macros.ash @@ -83,7 +83,7 @@ .endm #ifndef DEBUG -# define PRINT(str) +# define PRINT(str) /*empty*/ #else -# define PRINT(str) .print str +# define PRINT(str) .print str #endif diff --git a/src/stub/src/arch/powerpc/32/ppc_regs.h b/src/stub/src/arch/powerpc/32/ppc_regs.h index c601c622..939137d2 100644 --- a/src/stub/src/arch/powerpc/32/ppc_regs.h +++ b/src/stub/src/arch/powerpc/32/ppc_regs.h @@ -1,5 +1,5 @@ #ifndef __PPC_REGS__ /*{*/ -#define __PPC_REGS__ +#define __PPC_REGS__ 1 #define r0 0 #define r1 1 diff --git a/src/stub/src/arch/powerpc/32/regs.h b/src/stub/src/arch/powerpc/32/regs.h index c601c622..939137d2 100644 --- a/src/stub/src/arch/powerpc/32/regs.h +++ b/src/stub/src/arch/powerpc/32/regs.h @@ -1,5 +1,5 @@ #ifndef __PPC_REGS__ /*{*/ -#define __PPC_REGS__ +#define __PPC_REGS__ 1 #define r0 0 #define r1 1 diff --git a/src/stub/src/arm-darwin.macho-main.c b/src/stub/src/arm-darwin.macho-main.c index c5d10325..2acd7258 100644 --- a/src/stub/src/arm-darwin.macho-main.c +++ b/src/stub/src/arm-darwin.macho-main.c @@ -79,7 +79,7 @@ xread(Extent *x, void *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) { diff --git a/src/stub/src/arm.v4a-wince.pe.S b/src/stub/src/arm.v4a-wince.pe.S index f4698bd3..4bdc1194 100644 --- a/src/stub/src/arm.v4a-wince.pe.S +++ b/src/stub/src/arm.v4a-wince.pe.S @@ -38,9 +38,9 @@ #define DEBUG 0 #if DEBUG == 0 -# define DINIT -# define DDUMP(x) -# define DDONE +# define DINIT /*empty*/ +# define DDUMP(x) /*empty*/ +# define DDONE /*empty*/ #else #define DDUMP(x) stmfd sp!, {r0 - r3}; mov r0, x; mov lr, pc; mov pc, r8; ldmia sp!, {r0 - r3} #if DEBUG == 1 @@ -48,10 +48,10 @@ #define DDONE mov pc, lr #elif DEBUG == 2 #define DINIT adr r8, writefile - #define DDONE + #define DDONE /*empty*/ #elif DEBUG == 3 #define DINIT adr r8, DelFile - #define DDONE + #define DDONE /*empty*/ #endif #endif diff --git a/src/stub/src/i386-bsd.elf-main.c b/src/stub/src/i386-bsd.elf-main.c index 15aa9f9b..3e5b128f 100644 --- a/src/stub/src/i386-bsd.elf-main.c +++ b/src/stub/src/i386-bsd.elf-main.c @@ -167,7 +167,7 @@ xread(struct Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) __attribute__ ((__noreturn__)); { diff --git a/src/stub/src/i386-bsd.elf.execve-main.c b/src/stub/src/i386-bsd.elf.execve-main.c index e852ff5b..f4c6ad7c 100644 --- a/src/stub/src/i386-bsd.elf.execve-main.c +++ b/src/stub/src/i386-bsd.elf.execve-main.c @@ -37,7 +37,7 @@ **************************************************************************/ // mmap() the temporary output file -#define USE_MMAP_FO +#define USE_MMAP_FO 1 /************************************************************************* @@ -50,7 +50,7 @@ struct Extent { }; -#if !defined(USE_MMAP_FO) +#if !(USE_MMAP_FO) #if 1 static __inline__ int xwrite(int fd, const void *buf, int count) { @@ -322,7 +322,7 @@ void upx_main( } // Create the temporary output file. -#if defined(USE_MMAP_FO) +#if (USE_MMAP_FO) fdo = open(tmpname, O_RDWR | O_CREAT | O_EXCL, 0700); #else fdo = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0700); @@ -342,7 +342,7 @@ void upx_main( // ----- Step 3: setup memory ----- // -#if defined(USE_MMAP_FO) +#if (USE_MMAP_FO) // FIXME: packer could set length buf = (unsigned char *)mmap(0, header.p_filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fdo, 0); @@ -413,7 +413,7 @@ void upx_main( else { // Incompressible block -#if defined(USE_MMAP_FO) +#if (USE_MMAP_FO) //memcpy(buf, xi.buf, h.sz_unc); register unsigned long int __d0, __d1, __d2; __asm__ __volatile__( "rep; movsb" @@ -423,7 +423,7 @@ void upx_main( #endif } -#if defined(USE_MMAP_FO) +#if (USE_MMAP_FO) // unmap part of the output munmap(buf, h.sz_unc); buf += h.sz_unc; @@ -455,7 +455,7 @@ void upx_main( // -#if !defined(USE_MMAP_FO) +#if !(USE_MMAP_FO) // Free our temporary decompression buffer. munmap(buf, malloc_args.ma_length); #endif diff --git a/src/stub/src/i386-darwin.macho-main.c b/src/stub/src/i386-darwin.macho-main.c index 19461fd9..dba5c7a3 100644 --- a/src/stub/src/i386-darwin.macho-main.c +++ b/src/stub/src/i386-darwin.macho-main.c @@ -76,7 +76,7 @@ xread(Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) { diff --git a/src/stub/src/i386-linux.elf-main.c b/src/stub/src/i386-linux.elf-main.c index ccc067aa..6f6e68a6 100644 --- a/src/stub/src/i386-linux.elf-main.c +++ b/src/stub/src/i386-linux.elf-main.c @@ -177,7 +177,7 @@ xread(Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void __attribute__ ((__noreturn__)) err_exit(int a) { diff --git a/src/stub/src/i386-linux.elf.execve-main.c b/src/stub/src/i386-linux.elf.execve-main.c index 4d54b585..2e6a7fd7 100644 --- a/src/stub/src/i386-linux.elf.execve-main.c +++ b/src/stub/src/i386-linux.elf.execve-main.c @@ -37,7 +37,7 @@ **************************************************************************/ // mmap() the temporary output file -#define USE_MMAP_FO +#define USE_MMAP_FO 1 /************************************************************************* @@ -50,7 +50,7 @@ struct Extent { }; -#if !defined(USE_MMAP_FO) +#if !(USE_MMAP_FO) #if 1 static __inline__ int xwrite(int fd, const void *buf, int count) { @@ -345,7 +345,7 @@ void upx_main( } // Create the temporary output file. -#if defined(USE_MMAP_FO) +#if (USE_MMAP_FO) fdo = open(tmpname, O_RDWR | O_CREAT | O_EXCL, 0700); #else fdo = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0700); @@ -365,7 +365,7 @@ void upx_main( // ----- Step 3: setup memory ----- // -#if defined(USE_MMAP_FO) +#if (USE_MMAP_FO) // FIXME: packer could set length buf = (unsigned char *)mmap(0, header.p_filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fdo, 0); @@ -436,7 +436,7 @@ void upx_main( else { // Incompressible block -#if defined(USE_MMAP_FO) +#if (USE_MMAP_FO) //memcpy(buf, xi.buf, h.sz_unc); register unsigned long int __d0, __d1, __d2; __asm__ __volatile__( "rep; movsb" @@ -446,7 +446,7 @@ void upx_main( #endif } -#if defined(USE_MMAP_FO) +#if (USE_MMAP_FO) // unmap part of the output munmap(buf, h.sz_unc); buf += h.sz_unc; @@ -478,7 +478,7 @@ void upx_main( // -#if !defined(USE_MMAP_FO) +#if !(USE_MMAP_FO) // Free our temporary decompression buffer. munmap(buf, malloc_args.ma_length); #endif diff --git a/src/stub/src/i386-linux.elf.interp-main.c b/src/stub/src/i386-linux.elf.interp-main.c index 6c5d467a..941cfec2 100644 --- a/src/stub/src/i386-linux.elf.interp-main.c +++ b/src/stub/src/i386-linux.elf.interp-main.c @@ -81,7 +81,7 @@ xread(struct Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) { diff --git a/src/stub/src/i386-linux.elf.shell-main.c b/src/stub/src/i386-linux.elf.shell-main.c index 62f814ec..95004cd2 100644 --- a/src/stub/src/i386-linux.elf.shell-main.c +++ b/src/stub/src/i386-linux.elf.shell-main.c @@ -78,7 +78,7 @@ xread(struct Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) { diff --git a/src/stub/src/i386-openbsd.elf-main.c b/src/stub/src/i386-openbsd.elf-main.c index 57d17e4a..1cad27f9 100644 --- a/src/stub/src/i386-openbsd.elf-main.c +++ b/src/stub/src/i386-openbsd.elf-main.c @@ -167,7 +167,7 @@ xread(struct Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) __attribute__ ((__noreturn__)); { diff --git a/src/stub/src/include/bsd.h b/src/stub/src/include/bsd.h index 4ca9b1bd..1169d016 100644 --- a/src/stub/src/include/bsd.h +++ b/src/stub/src/include/bsd.h @@ -359,7 +359,7 @@ struct p_info // 12-byte packed program header follows stub loader #endif #endif #if !defined(__attribute_cdecl) -# define __attribute_cdecl +# define __attribute_cdecl /*empty*/ #endif diff --git a/src/stub/src/include/darwin.h b/src/stub/src/include/darwin.h index 822245c9..c11098e8 100644 --- a/src/stub/src/include/darwin.h +++ b/src/stub/src/include/darwin.h @@ -119,7 +119,7 @@ typedef unsigned int nrv_uint; #endif #endif #if !defined(__attribute_cdecl) -# define __attribute_cdecl +# define __attribute_cdecl /*empty*/ #endif diff --git a/src/stub/src/include/linux.h b/src/stub/src/include/linux.h index 6f8ab8c9..e524c2eb 100644 --- a/src/stub/src/include/linux.h +++ b/src/stub/src/include/linux.h @@ -745,7 +745,7 @@ struct p_info // 12-byte packed program header follows stub loader #endif #endif #if !defined(__attribute_cdecl) -# define __attribute_cdecl +# define __attribute_cdecl /*empty*/ #endif diff --git a/src/stub/src/powerpc-darwin.macho-main.c b/src/stub/src/powerpc-darwin.macho-main.c index 5918d1fb..a2a5943f 100644 --- a/src/stub/src/powerpc-darwin.macho-main.c +++ b/src/stub/src/powerpc-darwin.macho-main.c @@ -76,7 +76,7 @@ xread(Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) { diff --git a/src/stub/src/powerpc-linux.elf-main.c b/src/stub/src/powerpc-linux.elf-main.c index 6643d566..6c207dc2 100644 --- a/src/stub/src/powerpc-linux.elf-main.c +++ b/src/stub/src/powerpc-linux.elf-main.c @@ -78,7 +78,7 @@ xread(Extent *x, char *buf, size_t count) #define ERR_LAB error: exit(127); #define err_exit(a) goto error #else //}{ save debugging time -#define ERR_LAB +#define ERR_LAB /*empty*/ static void err_exit(int a) { diff --git a/src/ui.cpp b/src/ui.cpp index c34a088c..692871bf 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -33,8 +33,8 @@ #include "packer.h" -#if 1 && defined(USE_SCREEN) -#define UI_USE_SCREEN +#if 1 && (USE_SCREEN) +#define UI_USE_SCREEN 1 #endif @@ -67,7 +67,7 @@ struct UiPacker::State int bar_len; int pass_digits; // number of digits needed to print total_passes -#if defined(UI_USE_SCREEN) +#if (UI_USE_SCREEN) screen_t *screen; int screen_init_done; int b_cx, b_cy; @@ -304,7 +304,7 @@ void UiPacker::startCallback(unsigned u_len, unsigned step, } } -#if defined(UI_USE_SCREEN) +#if (UI_USE_SCREEN) if (s->mode == M_CB_SCREEN) { if (!s->screen_init_done) @@ -365,7 +365,7 @@ void UiPacker::endCallback(bool done) } // restore screen -#if defined(UI_USE_SCREEN) +#if (UI_USE_SCREEN) if (s->mode == M_CB_SCREEN) { if (done) @@ -484,7 +484,7 @@ void UiPacker::doCallback(unsigned isize, unsigned osize) return; } -#if defined(UI_USE_SCREEN) +#if (UI_USE_SCREEN) if (s->mode == M_CB_SCREEN) { const char *msg = &s->msg_buf[1]; diff --git a/src/ui.h b/src/ui.h index 75c7becf..92f1ee22 100644 --- a/src/ui.h +++ b/src/ui.h @@ -27,7 +27,7 @@ #ifndef __UPX_UI_H -#define __UPX_UI_H +#define __UPX_UI_H 1 class InputFile; class OutputFile; diff --git a/src/util.cpp b/src/util.cpp index c54246a4..90f7b2e0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -377,7 +377,7 @@ bool fn_is_same_file(const char *n1, const char *n2) #if 0 // not used -#if defined(HAVE_LOCALTIME) +#if (HAVE_LOCALTIME) void tm2str(char *s, size_t size, const struct tm *tmp) { upx_snprintf(s, size, "%04d-%02d-%02d %02d:%02d:%02d", @@ -391,9 +391,9 @@ void tm2str(char *s, size_t size, const struct tm *tmp) void time2str(char *s, size_t size, const time_t *t) { assert(size >= 18); -#if defined(HAVE_LOCALTIME) +#if (HAVE_LOCALTIME) tm2str(s, size, localtime(t)); -#elif defined(HAVE_CTIME) +#elif (HAVE_CTIME) const char *p = ctime(t); memset(s, ' ', 16); memcpy(s + 2, p + 4, 6); @@ -468,7 +468,7 @@ bool file_exists(const char *name) return true; /* return true if we can lstat it */ -#if defined(HAVE_LSTAT) +#if (HAVE_LSTAT) //memset(&st, 0, sizeof(st)); r = lstat(name, &st); if (r != -1) diff --git a/src/util.h b/src/util.h index 32f1059d..8a73e6fe 100644 --- a/src/util.h +++ b/src/util.h @@ -27,7 +27,7 @@ #ifndef __UPX_UTIL_H -#define __UPX_UTIL_H +#define __UPX_UTIL_H 1 /************************************************************************* diff --git a/src/work.cpp b/src/work.cpp index 005e68c9..a273777f 100644 --- a/src/work.cpp +++ b/src/work.cpp @@ -40,7 +40,7 @@ # define USE_UTIME 1 #elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_INTELC || ACC_CC_MSC)) # define USE__FUTIME 1 -#elif defined(HAVE_UTIME) +#elif (HAVE_UTIME) # define USE_UTIME 1 #endif @@ -64,7 +64,7 @@ void do_one_file(const char *iname, char *oname) int r; struct stat st; memset(&st, 0, sizeof(st)); -#if defined(HAVE_LSTAT) +#if (HAVE_LSTAT) r = lstat(iname,&st); #else r = stat(iname,&st); @@ -100,7 +100,7 @@ void do_one_file(const char *iname, char *oname) fi.st = st; fi.sopen(iname, O_RDONLY | O_BINARY, SH_DENYWR); -#if defined(USE_FTIME) +#if (USE_FTIME) struct ftime fi_ftime; memset(&fi_ftime, 0, sizeof(fi_ftime)); if (opt->preserve_timestamp) @@ -131,7 +131,7 @@ void do_one_file(const char *iname, char *oname) } if (opt->force >= 2) { -#if defined(HAVE_CHMOD) +#if (HAVE_CHMOD) r = chmod(tname, 0777); IGNORE_ERROR(r); #endif @@ -177,10 +177,10 @@ void do_one_file(const char *iname, char *oname) // copy time stamp if (opt->preserve_timestamp && oname[0] && fo.isOpen()) { -#if defined(USE_FTIME) +#if (USE_FTIME) r = setftime(fo.getFd(), &fi_ftime); IGNORE_ERROR(r); -#elif defined(USE__FUTIME) +#elif (USE__FUTIME) struct _utimbuf u; u.actime = st.st_atime; u.modtime = st.st_mtime; @@ -199,7 +199,7 @@ void do_one_file(const char *iname, char *oname) // FIXME: .exe or .cof etc. if (!opt->backup) { -#if defined(HAVE_CHMOD) +#if (HAVE_CHMOD) r = chmod(iname, 0777); IGNORE_ERROR(r); #endif @@ -222,7 +222,7 @@ void do_one_file(const char *iname, char *oname) oname[0] = 0; const char *name = opt->output_name ? opt->output_name : iname; UNUSED(name); -#if defined(USE_UTIME) +#if (USE_UTIME) // copy time stamp if (opt->preserve_timestamp) { @@ -233,7 +233,7 @@ void do_one_file(const char *iname, char *oname) IGNORE_ERROR(r); } #endif -#if defined(HAVE_CHMOD) +#if (HAVE_CHMOD) // copy permissions if (opt->preserve_mode) { @@ -241,7 +241,7 @@ void do_one_file(const char *iname, char *oname) IGNORE_ERROR(r); } #endif -#if defined(HAVE_CHOWN) +#if (HAVE_CHOWN) // copy the ownership if (opt->preserve_ownership) { @@ -263,7 +263,7 @@ static void unlink_ofile(char *oname) { if (oname && oname[0]) { -#if defined(HAVE_CHMOD) +#if (HAVE_CHMOD) int r; r = chmod(oname, 0777); IGNORE_ERROR(r);