Removed some old and dead code.
committer: mfx <mfx> 1126744217 +0000
This commit is contained in:
+34
-42
@@ -360,26 +360,6 @@ __attribute_packed;
|
|||||||
// global operators
|
// global operators
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
inline bool operator < (const BE16& v1, const BE16& v2) {
|
|
||||||
return (unsigned) v1 < (unsigned) v2;
|
|
||||||
}
|
|
||||||
inline bool operator < (const BE32& v1, const BE32& v2) {
|
|
||||||
return (unsigned) v1 < (unsigned) v2;
|
|
||||||
}
|
|
||||||
inline bool operator < (const BE64& v1, const BE64& v2) {
|
|
||||||
return (acc_uint64l_t) v1 < (acc_uint64l_t) v2;
|
|
||||||
}
|
|
||||||
inline bool operator < (const LE16& v1, const LE16& v2) {
|
|
||||||
return (unsigned) v1 < (unsigned) v2;
|
|
||||||
}
|
|
||||||
inline bool operator < (const LE32& v1, const LE32& v2) {
|
|
||||||
return (unsigned) v1 < (unsigned) v2;
|
|
||||||
}
|
|
||||||
inline bool operator < (const LE64& v1, const LE64& v2) {
|
|
||||||
return (acc_uint64l_t) v1 < (acc_uint64l_t) v2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator + (T* ptr, const BE16& v) { return ptr + (unsigned) v; }
|
inline T* operator + (T* ptr, const BE16& v) { return ptr + (unsigned) v; }
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -424,22 +404,22 @@ template <class T> T* operator - (T* ptr, const LE64& v);
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// for use with qsort()
|
// for use with qsort()
|
||||||
int __acc_cdecl_qsort be16_compare(const void *a, const void *b);
|
int __acc_cdecl_qsort be16_compare(const void *, const void *);
|
||||||
int __acc_cdecl_qsort be24_compare(const void *a, const void *b);
|
int __acc_cdecl_qsort be24_compare(const void *, const void *);
|
||||||
int __acc_cdecl_qsort be32_compare(const void *a, const void *b);
|
int __acc_cdecl_qsort be32_compare(const void *, const void *);
|
||||||
int __acc_cdecl_qsort be64_compare(const void *a, const void *b);
|
int __acc_cdecl_qsort be64_compare(const void *, const void *);
|
||||||
int __acc_cdecl_qsort le16_compare(const void *a, const void *b);
|
int __acc_cdecl_qsort le16_compare(const void *, const void *);
|
||||||
int __acc_cdecl_qsort le24_compare(const void *a, const void *b);
|
int __acc_cdecl_qsort le24_compare(const void *, const void *);
|
||||||
int __acc_cdecl_qsort le32_compare(const void *a, const void *b);
|
int __acc_cdecl_qsort le32_compare(const void *, const void *);
|
||||||
int __acc_cdecl_qsort le64_compare(const void *a, const void *b);
|
int __acc_cdecl_qsort le64_compare(const void *, const void *);
|
||||||
int __acc_cdecl_qsort be16_compare_signed(const void *a, const void *b);
|
int __acc_cdecl_qsort be16_compare_signed(const void *, const void *);
|
||||||
int __acc_cdecl_qsort be24_compare_signed(const void *a, const void *b);
|
int __acc_cdecl_qsort be24_compare_signed(const void *, const void *);
|
||||||
int __acc_cdecl_qsort be32_compare_signed(const void *a, const void *b);
|
int __acc_cdecl_qsort be32_compare_signed(const void *, const void *);
|
||||||
int __acc_cdecl_qsort be64_compare_signed(const void *a, const void *b);
|
int __acc_cdecl_qsort be64_compare_signed(const void *, const void *);
|
||||||
int __acc_cdecl_qsort le16_compare_signed(const void *a, const void *b);
|
int __acc_cdecl_qsort le16_compare_signed(const void *, const void *);
|
||||||
int __acc_cdecl_qsort le24_compare_signed(const void *a, const void *b);
|
int __acc_cdecl_qsort le24_compare_signed(const void *, const void *);
|
||||||
int __acc_cdecl_qsort le32_compare_signed(const void *a, const void *b);
|
int __acc_cdecl_qsort le32_compare_signed(const void *, const void *);
|
||||||
int __acc_cdecl_qsort le64_compare_signed(const void *a, const void *b);
|
int __acc_cdecl_qsort le64_compare_signed(const void *, const void *);
|
||||||
|
|
||||||
|
|
||||||
// just for testing...
|
// just for testing...
|
||||||
@@ -447,20 +427,32 @@ int __acc_cdecl_qsort le64_compare_signed(const void *a, const void *b);
|
|||||||
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x030200)
|
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x030200)
|
||||||
typedef acc_uint16e_t LE16_unaligned __attribute__((__aligned__(1)));
|
typedef acc_uint16e_t LE16_unaligned __attribute__((__aligned__(1)));
|
||||||
typedef acc_uint32e_t LE32_unaligned __attribute__((__aligned__(1)));
|
typedef acc_uint32e_t LE32_unaligned __attribute__((__aligned__(1)));
|
||||||
# define LE16 LE16_unaligned
|
# ifndef LE16
|
||||||
# define LE32 LE32_unaligned
|
# define LE16 LE16_unaligned
|
||||||
|
# endif
|
||||||
|
# ifndef LE16
|
||||||
|
# define LE32 LE32_unaligned
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if 0 && (ACC_ARCH_I386) && (ACC_CC_INTELC)
|
#if 0 && (ACC_ARCH_I386) && (ACC_CC_INTELC)
|
||||||
typedef __declspec(align(1)) acc_uint16e_t LE16_unaligned;
|
typedef __declspec(align(1)) acc_uint16e_t LE16_unaligned;
|
||||||
typedef __declspec(align(1)) acc_uint32e_t LE32_unaligned;
|
typedef __declspec(align(1)) acc_uint32e_t LE32_unaligned;
|
||||||
# define LE16 LE16_unaligned
|
# ifndef LE16
|
||||||
# define LE32 LE32_unaligned
|
# define LE16 LE16_unaligned
|
||||||
|
# endif
|
||||||
|
# ifndef LE16
|
||||||
|
# define LE32 LE32_unaligned
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_MSC) && (_MSC_VER >= 1200)
|
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_MSC) && (_MSC_VER >= 1200)
|
||||||
typedef __declspec(align(1)) acc_uint16e_t LE16_unaligned;
|
typedef __declspec(align(1)) acc_uint16e_t LE16_unaligned;
|
||||||
typedef __declspec(align(1)) acc_uint32e_t LE32_unaligned;
|
typedef __declspec(align(1)) acc_uint32e_t LE32_unaligned;
|
||||||
# define LE16 LE16_unaligned
|
# ifndef LE16
|
||||||
# define LE32 LE32_unaligned
|
# define LE16 LE16_unaligned
|
||||||
|
# endif
|
||||||
|
# ifndef LE16
|
||||||
|
# define LE32 LE32_unaligned
|
||||||
|
# endif
|
||||||
# pragma warning(disable: 4244) // Wx: conversion, possible loss of data
|
# pragma warning(disable: 4244) // Wx: conversion, possible loss of data
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -91,7 +91,7 @@ int upx_compress ( const upx_bytep src, upx_uint src_len,
|
|||||||
conf.bb_size = 0;
|
conf.bb_size = 0;
|
||||||
if (method >= M_NRV2B_LE32 && method <= M_CL1B_LE16)
|
if (method >= M_NRV2B_LE32 && method <= M_CL1B_LE16)
|
||||||
{
|
{
|
||||||
static unsigned char sizes[3]={32,8,16};
|
static const unsigned char sizes[3]={32,8,16};
|
||||||
conf.bb_size = sizes[(method - M_NRV2B_LE32) % 3];
|
conf.bb_size = sizes[(method - M_NRV2B_LE32) % 3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+2
-4
@@ -32,14 +32,12 @@
|
|||||||
#if defined(WITH_NRV)
|
#if defined(WITH_NRV)
|
||||||
# include "compress_nrv.ch"
|
# include "compress_nrv.ch"
|
||||||
#elif defined(WITH_UCL)
|
#elif defined(WITH_UCL)
|
||||||
|
# define ALG_NRV2E
|
||||||
# define upx_adler32 upx_adler32
|
# define upx_adler32 upx_adler32
|
||||||
//# define upx_crc32 upx_crc32
|
//# define upx_crc32 upx_crc32
|
||||||
# define upx_compress upx_compress
|
# define upx_compress upx_compress
|
||||||
# define upx_decompress upx_decompress
|
# define upx_decompress upx_decompress
|
||||||
# if (UPX_VERSION_HEX >= 0x019000)
|
# define upx_test_overlap upx_test_overlap
|
||||||
# define ALG_NRV2E
|
|
||||||
# define upx_test_overlap upx_test_overlap
|
|
||||||
# endif
|
|
||||||
# include "compress.ch"
|
# include "compress.ch"
|
||||||
#else
|
#else
|
||||||
# error
|
# error
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ public:
|
|||||||
|
|
||||||
off_t getBytesWritten() const { return bytes_written; }
|
off_t getBytesWritten() const { return bytes_written; }
|
||||||
|
|
||||||
#if (UPX_VERSION_HEX >= 0x019000)
|
|
||||||
// FIXME - these won't work when using the `--stdout' option
|
// FIXME - these won't work when using the `--stdout' option
|
||||||
virtual void seek(off_t off, int whence)
|
virtual void seek(off_t off, int whence)
|
||||||
{
|
{
|
||||||
@@ -144,7 +143,6 @@ public:
|
|||||||
write(buf, len);
|
write(buf, len);
|
||||||
bytes_written -= len; // restore
|
bytes_written -= len; // restore
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// util
|
// util
|
||||||
static void dump(const char *name, const void *buf, int len, int flags=-1);
|
static void dump(const char *name, const void *buf, int len, int flags=-1);
|
||||||
|
|||||||
+2
-2
@@ -144,8 +144,8 @@ static const char *mkline(unsigned long fu_len, unsigned long fc_len,
|
|||||||
const char *format_name, const char *filename,
|
const char *format_name, const char *filename,
|
||||||
bool decompress=false)
|
bool decompress=false)
|
||||||
{
|
{
|
||||||
static char buf[2000];
|
static char buf[2048];
|
||||||
char r[7+1] = "";
|
char r[7+1];
|
||||||
char fn[13+1];
|
char fn[13+1];
|
||||||
const char *f;
|
const char *f;
|
||||||
|
|
||||||
|
|||||||
-225
@@ -203,94 +203,6 @@ int find_le64(const void *b, int blen, acc_uint64l_t what)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// find util
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if (UPX_VERSION_HEX < 0x019000)
|
|
||||||
|
|
||||||
upx_bytep pfind(const void *b, int blen, const void *what, int wlen)
|
|
||||||
{
|
|
||||||
if (b == NULL || blen <= 0 || what == NULL || wlen <= 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
int i;
|
|
||||||
const upx_bytep base = (const upx_bytep) b;
|
|
||||||
unsigned char firstc = * (const upx_bytep) what;
|
|
||||||
|
|
||||||
blen -= wlen;
|
|
||||||
for (i = 0; i <= blen; i++, base++)
|
|
||||||
if (*base == firstc && memcmp(base, what, wlen) == 0)
|
|
||||||
return const_cast<upx_bytep>(base);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
upx_bytep pfind_be16(const void *b, int blen, unsigned what)
|
|
||||||
{
|
|
||||||
unsigned char w[2];
|
|
||||||
set_be16(w, what);
|
|
||||||
return pfind(b, blen, w, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
upx_bytep pfind_be32(const void *b, int blen, unsigned what)
|
|
||||||
{
|
|
||||||
unsigned char w[4];
|
|
||||||
set_be32(w, what);
|
|
||||||
return pfind(b, blen, w, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
upx_bytep pfind_le16(const void *b, int blen, unsigned what)
|
|
||||||
{
|
|
||||||
unsigned char w[2];
|
|
||||||
set_le16(w, what);
|
|
||||||
return pfind(b, blen, w, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
upx_bytep pfind_le32(const void *b, int blen, unsigned what)
|
|
||||||
{
|
|
||||||
unsigned char w[4];
|
|
||||||
set_le32(w, what);
|
|
||||||
return pfind(b, blen, w, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* UPX_VERSION_HEX */
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// ctype util
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
bool upx_isdigit(int c)
|
|
||||||
{
|
|
||||||
return c >= '0' && c <= '9';
|
|
||||||
}
|
|
||||||
|
|
||||||
bool upx_islower(int c)
|
|
||||||
{
|
|
||||||
return c >= 'a' && c <= 'z';
|
|
||||||
}
|
|
||||||
|
|
||||||
bool upx_isspace(int c)
|
|
||||||
{
|
|
||||||
// according to "C" and "POSIX" locales
|
|
||||||
return strchr(" \f\n\r\t\v", c) != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int upx_tolower(int c)
|
|
||||||
{
|
|
||||||
if (c >= 'A' && c <= 'Z')
|
|
||||||
c += 'a' - 'A';
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// filename util
|
// filename util
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -594,39 +506,6 @@ unsigned get_ratio(unsigned u_len, unsigned c_len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// memory debugging
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if defined(WITH_GC)
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
#undef malloc
|
|
||||||
#undef realloc
|
|
||||||
#undef free
|
|
||||||
#ifndef __malloc_ptr_t
|
|
||||||
# define __malloc_ptr_t __ptr_t
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__malloc_ptr_t malloc(size_t size)
|
|
||||||
{
|
|
||||||
return GC_MALLOC(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
__malloc_ptr_t realloc(__malloc_ptr_t ptr, size_t size)
|
|
||||||
{
|
|
||||||
return GC_REALLOC(ptr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void free(__malloc_ptr_t ptr)
|
|
||||||
{
|
|
||||||
GC_FREE(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
}; // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// Don't link these functions from libc ==> save xxx bytes
|
// Don't link these functions from libc ==> save xxx bytes
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -653,110 +532,6 @@ time_t time(time_t *t)
|
|||||||
#endif /* __DJGPP__ */
|
#endif /* __DJGPP__ */
|
||||||
|
|
||||||
|
|
||||||
// These space savings are only useful when building a statically
|
|
||||||
// linked version, so this is disabled for now.
|
|
||||||
#if 0 && defined(__linux__) && defined(__GLIBC__)
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// We don't need floating point support in printf().
|
|
||||||
// See glibc/stdio-common/*
|
|
||||||
int __printf_fp(void)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int __printf_fphex(void)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// We don't need multibyte character support.
|
|
||||||
// See <wchar.h> and glibc/xxx/vfprintf.c
|
|
||||||
int mblen(const char *, size_t)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int mbtowc(...)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int mbrtowc(...)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// glibc internals
|
|
||||||
size_t __ctype_get_mb_cur_max(void)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
int __mbrlen(...)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int __mbrtowc(...)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int __wcrtomb(...)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
int __wcsrtombs(...)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// see strtol.c
|
|
||||||
int __btowc(...)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// We don't need *scanf.
|
|
||||||
// See iovsscanf.c
|
|
||||||
// (libc6 2.1.1-10: this function pulls in ~80kB code !)
|
|
||||||
int _IO_vsscanf(void)
|
|
||||||
{
|
|
||||||
assert(0);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// FIXME - also should get rid of this intl stuff
|
|
||||||
// see glibc/intl/*
|
|
||||||
static const char _nl_default_default_domain[] = "messages";
|
|
||||||
static const char *_nl_current_default_domain = _nl_default_default_domain;
|
|
||||||
static const char _nl_default_dirname[] = "";
|
|
||||||
char *bindtextdomain(const char *, const char *)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
char *textdomain(const char *)
|
|
||||||
{
|
|
||||||
return (char *) _nl_current_default_domain;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __linux__ && __GLIBC__ */
|
|
||||||
|
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,14 +58,6 @@ int find_le16(const void *b, int blen, unsigned what);
|
|||||||
int find_le32(const void *b, int blen, unsigned what);
|
int find_le32(const void *b, int blen, unsigned what);
|
||||||
int find_le64(const void *b, int blen, acc_uint64l_t what);
|
int find_le64(const void *b, int blen, acc_uint64l_t what);
|
||||||
|
|
||||||
#if (UPX_VERSION_HEX < 0x019000)
|
|
||||||
upx_bytep pfind(const void *b, int blen, const void *what, int wlen);
|
|
||||||
upx_bytep pfind_be16(const void *b, int blen, unsigned what);
|
|
||||||
upx_bytep pfind_be32(const void *b, int blen, unsigned what);
|
|
||||||
upx_bytep pfind_le16(const void *b, int blen, unsigned what);
|
|
||||||
upx_bytep pfind_le32(const void *b, int blen, unsigned what);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0530))
|
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0530))
|
||||||
#elif (ACC_CC_DMC && (__DMC__ < 0x830))
|
#elif (ACC_CC_DMC && (__DMC__ < 0x830))
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#define UPX_VERSION_HEX 0x019400 /* 01.94.00 */
|
#define UPX_VERSION_HEX 0x019400 /* 01.94.00 */
|
||||||
#define UPX_VERSION_STRING "1.94 beta"
|
#define UPX_VERSION_STRING "1.94 beta"
|
||||||
#define UPX_VERSION_STRING4 "1.94"
|
#define UPX_VERSION_STRING4 "1.94"
|
||||||
#define UPX_VERSION_DATE "Feb 8th 2005"
|
#define UPX_VERSION_DATE "Sep 15th 2005"
|
||||||
|
|||||||
+2
-18
@@ -33,16 +33,13 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
|
|
||||||
#define ALWAYS_CHMOD 1
|
|
||||||
#if defined(__DJGPP__)
|
#if defined(__DJGPP__)
|
||||||
# define USE_FTIME 1
|
# define USE_FTIME 1
|
||||||
# undef ALWAYS_CHMOD
|
|
||||||
#elif (ACC_OS_WIN32 && ACC_CC_MWERKS) && defined(__MSL__)
|
#elif (ACC_OS_WIN32 && ACC_CC_MWERKS) && defined(__MSL__)
|
||||||
# include <utime.h>
|
# include <utime.h>
|
||||||
# define USE_UTIME 1
|
# define USE_UTIME 1
|
||||||
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_INTELC || ACC_CC_MSC))
|
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_INTELC || ACC_CC_MSC))
|
||||||
# define USE__FUTIME 1
|
# define USE__FUTIME 1
|
||||||
# undef ALWAYS_CHMOD
|
|
||||||
#elif defined(HAVE_UTIME)
|
#elif defined(HAVE_UTIME)
|
||||||
# define USE_UTIME 1
|
# define USE_UTIME 1
|
||||||
#endif
|
#endif
|
||||||
@@ -68,9 +65,8 @@ void do_one_file(const char *iname, char *oname)
|
|||||||
#else
|
#else
|
||||||
int r = stat(iname,&st);
|
int r = stat(iname,&st);
|
||||||
#endif
|
#endif
|
||||||
bool need_chmod = true; UNUSED(need_chmod);
|
|
||||||
|
|
||||||
if (r == -1)
|
if (r != 0)
|
||||||
throw FileNotFoundException(iname);
|
throw FileNotFoundException(iname);
|
||||||
if (!(S_ISREG(st.st_mode)))
|
if (!(S_ISREG(st.st_mode)))
|
||||||
throwIOException("not a regular file -- skipped");
|
throwIOException("not a regular file -- skipped");
|
||||||
@@ -141,28 +137,17 @@ void do_one_file(const char *iname, char *oname)
|
|||||||
flags |= O_TRUNC;
|
flags |= O_TRUNC;
|
||||||
shmode = O_DENYRW;
|
shmode = O_DENYRW;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(ALWAYS_CHMOD)
|
|
||||||
// we can avoid the chmod() call below
|
|
||||||
int omode = st.st_mode;
|
|
||||||
fo.sopen(tname,flags,shmode,omode);
|
|
||||||
need_chmod = false;
|
|
||||||
#else
|
|
||||||
// cannot rely on open() because of umask
|
// cannot rely on open() because of umask
|
||||||
//int omode = st.st_mode | 0600;
|
//int omode = st.st_mode | 0600;
|
||||||
int omode = 0600;
|
int omode = 0600;
|
||||||
fo.sopen(tname,flags,shmode,omode);
|
fo.sopen(tname,flags,shmode,omode);
|
||||||
#endif
|
|
||||||
// open succeeded - now set oname[]
|
// open succeeded - now set oname[]
|
||||||
strcpy(oname,tname);
|
strcpy(oname,tname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle command
|
// handle command
|
||||||
#if (UPX_VERSION_HEX >= 0x019000)
|
|
||||||
PackMaster pm(&fi, opt);
|
PackMaster pm(&fi, opt);
|
||||||
#else
|
|
||||||
PackMaster pm(&fi);
|
|
||||||
#endif
|
|
||||||
if (opt->cmd == CMD_COMPRESS)
|
if (opt->cmd == CMD_COMPRESS)
|
||||||
pm.pack(&fo);
|
pm.pack(&fo);
|
||||||
else if (opt->cmd == CMD_DECOMPRESS)
|
else if (opt->cmd == CMD_DECOMPRESS)
|
||||||
@@ -230,8 +215,7 @@ void do_one_file(const char *iname, char *oname)
|
|||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_CHMOD)
|
#if defined(HAVE_CHMOD)
|
||||||
// copy permissions
|
// copy permissions
|
||||||
if (need_chmod)
|
(void) ::chmod(name, st.st_mode);
|
||||||
(void) ::chmod(name, st.st_mode);
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_CHOWN)
|
#if defined(HAVE_CHOWN)
|
||||||
// copy the ownership
|
// copy the ownership
|
||||||
|
|||||||
Reference in New Issue
Block a user