From 8eb9d9cc936462723bd0cc76a444108a184c4d62 Mon Sep 17 00:00:00 2001 From: rgimad Date: Fri, 30 May 2025 23:59:49 +0300 Subject: [PATCH] refactor one if logic and fix two warning --- kpack_c.c | 12 ++++++------ lzma_c/MatchFinder.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kpack_c.c b/kpack_c.c index b603f68..86f6c56 100644 --- a/kpack_c.c +++ b/kpack_c.c @@ -59,13 +59,13 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c unsigned char *buf_ptr = buf; do { //printf("infile_ptr = %p, count = %u\n", infile_ptr, count); - unsigned al = *(infile_ptr++); - al -= 0x0E8; - if (al > 1) { // if != E8 and != E9 - continue; - } + unsigned opcode = *(infile_ptr++); // E8 dword: call rel32 // E9 dword: jmp rel32 + if (opcode > 0xE9) + { + continue; + } if (count < 5) { break; } @@ -102,7 +102,7 @@ unsigned preprocess_calltrick(unsigned char *infile, unsigned insize, unsigned c memcpy(tmp - 4, cti, 1); } free(buf); - return (unsigned)tmp; + return 1;//(unsigned)tmp; pack_calltrick_fail: *ctn = 0; diff --git a/lzma_c/MatchFinder.c b/lzma_c/MatchFinder.c index eb144f4..47f3dab 100644 --- a/lzma_c/MatchFinder.c +++ b/lzma_c/MatchFinder.c @@ -99,7 +99,7 @@ static void LZInWindow_Init(void) ReadBlock(); } #else -#define LZInWindow_Create(a,b,c,d) /* nothing */ +#define LZInWindow_Create(a,b,c,d) do {(void)(a); (void)(b); (void)(c); (void)(d);} while(0); /* nothing */ #define LZInWindow_Init() _buffer--, _pos++, _streamPos++ #endif