aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLadislav Zezula <zezula@volny.cz>2022-04-18 08:25:31 +0200
committerGitHub <noreply@github.com>2022-04-18 08:25:31 +0200
commitaaf90165f6a17d11cff6db97307c986833e20725 (patch)
tree19842d4b960767ac9ad30ce1eb8b7dc8b10ef3e5
parent6ce383a2fa1ff18c32b32347a01f36173699da6c (diff)
parent6bf361db15f7fa3da2ceadbde142c47dedf1107a (diff)
Merge pull request #250 from pionere/shortover
use USHRT_MAX in FindRep
-rw-r--r--src/pklib/implode.c9
1 files changed, 5 insertions, 4 deletions
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 <assert.h>
#include <string.h>
+#include <limits.h>
#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;