mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Cleanup: removed upx_bool and upx_uint types.
This commit is contained in:
parent
d2c36eefc9
commit
fe057a91c8
|
@ -72,7 +72,7 @@ static void print0(FILE *f, const char *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static upx_bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
UNUSED(f);
|
UNUSED(f);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -124,7 +124,7 @@ static int set_fg(FILE *f, int fg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static upx_bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
if (con == me)
|
if (con == me)
|
||||||
init(f,-1,-1);
|
init(f,-1,-1);
|
||||||
|
|
|
@ -58,7 +58,7 @@ static void print0(FILE *f, const char *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static upx_bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
UNUSED(f);
|
UNUSED(f);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -295,7 +295,7 @@ static void print0(FILE *f, const char *ss)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static upx_bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
UNUSED(f);
|
UNUSED(f);
|
||||||
#if defined(USE_FRAMES)
|
#if defined(USE_FRAMES)
|
||||||
|
|
|
@ -72,8 +72,8 @@ unsigned upx_crc32(const void *buf, unsigned len, unsigned crc)
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int upx_compress ( const upx_bytep src, upx_uint src_len,
|
int upx_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
upx_callback_p cb,
|
upx_callback_p cb,
|
||||||
int method, int level,
|
int method, int level,
|
||||||
const struct upx_compress_config_t *conf,
|
const struct upx_compress_config_t *conf,
|
||||||
|
@ -142,8 +142,8 @@ int upx_compress ( const upx_bytep src, upx_uint src_len,
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int upx_decompress ( const upx_bytep src, upx_uint src_len,
|
int upx_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result )
|
const struct upx_compress_result_t *result )
|
||||||
{
|
{
|
||||||
|
@ -181,8 +181,8 @@ int upx_decompress ( const upx_bytep src, upx_uint src_len,
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int upx_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||||
upx_uint src_len, upx_uintp dst_len,
|
unsigned src_len, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result )
|
const struct upx_compress_result_t *result )
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,54 +35,54 @@
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if defined(WITH_LZMA)
|
#if defined(WITH_LZMA)
|
||||||
int upx_lzma_compress ( const upx_bytep src, upx_uint src_len,
|
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
upx_callback_p cb,
|
upx_callback_p cb,
|
||||||
int method, int level,
|
int method, int level,
|
||||||
const struct upx_compress_config_t *conf,
|
const struct upx_compress_config_t *conf,
|
||||||
struct upx_compress_result_t *result );
|
struct upx_compress_result_t *result );
|
||||||
int upx_lzma_decompress ( const upx_bytep src, upx_uint src_len,
|
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result );
|
const struct upx_compress_result_t *result );
|
||||||
int upx_lzma_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
int upx_lzma_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||||
upx_uint src_len, upx_uintp dst_len,
|
unsigned src_len, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result );
|
const struct upx_compress_result_t *result );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(WITH_NRV)
|
#if defined(WITH_NRV)
|
||||||
int upx_nrv_compress ( const upx_bytep src, upx_uint src_len,
|
int upx_nrv_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
upx_callback_p cb,
|
upx_callback_p cb,
|
||||||
int method, int level,
|
int method, int level,
|
||||||
const struct upx_compress_config_t *conf,
|
const struct upx_compress_config_t *conf,
|
||||||
struct upx_compress_result_t *result );
|
struct upx_compress_result_t *result );
|
||||||
int upx_nrv_decompress ( const upx_bytep src, upx_uint src_len,
|
int upx_nrv_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result );
|
const struct upx_compress_result_t *result );
|
||||||
int upx_nrv_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
int upx_nrv_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||||
upx_uint src_len, upx_uintp dst_len,
|
unsigned src_len, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result );
|
const struct upx_compress_result_t *result );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(WITH_UCL)
|
#if defined(WITH_UCL)
|
||||||
int upx_ucl_compress ( const upx_bytep src, upx_uint src_len,
|
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
upx_callback_p cb,
|
upx_callback_p cb,
|
||||||
int method, int level,
|
int method, int level,
|
||||||
const struct upx_compress_config_t *conf,
|
const struct upx_compress_config_t *conf,
|
||||||
struct upx_compress_result_t *result );
|
struct upx_compress_result_t *result );
|
||||||
int upx_ucl_decompress ( const upx_bytep src, upx_uint src_len,
|
int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result );
|
const struct upx_compress_result_t *result );
|
||||||
int upx_ucl_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
int upx_ucl_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||||
upx_uint src_len, upx_uintp dst_len,
|
unsigned src_len, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result );
|
const struct upx_compress_result_t *result );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -133,7 +133,6 @@ STDMETHODIMP OutStreamRam::Write(const void *data, UInt32 size, UInt32 *processe
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
|
@ -144,15 +143,15 @@ struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
||||||
STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
|
STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
|
||||||
{
|
{
|
||||||
if (cb && cb->nprogress)
|
if (cb && cb->nprogress)
|
||||||
cb->nprogress(cb, (upx_uint) *inSize, (upx_uint) *outSize, 3);
|
cb->nprogress(cb, (size_t) *inSize, (size_t) *outSize);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
int upx_lzma_compress ( const upx_bytep src, upx_uint src_len,
|
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
upx_callback_p cb,
|
upx_callback_p cb,
|
||||||
int method, int level,
|
int method, int level,
|
||||||
const struct upx_compress_config_t *conf_parm,
|
const struct upx_compress_config_t *conf_parm,
|
||||||
|
@ -246,6 +245,8 @@ int upx_lzma_compress ( const upx_bytep src, upx_uint src_len,
|
||||||
os.Pos -= 4; // do not encode dict_size
|
os.Pos -= 4; // do not encode dict_size
|
||||||
|
|
||||||
rh = enc.Code(&is, &os, NULL, NULL, &progress);
|
rh = enc.Code(&is, &os, NULL, NULL, &progress);
|
||||||
|
assert(is.Pos <= src_len);
|
||||||
|
assert(os.Pos <= *dst_len);
|
||||||
if (rh == E_OUTOFMEMORY)
|
if (rh == E_OUTOFMEMORY)
|
||||||
r = UPX_E_OUT_OF_MEMORY;
|
r = UPX_E_OUT_OF_MEMORY;
|
||||||
else if (os.Overflow)
|
else if (os.Overflow)
|
||||||
|
@ -301,8 +302,8 @@ error:
|
||||||
#include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
|
#include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
|
||||||
#include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
|
#include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
|
||||||
|
|
||||||
int upx_lzma_decompress ( const upx_bytep src, upx_uint src_len,
|
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result )
|
const struct upx_compress_result_t *result )
|
||||||
{
|
{
|
||||||
|
@ -315,22 +316,15 @@ int upx_lzma_decompress ( const upx_bytep src, upx_uint src_len,
|
||||||
CLzmaDecoderState s; memset(&s, 0, sizeof(s));
|
CLzmaDecoderState s; memset(&s, 0, sizeof(s));
|
||||||
SizeT src_out = 0, dst_out = 0;
|
SizeT src_out = 0, dst_out = 0;
|
||||||
int r = UPX_E_ERROR;
|
int r = UPX_E_ERROR;
|
||||||
|
int rh;
|
||||||
|
|
||||||
if (src_len < 2)
|
if (src_len < 2)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
#if defined(LzmaDecoderInit)
|
rh = LzmaDecodeProperties(&s.Properties, src, src_len);
|
||||||
# error
|
|
||||||
LzmaDecoderInit(&s);
|
|
||||||
#endif
|
|
||||||
r = LzmaDecodeProperties(&s.Properties, src, src_len);
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
goto error;
|
goto error;
|
||||||
#if 0 // defined(_LZMA_OUT_READ)
|
|
||||||
src += LZMA_PROPERTIES_SIZE; src_len -= LZMA_PROPERTIES_SIZE;
|
|
||||||
#else
|
|
||||||
src += 1; src_len -= 1;
|
src += 1; src_len -= 1;
|
||||||
#endif
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
assert(result->method == method);
|
assert(result->method == method);
|
||||||
|
@ -342,11 +336,12 @@ int upx_lzma_decompress ( const upx_bytep src, upx_uint src_len,
|
||||||
r = UPX_E_OUT_OF_MEMORY;
|
r = UPX_E_OUT_OF_MEMORY;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
r = LzmaDecode(&s, src, src_len, &src_out, dst, *dst_len, &dst_out);
|
rh = LzmaDecode(&s, src, src_len, &src_out, dst, *dst_len, &dst_out);
|
||||||
assert(src_out <= src_len);
|
assert(src_out <= src_len);
|
||||||
assert(dst_out <= *dst_len);
|
assert(dst_out <= *dst_len);
|
||||||
if (r == 0)
|
if (rh == 0)
|
||||||
{
|
{
|
||||||
|
r = UPX_E_OK;
|
||||||
if (src_out != src_len)
|
if (src_out != src_len)
|
||||||
r = UPX_E_ERROR; // UPX_E_INPUT_NOT_CONSUMED;
|
r = UPX_E_ERROR; // UPX_E_INPUT_NOT_CONSUMED;
|
||||||
}
|
}
|
||||||
|
@ -364,8 +359,8 @@ error:
|
||||||
// test_overlap
|
// test_overlap
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int upx_lzma_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
int upx_lzma_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||||
upx_uint src_len, upx_uintp dst_len,
|
unsigned src_len, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result )
|
const struct upx_compress_result_t *result )
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,12 +67,12 @@ static void wrap_ucl_nprogress(ucl_uint a, ucl_uint b, int state, ucl_voidp user
|
||||||
if (state != -1 && state != 3) return;
|
if (state != -1 && state != 3) return;
|
||||||
upx_callback_p cb = (upx_callback_p) user;
|
upx_callback_p cb = (upx_callback_p) user;
|
||||||
if (cb && cb->nprogress)
|
if (cb && cb->nprogress)
|
||||||
cb->nprogress(cb, a, b, state);
|
cb->nprogress(cb, a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int upx_ucl_compress ( const upx_bytep src, upx_uint src_len,
|
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
upx_callback_p cb_parm,
|
upx_callback_p cb_parm,
|
||||||
int method, int level,
|
int method, int level,
|
||||||
const struct upx_compress_config_t *conf_parm,
|
const struct upx_compress_config_t *conf_parm,
|
||||||
|
@ -108,9 +108,9 @@ int upx_ucl_compress ( const upx_bytep src, upx_uint src_len,
|
||||||
throwInternalError("unknown compression method");
|
throwInternalError("unknown compression method");
|
||||||
|
|
||||||
// optimize compression parms
|
// optimize compression parms
|
||||||
if (level <= 3 && conf.max_offset == UPX_UINT_MAX)
|
if (level <= 3 && conf.max_offset == UCL_UINT_MAX)
|
||||||
conf.max_offset = 8*1024-1;
|
conf.max_offset = 8*1024-1;
|
||||||
else if (level == 4 && conf.max_offset == UPX_UINT_MAX)
|
else if (level == 4 && conf.max_offset == UCL_UINT_MAX)
|
||||||
conf.max_offset = 32*1024-1;
|
conf.max_offset = 32*1024-1;
|
||||||
|
|
||||||
if M_IS_NRV2B(method)
|
if M_IS_NRV2B(method)
|
||||||
|
@ -133,8 +133,8 @@ int upx_ucl_compress ( const upx_bytep src, upx_uint src_len,
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int upx_ucl_decompress ( const upx_bytep src, upx_uint src_len,
|
int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result )
|
const struct upx_compress_result_t *result )
|
||||||
{
|
{
|
||||||
|
@ -183,8 +183,8 @@ int upx_ucl_decompress ( const upx_bytep src, upx_uint src_len,
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int upx_ucl_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
int upx_ucl_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||||
upx_uint src_len, upx_uintp dst_len,
|
unsigned src_len, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result )
|
const struct upx_compress_result_t *result )
|
||||||
{
|
{
|
||||||
|
|
56
src/conf.h
56
src/conf.h
|
@ -174,37 +174,37 @@
|
||||||
# error "UINT_MAX"
|
# error "UINT_MAX"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(UPX_UINT_MAX)
|
#define upx_byte unsigned char
|
||||||
# define UPX_UINT_MAX UCL_UINT_MAX
|
#define upx_bytep upx_byte *
|
||||||
# define upx_uint ucl_uint
|
#define UPX_E_OK (0)
|
||||||
# define upx_voidp ucl_voidp
|
#define UPX_E_ERROR (-1)
|
||||||
# define upx_uintp ucl_uintp
|
#define UPX_E_OUT_OF_MEMORY (-2)
|
||||||
# define upx_byte ucl_byte
|
#define UPX_E_NOT_COMPRESSIBLE (-3)
|
||||||
# define upx_bytep ucl_bytep
|
#define UPX_E_INPUT_OVERRUN (-4)
|
||||||
# define upx_bool ucl_bool
|
#define UPX_E_OUTPUT_OVERRUN (-5)
|
||||||
# define UPX_E_OK UCL_E_OK
|
#define UPX_E_LOOKBEHIND_OVERRUN (-6)
|
||||||
# define UPX_E_ERROR UCL_E_ERROR
|
#define UPX_E_EOF_NOT_FOUND (-7)
|
||||||
# define UPX_E_OUT_OF_MEMORY UCL_E_OUT_OF_MEMORY
|
#define UPX_E_INPUT_NOT_CONSUMED (-8)
|
||||||
# define __UPX_CDECL __UCL_CDECL
|
#define UPX_E_NOT_YET_IMPLEMENTED (-9)
|
||||||
#endif
|
#define UPX_E_INVALID_ARGUMENT (-10)
|
||||||
|
|
||||||
struct upx_callback_t;
|
struct upx_callback_t;
|
||||||
#define upx_callback_p upx_callback_t *
|
#define upx_callback_p upx_callback_t *
|
||||||
typedef upx_voidp (__UPX_CDECL *upx_alloc_func_t)
|
typedef void* (__acc_cdecl *upx_alloc_func_t)
|
||||||
(upx_callback_p self, upx_uint items, upx_uint size);
|
(upx_callback_p self, unsigned items, unsigned size);
|
||||||
typedef void (__UPX_CDECL *upx_free_func_t)
|
typedef void (__acc_cdecl *upx_free_func_t)
|
||||||
(upx_callback_p self, upx_voidp ptr);
|
(upx_callback_p self, void* ptr);
|
||||||
typedef void (__UPX_CDECL *upx_progress_func_t)
|
typedef void (__acc_cdecl *upx_progress_func_t)
|
||||||
(upx_callback_p, upx_uint, upx_uint, int);
|
(upx_callback_p, unsigned, unsigned);
|
||||||
|
|
||||||
struct upx_callback_t
|
struct upx_callback_t
|
||||||
{
|
{
|
||||||
upx_alloc_func_t nalloc;
|
upx_alloc_func_t nalloc;
|
||||||
upx_free_func_t nfree;
|
upx_free_func_t nfree;
|
||||||
upx_progress_func_t nprogress;
|
upx_progress_func_t nprogress;
|
||||||
upx_voidp user1;
|
void * user1;
|
||||||
upx_uint user2;
|
unsigned user2;
|
||||||
upx_uint user3;
|
unsigned user3;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -625,18 +625,18 @@ void show_version(int);
|
||||||
unsigned upx_adler32(const void *buf, unsigned len, unsigned adler=1);
|
unsigned upx_adler32(const void *buf, unsigned len, unsigned adler=1);
|
||||||
unsigned upx_crc32(const void *buf, unsigned len, unsigned crc=0);
|
unsigned upx_crc32(const void *buf, unsigned len, unsigned crc=0);
|
||||||
|
|
||||||
int upx_compress ( const upx_bytep src, upx_uint src_len,
|
int upx_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
upx_callback_p cb,
|
upx_callback_p cb,
|
||||||
int method, int level,
|
int method, int level,
|
||||||
const struct upx_compress_config_t *conf,
|
const struct upx_compress_config_t *conf,
|
||||||
struct upx_compress_result_t *result );
|
struct upx_compress_result_t *result );
|
||||||
int upx_decompress ( const upx_bytep src, upx_uint src_len,
|
int upx_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result );
|
const struct upx_compress_result_t *result );
|
||||||
int upx_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
|
||||||
upx_uint src_len, upx_uintp dst_len,
|
unsigned src_len, unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const struct upx_compress_result_t *result );
|
const struct upx_compress_result_t *result );
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ typedef struct
|
||||||
int (*init)(FILE *f, int, int);
|
int (*init)(FILE *f, int, int);
|
||||||
int (*set_fg)(FILE *f, int fg);
|
int (*set_fg)(FILE *f, int fg);
|
||||||
void (*print0)(FILE *f, const char *s);
|
void (*print0)(FILE *f, const char *s);
|
||||||
upx_bool (*intro)(FILE *f);
|
bool (*intro)(FILE *f);
|
||||||
}
|
}
|
||||||
console_t;
|
console_t;
|
||||||
|
|
||||||
|
|
|
@ -85,13 +85,13 @@ struct options_t {
|
||||||
|
|
||||||
// compression runtime parameters - see struct ucl_compress_config_t
|
// compression runtime parameters - see struct ucl_compress_config_t
|
||||||
struct {
|
struct {
|
||||||
upx_uint max_offset;
|
unsigned max_offset;
|
||||||
upx_uint max_match;
|
unsigned max_match;
|
||||||
int s_level;
|
int s_level;
|
||||||
int h_level;
|
int h_level;
|
||||||
int p_level;
|
int p_level;
|
||||||
int c_flags;
|
int c_flags;
|
||||||
upx_uint m_size;
|
unsigned m_size;
|
||||||
} crp;
|
} crp;
|
||||||
|
|
||||||
// CPU
|
// CPU
|
||||||
|
|
|
@ -180,18 +180,13 @@ bool Packer::compress(upx_bytep in, upx_bytep out,
|
||||||
// options
|
// options
|
||||||
if (opt->crp.c_flags != -1)
|
if (opt->crp.c_flags != -1)
|
||||||
conf.conf_ucl.c_flags = opt->crp.c_flags;
|
conf.conf_ucl.c_flags = opt->crp.c_flags;
|
||||||
#if 0
|
|
||||||
else
|
|
||||||
// this is based on experimentation
|
|
||||||
conf.conf_ucl.c_flags = (ph.level >= 7) ? 0 : 1 | 2;
|
|
||||||
#endif
|
|
||||||
if (opt->crp.p_level != -1)
|
if (opt->crp.p_level != -1)
|
||||||
conf.conf_ucl.p_level = opt->crp.p_level;
|
conf.conf_ucl.p_level = opt->crp.p_level;
|
||||||
if (opt->crp.h_level != -1)
|
if (opt->crp.h_level != -1)
|
||||||
conf.conf_ucl.h_level = opt->crp.h_level;
|
conf.conf_ucl.h_level = opt->crp.h_level;
|
||||||
if (opt->crp.max_offset != UPX_UINT_MAX && opt->crp.max_offset < conf.conf_ucl.max_offset)
|
if (opt->crp.max_offset != UINT_MAX && opt->crp.max_offset < conf.conf_ucl.max_offset)
|
||||||
conf.conf_ucl.max_offset = opt->crp.max_offset;
|
conf.conf_ucl.max_offset = opt->crp.max_offset;
|
||||||
if (opt->crp.max_match != UPX_UINT_MAX && opt->crp.max_match < conf.conf_ucl.max_match)
|
if (opt->crp.max_match != UINT_MAX && opt->crp.max_match < conf.conf_ucl.max_match)
|
||||||
conf.conf_ucl.max_match = opt->crp.max_match;
|
conf.conf_ucl.max_match = opt->crp.max_match;
|
||||||
|
|
||||||
// Avoid too many progress bar updates. 64 is s->bar_len in ui.cpp.
|
// Avoid too many progress bar updates. 64 is s->bar_len in ui.cpp.
|
||||||
|
|
|
@ -398,12 +398,11 @@ void UiPacker::endCallback()
|
||||||
// the callback
|
// the callback
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void __UPX_CDECL UiPacker::progress_callback(upx_callback_p cb, upx_uint isize, upx_uint osize, int state)
|
void __acc_cdecl UiPacker::progress_callback(upx_callback_p cb, unsigned isize, unsigned osize)
|
||||||
{
|
{
|
||||||
//printf("%6d %6d %d\n", isize, osize, state);
|
//printf("%6d %6d %d\n", isize, osize, state);
|
||||||
UiPacker *uip = (UiPacker *) cb->user1;
|
UiPacker *uip = (UiPacker *) cb->user1;
|
||||||
uip->doCallback(isize, osize);
|
uip->doCallback(isize, osize);
|
||||||
UNUSED(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
2
src/ui.h
2
src/ui.h
|
@ -74,7 +74,7 @@ public:
|
||||||
virtual void endCallback();
|
virtual void endCallback();
|
||||||
virtual upx_callback_t *getCallback() { return &cb; }
|
virtual upx_callback_t *getCallback() { return &cb; }
|
||||||
protected:
|
protected:
|
||||||
static void __UPX_CDECL progress_callback(upx_callback_p cb, upx_uint, upx_uint, int);
|
static void __acc_cdecl progress_callback(upx_callback_p cb, unsigned, unsigned);
|
||||||
virtual void doCallback(unsigned isize, unsigned osize);
|
virtual void doCallback(unsigned isize, unsigned osize);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user