1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Use consistent syntax for boolean preprocessor expressions.

This commit is contained in:
Markus F.X.J. Oberhumer 2010-08-08 16:20:16 +02:00
parent 30c3f8c1ac
commit 0aff9d8df4
92 changed files with 251 additions and 253 deletions

View File

@ -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)));

View File

@ -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

View File

@ -27,7 +27,7 @@
#ifndef __UPX_BPTR_H
#define __UPX_BPTR_H
#define __UPX_BPTR_H 1
/*************************************************************************

View File

@ -28,7 +28,7 @@
#include "conf.h"
#if defined(USE_CONSOLE)
#if (USE_CONSOLE)
/*************************************************************************
//

View File

@ -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

View File

@ -28,7 +28,7 @@
#include "conf.h"
#if defined(USE_CONSOLE)
#if (USE_CONSOLE)
/*************************************************************************
//

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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);

View File

@ -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 <ucl/ucl_asm.h>
# define ucl_nrv2b_decompress_safe_8 ucl_nrv2b_decompress_asm_safe_8
# define ucl_nrv2b_decompress_safe_le16 ucl_nrv2b_decompress_asm_safe_le16

View File

@ -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

View File

@ -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 <nrv/nrvconf.h>
#endif
#if defined(WITH_UCL)
#if (WITH_UCL)
# define ucl_compress_config_t REAL_ucl_compress_config_t
# include <ucl/uclconf.h>
# include <ucl/ucl.h>
@ -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 <valgrind/memcheck.h>
#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

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -27,7 +27,7 @@
#ifndef __UPX_FILE_H
#define __UPX_FILE_H
#define __UPX_FILE_H 1
class MemBuffer;

View File

@ -27,7 +27,7 @@
#ifndef __UPX_FILTER_H
#define __UPX_FILTER_H
#define __UPX_FILTER_H 1
class Filter;
class FilterImp;

View File

@ -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);

View File

@ -27,7 +27,7 @@
#ifndef __UPX_LEFILE_H
#define __UPX_LEFILE_H
#define __UPX_LEFILE_H 1
class InputFile;
class OutputFile;

View File

@ -27,7 +27,7 @@
#ifndef __UPX_LINKER_H
#define __UPX_LINKER_H
#define __UPX_LINKER_H 1
/*************************************************************************

View File

@ -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) */
/*

View File

@ -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");

View File

@ -27,7 +27,7 @@
#ifndef __UPX_MEM_H
#define __UPX_MEM_H
#define __UPX_MEM_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_OPTIONS_H
#define __UPX_OPTIONS_H
#define __UPX_OPTIONS_H 1
/*************************************************************************

View File

@ -27,7 +27,8 @@
#ifndef __UPX_P_ARMPE_H
#define __UPX_P_ARMPE_H
#define __UPX_P_ARMPE_H 1
/*************************************************************************
// arm/pe

View File

@ -36,7 +36,7 @@
static const
#include "stub/i086-dos16.com.h"
//#define TESTING
//#define TESTING 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_COM_H
#define __UPX_P_COM_H
#define __UPX_P_COM_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_DJGPP2_H
#define __UPX_P_DJGPP2_H
#define __UPX_P_DJGPP2_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_ELF_H
#define __UPX_P_ELF_H
#define __UPX_P_ELF_H 1
/*************************************************************************

View File

@ -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

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_EXE_H
#define __UPX_P_EXE_H
#define __UPX_P_EXE_H 1
/*************************************************************************

View File

@ -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

View File

@ -30,7 +30,7 @@
#ifndef __UPX_P_LX_EXC_H
#define __UPX_P_LX_EXC_H
#define __UPX_P_LX_EXC_H 1
/*************************************************************************

View File

@ -31,7 +31,7 @@
#ifndef __UPX_P_LX_INTERP_H //{
#define __UPX_P_LX_INTERP_H
#define __UPX_P_LX_INTERP_H 1
/*************************************************************************

View File

@ -31,7 +31,7 @@
#ifndef __UPX_P_LX_SH_H //{
#define __UPX_P_LX_SH_H
#define __UPX_P_LX_SH_H 1
/*************************************************************************

View File

@ -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"
};

View File

@ -31,7 +31,7 @@
#ifndef __UPX_P_PS1_H
#define __UPX_P_PS1_H
#define __UPX_P_PS1_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_SYS_H
#define __UPX_P_SYS_H
#define __UPX_P_SYS_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_TMT_H
#define __UPX_P_TMT_H
#define __UPX_P_TMT_H 1
/*************************************************************************

View File

@ -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",

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_TOS_H
#define __UPX_P_TOS_H
#define __UPX_P_TOS_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_UNIX_H
#define __UPX_P_UNIX_H
#define __UPX_P_UNIX_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_VMLINX_H
#define __UPX_P_VMLINX_H
#define __UPX_P_VMLINX_H 1
#include "p_elf.h"

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_VMLINZ_H
#define __UPX_P_VMLINZ_H
#define __UPX_P_VMLINZ_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_VXD_H
#define __UPX_P_VXD_H
#define __UPX_P_VXD_H 1
/*************************************************************************

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_W16NE_H
#define __UPX_P_W16NE_H
#define __UPX_P_W16NE_H 1
/*************************************************************************

View File

@ -27,7 +27,8 @@
#ifndef __UPX_P_W32PE_H
#define __UPX_P_W32PE_H
#define __UPX_P_W32PE_H 1
/*************************************************************************
// w32/pe

View File

@ -27,7 +27,7 @@
#ifndef __UPX_P_WCLE_H
#define __UPX_P_WCLE_H
#define __UPX_P_WCLE_H 1
/*************************************************************************

View File

@ -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;

View File

@ -27,7 +27,7 @@
#ifndef __UPX_PACKER_H
#define __UPX_PACKER_H
#define __UPX_PACKER_H 1
#include "mem.h"

View File

@ -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;

View File

@ -27,7 +27,7 @@
#ifndef __UPX_PACKMASTER_H
#define __UPX_PACKMASTER_H
#define __UPX_PACKMASTER_H 1
class Packer;
class InputFile;

View File

@ -27,7 +27,7 @@
#ifndef __UPX_PEFILE_H
#define __UPX_PEFILE_H
#define __UPX_PEFILE_H 1
/*************************************************************************

View File

@ -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__) */
/*

View File

@ -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) */
/*

View File

@ -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) */
/*

View File

@ -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 <sys/time.h> */
#endif
#include <windows.h>
#if defined(HAVE_CONIO_H)
#if (HAVE_CONIO_H)
# include <conio.h>
#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) */
/*

View File

@ -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 */

