mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2024-11-24 19:32:16 +00:00
Fix issue #45 and some extra warnings
This commit is contained in:
parent
d6c43f507c
commit
c173a5130f
@ -295,7 +295,7 @@ int comparestream_open(lzsa_stream_t *stream, const char *pszCompareFilename, co
|
||||
|
||||
pCompareStream->pCompareDataBuf = NULL;
|
||||
pCompareStream->nCompareDataSize = 0;
|
||||
pCompareStream->f = (void*)fopen(pszCompareFilename, pszMode);
|
||||
pCompareStream->f = (FILE*)fopen(pszCompareFilename, pszMode);
|
||||
|
||||
if (pCompareStream->f) {
|
||||
stream->obj = pCompareStream;
|
||||
|
@ -66,7 +66,7 @@ int lzsa_build_suffix_array(lzsa_compressor *pCompressor, const unsigned char *p
|
||||
int *PLCP = (int*)pCompressor->pos_data; /* Use temporarily */
|
||||
int *Phi = PLCP;
|
||||
int nCurLen = 0;
|
||||
int i;
|
||||
int i, r;
|
||||
|
||||
/* Compute the permuted LCP first (Kärkkäinen method) */
|
||||
Phi[intervals[0]] = -1;
|
||||
@ -132,7 +132,7 @@ int lzsa_build_suffix_array(lzsa_compressor *pCompressor, const unsigned char *p
|
||||
intervals[0] = 0;
|
||||
next_interval_idx = 1;
|
||||
|
||||
for (int r = 1; r < nInWindowSize; r++) {
|
||||
for (r = 1; r < nInWindowSize; r++) {
|
||||
const unsigned int next_pos = SA_and_LCP[r] & POS_MASK;
|
||||
const unsigned int next_lcp = SA_and_LCP[r] & LCP_MASK;
|
||||
const unsigned int top_lcp = *top & LCP_MASK;
|
||||
|
@ -413,8 +413,6 @@ static int lzsa_get_compressed_size_v1(lzsa_compressor *pCompressor, lzsa_match
|
||||
int nMatchOffset = pMatch->offset;
|
||||
int nMatchLen = pMatch->length;
|
||||
int nEncodedMatchLen = nMatchLen - MIN_MATCH_SIZE_V1;
|
||||
int nTokenLiteralsLen = (nNumLiterals >= LITERALS_RUN_LEN_V1) ? LITERALS_RUN_LEN_V1 : nNumLiterals;
|
||||
int nTokenMatchLen = (nEncodedMatchLen >= MATCH_RUN_LEN_V1) ? MATCH_RUN_LEN_V1 : nEncodedMatchLen;
|
||||
int nTokenLongOffset = (nMatchOffset <= 256) ? 0x00 : 0x80;
|
||||
int nCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v1(nNumLiterals) + (nNumLiterals << 3) + (nTokenLongOffset ? 16 : 8) /* match offset */ + lzsa_get_match_varlen_size_v1(nEncodedMatchLen);
|
||||
|
||||
@ -429,7 +427,6 @@ static int lzsa_get_compressed_size_v1(lzsa_compressor *pCompressor, lzsa_match
|
||||
}
|
||||
|
||||
{
|
||||
int nTokenLiteralsLen = (nNumLiterals >= LITERALS_RUN_LEN_V1) ? LITERALS_RUN_LEN_V1 : nNumLiterals;
|
||||
int nCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v1(nNumLiterals) + (nNumLiterals << 3);
|
||||
|
||||
nCompressedSize += nCommandSize;
|
||||
|
@ -441,7 +441,9 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
for (int nn = n;
|
||||
int nn;
|
||||
|
||||
for (nn = n;
|
||||
nn < nMatchesPerArrival && pDestSlots[nn].cost == nCodingChoiceCost;
|
||||
nn++) {
|
||||
if (pDestSlots[nn].rep_offset == nMatchOffset &&
|
||||
@ -806,7 +808,6 @@ static int lzsa_optimize_command_count_v2(lzsa_compressor *pCompressor, const un
|
||||
static int lzsa_get_compressed_size_v2(lzsa_compressor *pCompressor, lzsa_match *pBestMatch, const int nStartOffset, const int nEndOffset) {
|
||||
int i;
|
||||
int nNumLiterals = 0;
|
||||
int nOutOffset = 0;
|
||||
int nRepMatchOffset = 0;
|
||||
int nCompressedSize = 0;
|
||||
|
||||
@ -851,7 +852,6 @@ static int lzsa_get_compressed_size_v2(lzsa_compressor *pCompressor, lzsa_match
|
||||
}
|
||||
|
||||
{
|
||||
int nTokenLiteralsLen = (nNumLiterals >= LITERALS_RUN_LEN_V2) ? LITERALS_RUN_LEN_V2 : nNumLiterals;
|
||||
int nCommandSize = 8 /* token */ + lzsa_get_literals_varlen_size_v2(nNumLiterals) + (nNumLiterals << 3);
|
||||
|
||||
nCompressedSize += nCommandSize;
|
||||
|
Loading…
Reference in New Issue
Block a user