From 6bf361db15f7fa3da2ceadbde142c47dedf1107a Mon Sep 17 00:00:00 2001 From: pionere Date: Sun, 17 Apr 2022 14:37:26 +0200 Subject: use USHRT_MAX, otherwise it wont work properly on platforms where short has a different (not 16) size --- src/pklib/implode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/pklib') diff --git a/src/pklib/implode.c b/src/pklib/implode.c index 90cb482..1484ee2 100644 --- a/src/pklib/implode.c +++ b/src/pklib/implode.c @@ -12,6 +12,7 @@ #include #include +#include #include "pklib.h" @@ -292,7 +293,7 @@ static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data) // The last repetition is the best one. // - pWork->offs09BC[0] = 0xFFFF; + pWork->offs09BC[0] = USHRT_MAX; pWork->offs09BC[1] = 0x0000; di_val = 0; @@ -303,7 +304,7 @@ static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data) if(input_data[offs_in_rep] != input_data[di_val]) { di_val = pWork->offs09BC[di_val]; - if(di_val != 0xFFFF) + if(di_val != USHRT_MAX) continue; } pWork->offs09BC[++offs_in_rep] = ++di_val; @@ -322,7 +323,7 @@ static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data) for(;;) { rep_length2 = pWork->offs09BC[rep_length2]; - if(rep_length2 == 0xFFFF) + if(rep_length2 == USHRT_MAX) rep_length2 = 0; // Get the pointer to the previous repetition @@ -395,7 +396,7 @@ static unsigned int FindRep(TCmpStruct * pWork, unsigned char * input_data) if(input_data[offs_in_rep] != input_data[di_val]) { di_val = pWork->offs09BC[di_val]; - if(di_val != 0xFFFF) + if(di_val != USHRT_MAX) continue; } pWork->offs09BC[++offs_in_rep] = ++di_val; -- cgit v1.2.3