New ACC system.
committer: mfx <mfx> 1048662134 +0000
This commit is contained in:
@@ -141,7 +141,6 @@ include $(srcdir)/Makedefs.gcc
|
|||||||
ifeq ($(arch),i386)
|
ifeq ($(arch),i386)
|
||||||
CCARCH += -march=i386 -mcpu=i686
|
CCARCH += -march=i386 -mcpu=i686
|
||||||
endif
|
endif
|
||||||
DEFS += '-DUPX_CONFIG_H="config_h/linux.h"'
|
|
||||||
DEFS += -D_FILE_OFFSET_BITS=64
|
DEFS += -D_FILE_OFFSET_BITS=64
|
||||||
LDLIBS += -lmcheck
|
LDLIBS += -lmcheck
|
||||||
##CFLAGS_WERROR = -Werror
|
##CFLAGS_WERROR = -Werror
|
||||||
@@ -173,7 +172,6 @@ ifeq ($(WITH_ZLIB),1)
|
|||||||
LDLIBS += -lz
|
LDLIBS += -lz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DEFS += '-DUPX_CONFIG_H="config_h/linux.h"'
|
|
||||||
CFLAGS = $(CFLAGS_WERROR)
|
CFLAGS = $(CFLAGS_WERROR)
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
CFLAGS += -g -O0
|
CFLAGS += -g -O0
|
||||||
@@ -193,7 +191,6 @@ ifeq ($(target),cross-m68k-linux)
|
|||||||
include $(srcdir)/Makedefs.gcc
|
include $(srcdir)/Makedefs.gcc
|
||||||
CC = m68k-linux-gcc
|
CC = m68k-linux-gcc
|
||||||
CXX = m68k-linux-g++
|
CXX = m68k-linux-g++
|
||||||
DEFS += '-DUPX_CONFIG_H="config_h/linux.h"'
|
|
||||||
##LDLIBS += -lmcheck
|
##LDLIBS += -lmcheck
|
||||||
endif # cross-m68k-linux
|
endif # cross-m68k-linux
|
||||||
|
|
||||||
@@ -204,7 +201,6 @@ endif # cross-m68k-linux
|
|||||||
|
|
||||||
ifeq ($(target),sparc-sun-solaris)
|
ifeq ($(target),sparc-sun-solaris)
|
||||||
include $(srcdir)/Makedefs.gcc
|
include $(srcdir)/Makedefs.gcc
|
||||||
DEFS += '-DUPX_CONFIG_H="config_h/sparc_sun_solaris28.h"'
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -93,7 +93,7 @@ inline void set_be32(void *bb, unsigned v)
|
|||||||
|
|
||||||
inline unsigned get_le16(const void *bb)
|
inline unsigned get_le16(const void *bb)
|
||||||
{
|
{
|
||||||
#if defined(__i386__)
|
#if (ACC_ARCH_IA32)
|
||||||
return * (const unsigned short *) bb;
|
return * (const unsigned short *) bb;
|
||||||
#else
|
#else
|
||||||
const upx_bytep b = (const upx_bytep) bb;
|
const upx_bytep b = (const upx_bytep) bb;
|
||||||
@@ -106,7 +106,7 @@ inline unsigned get_le16(const void *bb)
|
|||||||
|
|
||||||
inline void set_le16(void *bb, unsigned v)
|
inline void set_le16(void *bb, unsigned v)
|
||||||
{
|
{
|
||||||
#if defined(__i386__)
|
#if (ACC_ARCH_IA32)
|
||||||
(* (unsigned short *) bb) = (unsigned short) (v & 0xffff);
|
(* (unsigned short *) bb) = (unsigned short) (v & 0xffff);
|
||||||
#else
|
#else
|
||||||
upx_bytep b = (upx_bytep) bb;
|
upx_bytep b = (upx_bytep) bb;
|
||||||
@@ -137,7 +137,7 @@ inline void set_le24(void *bb, unsigned v)
|
|||||||
|
|
||||||
inline unsigned get_le32(const void *bb)
|
inline unsigned get_le32(const void *bb)
|
||||||
{
|
{
|
||||||
#if defined(__i386__)
|
#if (ACC_ARCH_IA32)
|
||||||
return * (const unsigned *) bb;
|
return * (const unsigned *) bb;
|
||||||
#else
|
#else
|
||||||
const upx_bytep b = (const upx_bytep) bb;
|
const upx_bytep b = (const upx_bytep) bb;
|
||||||
@@ -152,7 +152,7 @@ inline unsigned get_le32(const void *bb)
|
|||||||
|
|
||||||
inline void set_le32(void *bb, unsigned v)
|
inline void set_le32(void *bb, unsigned v)
|
||||||
{
|
{
|
||||||
#if defined(__i386__)
|
#if (ACC_ARCH_IA32)
|
||||||
(* (unsigned *) bb) = v;
|
(* (unsigned *) bb) = v;
|
||||||
#else
|
#else
|
||||||
upx_bytep b = (upx_bytep) bb;
|
upx_bytep b = (upx_bytep) bb;
|
||||||
@@ -354,7 +354,7 @@ int le32_compare_signed(const void *e1, const void *e2);
|
|||||||
|
|
||||||
|
|
||||||
// just for testing...
|
// just for testing...
|
||||||
#if 0 && defined(__i386__) && defined(__GNUC_VERSION_HEX__)
|
#if 0 && defined(__GNUC_VERSION_HEX__) && (ACC_ARCH_IA32)
|
||||||
# if (__GNUC_VERSION_HEX__ >= 0x030200)
|
# if (__GNUC_VERSION_HEX__ >= 0x030200)
|
||||||
typedef unsigned short LE16_unaligned __attribute__((__packed__,__aligned__(1)));
|
typedef unsigned short LE16_unaligned __attribute__((__packed__,__aligned__(1)));
|
||||||
typedef unsigned int LE32_unaligned __attribute__((__packed__,__aligned__(1)));
|
typedef unsigned int LE32_unaligned __attribute__((__packed__,__aligned__(1)));
|
||||||
|
|||||||
+1
-1
@@ -130,7 +130,7 @@ static int init(FILE *f, int o, int now)
|
|||||||
if (!screen)
|
if (!screen)
|
||||||
screen = do_construct(screen_djgpp2_construct(),fd);
|
screen = do_construct(screen_djgpp2_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__MFX_WIN32)
|
#if (ACC_OS_WIN32)
|
||||||
if (!screen)
|
if (!screen)
|
||||||
screen = do_construct(screen_win32_construct(),fd);
|
screen = do_construct(screen_win32_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+78
-55
@@ -29,26 +29,73 @@
|
|||||||
#ifndef __UPX_CONF_H
|
#ifndef __UPX_CONF_H
|
||||||
#define __UPX_CONF_H
|
#define __UPX_CONF_H
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// ACC
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#if 0 && defined(__EMX__)
|
#if 0 && defined(__EMX__)
|
||||||
# include <sys/emx.h>
|
# include <sys/emx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(UPX_CONFIG_H)
|
#if 0 && defined(UPX_CONFIG_HEADER)
|
||||||
# include UPX_CONFIG_H
|
# define ACC_CONFIG_HEADER UPX_CONFIG_HEADER
|
||||||
|
#endif
|
||||||
|
#include "acc/acc.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__BORLANDC__)
|
||||||
|
# if (__BORLANDC__ < 0x550)
|
||||||
|
# error "need Borland C++ 5.5 or newer"
|
||||||
|
# endif
|
||||||
|
# define __UPX_CDECL __cdecl
|
||||||
|
# define SIGTYPEENTRY __cdecl
|
||||||
|
#elif defined(__DMC__)
|
||||||
|
# define __UPX_CDECL __cdecl
|
||||||
|
# define SIGTYPEENTRY __cdecl
|
||||||
|
#elif defined(__INTEL_COMPILER)
|
||||||
|
# if (__INTEL_COMPILER < 700)
|
||||||
|
# error "need Intel C++ 7.0 or newer"
|
||||||
|
# endif
|
||||||
|
# if defined(_WIN32)
|
||||||
|
# define __UPX_CDECL __cdecl
|
||||||
|
# define SIGTYPEENTRY __cdecl
|
||||||
|
# elif defined(__linux__)
|
||||||
|
# pragma warning(error: 424) // #424: extra ";" ignored
|
||||||
|
# pragma warning(disable: 193) // #193: zero used for undefined preprocessing identifier
|
||||||
|
# pragma warning(disable: 810) // #810: conversion from "A" to "B" may lose significant bits
|
||||||
|
# pragma warning(disable: 981) // #981: operands are evaluated in unspecified order
|
||||||
|
# pragma warning(disable: 1418) // #1418: external definition with no prior declaration
|
||||||
|
# else
|
||||||
|
# error "untested platform"
|
||||||
|
# endif
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
# if (_MSC_VER < 1100)
|
||||||
|
# error "need Visual C++ 5.0 or newer"
|
||||||
|
# endif
|
||||||
|
# define __UPX_CDECL __cdecl
|
||||||
|
# define SIGTYPEENTRY __cdecl
|
||||||
|
# pragma warning(disable: 4097) // W3: typedef-name 'A' used as synonym for class-name 'B'
|
||||||
|
# pragma warning(disable: 4511) // W3: 'class': copy constructor could not be generated
|
||||||
|
# pragma warning(disable: 4512) // W4: 'class': assignment operator could not be generated
|
||||||
|
# pragma warning(disable: 4514) // W4: 'function' : unreferenced inline function has been removed
|
||||||
|
# pragma warning(disable: 4710) // W4: 'function': function not inlined
|
||||||
|
#elif defined(__WATCOMC__)
|
||||||
|
# if (__WATCOMC__ < 1100)
|
||||||
|
# error "need Watcom C++ 11.0c or newer"
|
||||||
|
# endif
|
||||||
|
# define __UPX_CDECL __cdecl
|
||||||
|
# if defined(__cplusplus)
|
||||||
|
# pragma warning 656 9 // w5: define this function inside its class definition (may improve code quality)
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_STDINT_H)
|
|
||||||
# if !defined(__STDC_LIMIT_MACROS)
|
/*************************************************************************
|
||||||
# define __STDC_LIMIT_MACROS 1
|
//
|
||||||
# endif
|
**************************************************************************/
|
||||||
# if !defined(__STDC_CONSTANT_MACROS)
|
|
||||||
# define __STDC_CONSTANT_MACROS 1
|
|
||||||
# endif
|
|
||||||
# include <stdint.h>
|
|
||||||
#endif
|
|
||||||
#include <limits.h>
|
|
||||||
#include "version.h"
|
|
||||||
#include "tailor.h"
|
|
||||||
|
|
||||||
// upx_int64l is int_least64_t in <stdint.h> terminology
|
// upx_int64l is int_least64_t in <stdint.h> terminology
|
||||||
#if !defined(upx_int64l)
|
#if !defined(upx_int64l)
|
||||||
@@ -69,11 +116,6 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__i386__)
|
|
||||||
# if defined(__386__) || defined(_M_IX86)
|
|
||||||
# define __i386__ 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if defined(__linux__) && !defined(__unix__)
|
#if defined(__linux__) && !defined(__unix__)
|
||||||
# define __unix__ 1
|
# define __unix__ 1
|
||||||
#endif
|
#endif
|
||||||
@@ -129,46 +171,30 @@
|
|||||||
// system includes
|
// system includes
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if !defined(NO_SYS_TYPES_H)
|
|
||||||
# include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#undef NDEBUG
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#if defined(HAVE_ERRNO_H)
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
#if !defined(NO_FCNTL_H)
|
#endif
|
||||||
|
#if defined(HAVE_FCNTL_H)
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
#if !defined(NO_SYS_STAT_H)
|
#if defined(HAVE_IO_H)
|
||||||
# include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_IO_H) && !defined(NO_IO_H)
|
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_DOS_H) && !defined(NO_DOS_H)
|
#if defined(HAVE_DOS_H)
|
||||||
# include <dos.h>
|
# include <dos.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_MALLOC_H) && !defined(NO_MALLOC_H)
|
#if defined(HAVE_MALLOC_H)
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_ALLOCA_H) && !defined(NO_ALLOCA_H)
|
#if defined(HAVE_ALLOCA_H)
|
||||||
# include <alloca.h>
|
# include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_SIGNAL_H)
|
#if defined(HAVE_SIGNAL_H)
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_UNISTD_H)
|
|
||||||
# include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#if defined(TIME_WITH_SYS_TIME)
|
#if defined(TIME_WITH_SYS_TIME)
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
@@ -217,6 +243,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#undef NDEBUG
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// portab
|
// portab
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -351,7 +381,7 @@ typedef RETSIGTYPE (SIGTYPEENTRY *sig_type)(int);
|
|||||||
|
|
||||||
#undef __attribute_packed
|
#undef __attribute_packed
|
||||||
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
||||||
# if 1 && defined(__i386__)
|
# if (1 && ACC_ARCH_IA32)
|
||||||
# define __attribute_packed
|
# define __attribute_packed
|
||||||
# else
|
# else
|
||||||
# define __attribute_packed __attribute__((__packed__,__aligned__(1)))
|
# define __attribute_packed __attribute__((__packed__,__aligned__(1)))
|
||||||
@@ -393,23 +423,16 @@ typedef RETSIGTYPE (SIGTYPEENTRY *sig_type)(int);
|
|||||||
# undef USE_SETMODE
|
# undef USE_SETMODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef OPTIONS_VAR
|
||||||
|
# define OPTIONS_VAR "UPX"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// memory util
|
// memory util
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#undef UNUSED
|
#define UNUSED ACC_UNUSED
|
||||||
#if 1
|
|
||||||
# define UNUSED(var) ((void) &(var))
|
|
||||||
#elif 1 && defined(__GNUC__)
|
|
||||||
# define UNUSED(var) { typedef int __upx_unused[sizeof(var) ? 1 : -1]; }
|
|
||||||
#elif 0
|
|
||||||
# define UNUSED(var) do { } while (!sizeof(var))
|
|
||||||
#elif defined(__BORLANDC__)
|
|
||||||
# define UNUSED(parm) ((void)(parm))
|
|
||||||
#else
|
|
||||||
# define UNUSED(parm) (parm = parm)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TABLESIZE(table) ((sizeof(table)/sizeof((table)[0])))
|
#define TABLESIZE(table) ((sizeof(table)/sizeof((table)[0])))
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@
|
|||||||
# define USE_SCREEN
|
# define USE_SCREEN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1 && defined(__MFX_WIN32)
|
#if (1 && ACC_OS_WIN32)
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ void MemBuffer::allocForUncompression(unsigned uncompressed_size, unsigned extra
|
|||||||
unsigned size = uncompressed_size + extra;
|
unsigned size = uncompressed_size + extra;
|
||||||
// size += 512; // 512 safety bytes
|
// size += 512; // 512 safety bytes
|
||||||
// INFO: 3 bytes are the allowed overrun for the i386 asm_fast decompressors
|
// INFO: 3 bytes are the allowed overrun for the i386 asm_fast decompressors
|
||||||
#if defined(__i386__)
|
#if (ACC_ARCH_IA32)
|
||||||
size += 3;
|
size += 3;
|
||||||
#endif
|
#endif
|
||||||
alloc(size);
|
alloc(size);
|
||||||
|
|||||||
+8
-18
@@ -21,11 +21,8 @@
|
|||||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
|
||||||
#include "tailor.h"
|
|
||||||
#ifndef EOF
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef progname
|
#undef progname
|
||||||
#if 1
|
#if 1
|
||||||
@@ -66,8 +63,6 @@ static const char *my_progname(const char *argv0)
|
|||||||
#define optind mfx_optind
|
#define optind mfx_optind
|
||||||
#define opterr mfx_opterr
|
#define opterr mfx_opterr
|
||||||
#define optopt mfx_optopt
|
#define optopt mfx_optopt
|
||||||
#define my_index strchr
|
|
||||||
#define my_strlen strlen
|
|
||||||
#undef BAD_OPTION
|
#undef BAD_OPTION
|
||||||
|
|
||||||
/* For communication from `getopt' to the caller.
|
/* For communication from `getopt' to the caller.
|
||||||
@@ -394,15 +389,10 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|||||||
int indfound = 0;
|
int indfound = 0;
|
||||||
int needexact = 0;
|
int needexact = 0;
|
||||||
|
|
||||||
#if defined(DOSISH)
|
|
||||||
/* allow `--option#value' because you cannout assign a '='
|
/* allow `--option#value' because you cannout assign a '='
|
||||||
to an environment variable under DOS command.com */
|
to an environment variable under DOS command.com */
|
||||||
while (*s && *s != '=' && * s != '#')
|
while (*s && *s != '=' && * s != '#')
|
||||||
s++;
|
s++;
|
||||||
#else
|
|
||||||
while (*s && *s != '=')
|
|
||||||
s++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Test all options for either exact match or abbreviated matches. */
|
/* Test all options for either exact match or abbreviated matches. */
|
||||||
for (p = longopts, option_index = 0; p->name;
|
for (p = longopts, option_index = 0; p->name;
|
||||||
@@ -411,7 +401,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|||||||
{
|
{
|
||||||
if (p->has_arg & 0x10)
|
if (p->has_arg & 0x10)
|
||||||
needexact = 1;
|
needexact = 1;
|
||||||
if ((unsigned) (s - nextchar) == my_strlen (p->name))
|
if ((unsigned) (s - nextchar) == strlen (p->name))
|
||||||
{
|
{
|
||||||
/* Exact match found. */
|
/* Exact match found. */
|
||||||
pfound = p;
|
pfound = p;
|
||||||
@@ -436,7 +426,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|||||||
if (opterr)
|
if (opterr)
|
||||||
fprintf (stderr, "%s: unrecognized option `%s'\n",
|
fprintf (stderr, "%s: unrecognized option `%s'\n",
|
||||||
progname(argv[0]), argv[optind]);
|
progname(argv[0]), argv[optind]);
|
||||||
nextchar += my_strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
optind++;
|
optind++;
|
||||||
return BAD_OPTION;
|
return BAD_OPTION;
|
||||||
}
|
}
|
||||||
@@ -445,7 +435,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|||||||
if (opterr)
|
if (opterr)
|
||||||
fprintf (stderr, "%s: option `%s' is ambiguous\n",
|
fprintf (stderr, "%s: option `%s' is ambiguous\n",
|
||||||
progname(argv[0]), argv[optind]);
|
progname(argv[0]), argv[optind]);
|
||||||
nextchar += my_strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
optind++;
|
optind++;
|
||||||
return BAD_OPTION;
|
return BAD_OPTION;
|
||||||
}
|
}
|
||||||
@@ -478,7 +468,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|||||||
"%s: option `%c%s' doesn't allow an argument\n",
|
"%s: option `%c%s' doesn't allow an argument\n",
|
||||||
progname(argv[0]), argv[optind - 1][0], pfound->name);
|
progname(argv[0]), argv[optind - 1][0], pfound->name);
|
||||||
}
|
}
|
||||||
nextchar += my_strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
return BAD_OPTION;
|
return BAD_OPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,11 +486,11 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|||||||
fprintf (stderr, "%s: option `--%s%s' requires an argument\n",
|
fprintf (stderr, "%s: option `--%s%s' requires an argument\n",
|
||||||
progname(argv[0]), pfound->name,
|
progname(argv[0]), pfound->name,
|
||||||
(pfound->has_arg & 0x20) ? "=" : "");
|
(pfound->has_arg & 0x20) ? "=" : "");
|
||||||
nextchar += my_strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
return optstring[0] == ':' ? ':' : BAD_OPTION;
|
return optstring[0] == ':' ? ':' : BAD_OPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nextchar += my_strlen (nextchar);
|
nextchar += strlen (nextchar);
|
||||||
if (longind != NULL)
|
if (longind != NULL)
|
||||||
*longind = option_index;
|
*longind = option_index;
|
||||||
if (pfound->flag)
|
if (pfound->flag)
|
||||||
@@ -518,7 +508,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|||||||
#ifdef GETOPT_COMPAT
|
#ifdef GETOPT_COMPAT
|
||||||
|| argv[optind][0] == '+'
|
|| argv[optind][0] == '+'
|
||||||
#endif /* GETOPT_COMPAT */
|
#endif /* GETOPT_COMPAT */
|
||||||
|| my_index (optstring, *nextchar) == NULL)
|
|| strchr (optstring, *nextchar) == NULL)
|
||||||
{
|
{
|
||||||
if (opterr)
|
if (opterr)
|
||||||
{
|
{
|
||||||
@@ -542,7 +532,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|||||||
|
|
||||||
{
|
{
|
||||||
char c = *nextchar++;
|
char c = *nextchar++;
|
||||||
const char *temp = my_index (optstring, c);
|
const char *temp = strchr (optstring, c);
|
||||||
|
|
||||||
/* Increment `optind' when we start to process its last character. */
|
/* Increment `optind' when we start to process its last character. */
|
||||||
if (*nextchar == '\0')
|
if (*nextchar == '\0')
|
||||||
|
|||||||
+1
-1
@@ -277,7 +277,7 @@ void PackWcle::preprocessFixups()
|
|||||||
if (jc == 0)
|
if (jc == 0)
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// FIXME: implement this
|
||||||
thowCantPack("files without relocations are not supported");
|
throwCantPack("files without relocations are not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArray(rl, jc);
|
ByteArray(rl, jc);
|
||||||
|
|||||||
+2
-2
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_SCREEN) && defined(__MFX_WIN32)
|
#if defined(USE_SCREEN) && (ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
@@ -520,7 +520,7 @@ screen_t *screen_win32_construct(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* defined(USE_SCREEN) && defined(__MFX_WIN32) */
|
#endif /* defined(USE_SCREEN) && (ACC_OS_WIN32 || ACC_OS_WIN64) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
-249
@@ -1,249 +0,0 @@
|
|||||||
/* tailor.h --
|
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
|
||||||
|
|
||||||
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
Copyright (C) 1996-2003 Laszlo Molnar
|
|
||||||
All Rights Reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
|
||||||
and/or modify them under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING.
|
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
|
|
||||||
# define __CYGWIN__ __CYGWIN32__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if !defined(__MFX_DOS) && !defined(__MFX_WIN) && !defined(__MFX_OS2)
|
|
||||||
#if !defined(__MFX_TOS) && !defined(__MFX_PALMOS)
|
|
||||||
# if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
|
|
||||||
# define __MFX_WIN
|
|
||||||
# elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
|
||||||
# define __MFX_WIN
|
|
||||||
# elif defined(__CYGWIN__) || defined(__MINGW32__)
|
|
||||||
# define __MFX_WIN
|
|
||||||
# elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
|
|
||||||
# define __MFX_WIN
|
|
||||||
# elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
|
|
||||||
# define __MFX_DOS
|
|
||||||
# elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
|
|
||||||
# define __MFX_OS2
|
|
||||||
# elif defined(__TOS__) || defined(__atarist__)
|
|
||||||
# define __MFX_TOS
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__MFX_DOS) && !defined(__MFX_DOS16) && !defined(__MFX_DOS32)
|
|
||||||
# define __MFX_DOS32
|
|
||||||
#endif
|
|
||||||
#if defined(__MFX_WIN) && !defined(__MFX_WIN16) && !defined(__MFX_WIN32)
|
|
||||||
# define __MFX_WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(DOSISH)
|
|
||||||
# if defined(__MFX_DOS) || defined(__MFX_WIN)
|
|
||||||
# define DOSISH
|
|
||||||
# elif defined(__MFX_OS2) || defined(__EMX__)
|
|
||||||
# define DOSISH
|
|
||||||
# elif defined(__MFX_TOS)
|
|
||||||
# define DOSISH
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DOSISH)
|
|
||||||
# define HAVE_SIGNAL_H 1
|
|
||||||
# define HAVE_CTIME 1
|
|
||||||
# define HAVE_FILENO 1
|
|
||||||
# define HAVE_GMTIME 1
|
|
||||||
# define HAVE_LOCALTIME 1
|
|
||||||
# define HAVE_MEMCMP 1
|
|
||||||
# define HAVE_MEMCPY 1
|
|
||||||
# define HAVE_MEMMOVE 1
|
|
||||||
# define HAVE_MEMSET 1
|
|
||||||
# define HAVE_SETMODE 1
|
|
||||||
# define HAVE_STRCHR 1
|
|
||||||
# define HAVE_STRDUP 1
|
|
||||||
# define HAVE_STRFTIME 1
|
|
||||||
# if defined(__CYGWIN__)
|
|
||||||
# define HAVE_STRCASECMP 1
|
|
||||||
# define HAVE_STRNCASECMP 1
|
|
||||||
# else
|
|
||||||
# define HAVE_STRICMP 1
|
|
||||||
# define HAVE_STRNICMP 1
|
|
||||||
# endif
|
|
||||||
# if !defined(DIR_SEP)
|
|
||||||
# define DIR_SEP "/\\"
|
|
||||||
# endif
|
|
||||||
# if !defined(fn_tolower)
|
|
||||||
# define fn_tolower(x) tolower(((unsigned char)(x)))
|
|
||||||
# endif
|
|
||||||
# undef __UNIX__
|
|
||||||
# undef UNIX
|
|
||||||
# undef __unix__
|
|
||||||
# undef unix
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__DJGPP__) || defined(__EMX__) || defined(__CYGWIN__)
|
|
||||||
# define TIME_WITH_SYS_TIME 1
|
|
||||||
# define HAVE_IO_H 1
|
|
||||||
# define HAVE_UNISTD_H 1
|
|
||||||
# define HAVE_UTIME_H 1
|
|
||||||
# define HAVE_MODE_T 1
|
|
||||||
# define HAVE_CHMOD 1
|
|
||||||
# define HAVE_GETTIMEOFDAY 1
|
|
||||||
# define HAVE_UTIME 1
|
|
||||||
#elif defined(__MINGW32__)
|
|
||||||
# define TIME_WITH_SYS_TIME 1
|
|
||||||
# define HAVE_CONIO_H 1
|
|
||||||
# define HAVE_IO_H 1
|
|
||||||
# define HAVE_SHARE_H 1
|
|
||||||
# define HAVE_UNISTD_H 1
|
|
||||||
# define HAVE_SYS_UTIME_H 1
|
|
||||||
# define HAVE_MODE_T 1
|
|
||||||
# define HAVE_CHMOD 1
|
|
||||||
# define HAVE_UTIME 1
|
|
||||||
#elif defined(__MINT__)
|
|
||||||
# undef HAVE_SETMODE
|
|
||||||
# define TIME_WITH_SYS_TIME 1
|
|
||||||
# define HAVE_UNISTD_H 1
|
|
||||||
# define HAVE_UTIME_H 1
|
|
||||||
# define HAVE_CHMOD 1
|
|
||||||
# define HAVE_CHOWN 1
|
|
||||||
# define HAVE_UTIME 1
|
|
||||||
#elif defined(__BORLANDC__)
|
|
||||||
# if (__BORLANDC__ < 0x551)
|
|
||||||
# error "need Borland C++ 5.5.1 or newer"
|
|
||||||
# endif
|
|
||||||
# define __UPX_CDECL __cdecl
|
|
||||||
# define SIGTYPEENTRY __cdecl
|
|
||||||
# define HAVE_CONIO_H 1
|
|
||||||
# define HAVE_IO_H 1
|
|
||||||
# define HAVE_MALLOC_H 1
|
|
||||||
# define HAVE_CHMOD 1
|
|
||||||
# define HAVE_SHARE_H 1
|
|
||||||
# define HAVE_UTIME_H 1
|
|
||||||
# define HAVE_UTIME 1
|
|
||||||
# define HAVE_VSNPRINTF 1
|
|
||||||
# define vsnprintf _vsnprintf
|
|
||||||
#elif defined(__DMC__)
|
|
||||||
# define __UPX_CDECL __cdecl
|
|
||||||
# define SIGTYPEENTRY __cdecl
|
|
||||||
# define HAVE_IO_H 1
|
|
||||||
# define HAVE_MALLOC_H 1
|
|
||||||
# define HAVE_UTIME_H 1
|
|
||||||
# define HAVE_MODE_T 1
|
|
||||||
# define HAVE_CHMOD 1
|
|
||||||
# define HAVE_UTIME 1
|
|
||||||
#elif defined(__INTEL_COMPILER)
|
|
||||||
# if (__INTEL_COMPILER < 700)
|
|
||||||
# error "need Intel C++ 7.0 or newer"
|
|
||||||
# endif
|
|
||||||
# if defined(_WIN32)
|
|
||||||
# define __UPX_CDECL __cdecl
|
|
||||||
# define SIGTYPEENTRY __cdecl
|
|
||||||
# define HAVE_CONIO_H 1
|
|
||||||
# define HAVE_IO_H 1
|
|
||||||
# define HAVE_MALLOC_H 1
|
|
||||||
# define HAVE_SHARE_H 1
|
|
||||||
# define HAVE_SYS_UTIME_H 1
|
|
||||||
# define HAVE_CHMOD 1
|
|
||||||
# define HAVE_UTIME 1
|
|
||||||
# define HAVE_VSNPRINTF 1
|
|
||||||
# define vsnprintf _vsnprintf
|
|
||||||
# elif defined(__linux__)
|
|
||||||
# pragma warning(error: 424) // #424: extra ";" ignored
|
|
||||||
# pragma warning(disable: 193) // #193: zero used for undefined preprocessing identifier
|
|
||||||
|
|
||||||
# pragma warning(disable: 810) // #810: conversion from "A" to "B" may lose significant bits
|
|
||||||
# pragma warning(disable: 981) // #981: operands are evaluated in unspecified order
|
|
||||||
# pragma warning(disable: 1418) // #1418: external definition with no prior declaration
|
|
||||||
# else
|
|
||||||
# error "untested platform"
|
|
||||||
# endif
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
# if (_MSC_VER < 1100)
|
|
||||||
# error "need Visual C++ 5.0 or newer"
|
|
||||||
# endif
|
|
||||||
# define __UPX_CDECL __cdecl
|
|
||||||
# define SIGTYPEENTRY __cdecl
|
|
||||||
# define HAVE_CONIO_H 1
|
|
||||||
# define HAVE_IO_H 1
|
|
||||||
# define HAVE_MALLOC_H 1
|
|
||||||
# define HAVE_CHMOD 1
|
|
||||||
# if (_MSC_VER >= 1000)
|
|
||||||
# define HAVE_SHARE_H 1
|
|
||||||
# define HAVE_SYS_UTIME_H 1
|
|
||||||
# define HAVE_UTIME 1
|
|
||||||
# define HAVE_VSNPRINTF 1
|
|
||||||
# define vsnprintf _vsnprintf
|
|
||||||
# pragma warning(disable: 4097) // W3: typedef-name 'A' used as synonym for class-name 'B'
|
|
||||||
# pragma warning(disable: 4511) // W3: 'class': copy constructor could not be generated
|
|
||||||
# pragma warning(disable: 4512) // W4: 'class': assignment operator could not be generated
|
|
||||||
# pragma warning(disable: 4514) // W4: 'function' : unreferenced inline function has been removed
|
|
||||||
# pragma warning(disable: 4710) // W4: 'function': function not inlined
|
|
||||||
# endif
|
|
||||||
#elif defined(__WATCOMC__)
|
|
||||||
# if (__WATCOMC__ < 1100)
|
|
||||||
# error "need Watcom C++ 11.0c or newer"
|
|
||||||
# define NO_BOOL 1
|
|
||||||
# endif
|
|
||||||
# define __UPX_CDECL __cdecl
|
|
||||||
# define HAVE_IO_H 1
|
|
||||||
# define HAVE_SYS_UTIME_H 1
|
|
||||||
# define HAVE_CHMOD 1
|
|
||||||
# define HAVE_UTIME 1
|
|
||||||
# define HAVE_VSNPRINTF 1
|
|
||||||
# define vsnprintf _vsnprintf
|
|
||||||
# if defined(__cplusplus)
|
|
||||||
# pragma warning 656 9 // w5: define this function inside its class definition (may improve code quality)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__MFX_DOS)
|
|
||||||
# define HAVE_DOS_H 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#ifndef DIR_SEP
|
|
||||||
# define DIR_SEP "/"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OPTIONS_VAR
|
|
||||||
# define OPTIONS_VAR "UPX"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef fn_tolower
|
|
||||||
# define fn_tolower(x) (x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
+12
-6
@@ -238,16 +238,22 @@ int upx_tolower(int c)
|
|||||||
// filename util
|
// filename util
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
static const char dir_sep[] = DIR_SEP;
|
#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_TOS || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
|
|
||||||
|
static const char dir_sep[] = "/\\";
|
||||||
|
#define fn_is_drive(s) (s[0] && s[1] == ':')
|
||||||
#define fn_is_sep(c) (strchr(dir_sep,c) != NULL)
|
#define fn_is_sep(c) (strchr(dir_sep,c) != NULL)
|
||||||
|
#define fn_skip_drive(s) (fn_is_drive(s) ? (s) + 2 : (s))
|
||||||
|
#define fn_tolower(c) (tolower(((unsigned char)(c))))
|
||||||
|
|
||||||
#if defined(DOSISH)
|
|
||||||
#define fn_is_drive(n) (n[0] && n[1] == ':')
|
|
||||||
#define fn_skip_drive(n) (fn_is_drive(n) ? (n) + 2 : (n))
|
|
||||||
#else
|
#else
|
||||||
#define fn_is_drive(n) (0)
|
|
||||||
#define fn_skip_drive(n) (n)
|
static const char dir_sep[] = "/";
|
||||||
|
#define fn_is_drive(s) (0)
|
||||||
|
#define fn_is_sep(c) ((c) == '/')
|
||||||
|
#define fn_skip_drive(s) (s)
|
||||||
|
#define fn_tolower(c) (c)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#if defined(__DJGPP__)
|
#if defined(__DJGPP__)
|
||||||
# define USE_FTIME
|
# define USE_FTIME
|
||||||
#elif defined(__MFX_WIN32) && defined(_MSC_VER)
|
#elif defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))
|
||||||
# define USE__FUTIME
|
# define USE__FUTIME
|
||||||
#elif defined(HAVE_UTIME)
|
#elif defined(HAVE_UTIME)
|
||||||
# define USE_UTIME
|
# define USE_UTIME
|
||||||
|
|||||||
Reference in New Issue
Block a user