View File

@ -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;

View File

@ -27,7 +27,7 @@
#ifndef __UPX_SNPRINTF_H
#define __UPX_SNPRINTF_H
#define __UPX_SNPRINTF_H 1
#ifdef __cplusplus
extern "C" {

View File

@ -26,7 +26,7 @@
*/
//#define WANT_STL
//#define WANT_STL 1
#include "conf.h"
#include "stdcxx.h"

View File

@ -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)

View File

@ -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) {

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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

View File

@ -32,7 +32,7 @@
#ifndef _MR3K_STD_CONF_
#define _MR3K_STD_CONF_
#define _MR3K_STD_CONF_ 1
#define JOHN 1
#define ALT_SMALL 1

View File

@ -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

View File

@ -1,5 +1,5 @@
#ifndef __PPC_REGS__ /*{*/
#define __PPC_REGS__
#define __PPC_REGS__ 1
#define r0 0
#define r1 1

View File

@ -1,5 +1,5 @@
#ifndef __PPC_REGS__ /*{*/
#define __PPC_REGS__
#define __PPC_REGS__ 1
#define r0 0
#define r1 1

View File

@ -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)
{

View File

@ -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

View File

@ -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__));
{

View File

@ -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

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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__));
{

View File

@ -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

View File

@ -119,7 +119,7 @@ typedef unsigned int nrv_uint;
#endif
#endif
#if !defined(__attribute_cdecl)
# define __attribute_cdecl
# define __attribute_cdecl /*empty*/
#endif

View File

@ -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

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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];

View File

@ -27,7 +27,7 @@
#ifndef __UPX_UI_H
#define __UPX_UI_H
#define __UPX_UI_H 1
class InputFile;
class OutputFile;

View File

@ -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)

View File

@ -27,7 +27,7 @@
#ifndef __UPX_UTIL_H
#define __UPX_UTIL_H
#define __UPX_UTIL_H 1
/*************************************************************************

View File

@ -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);