diff --git a/src/lzsa.c b/src/lzsa.c index d17e2bb..9d6121f 100755 --- a/src/lzsa.c +++ b/src/lzsa.c @@ -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; diff --git a/src/matchfinder.c b/src/matchfinder.c index fbdc5ca..3de2cfa 100644 --- a/src/matchfinder.c +++ b/src/matchfinder.c @@ -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; diff --git a/src/shrink_block_v1.c b/src/shrink_block_v1.c index c30e4a9..d71b6a5 100644 --- a/src/shrink_block_v1.c +++ b/src/shrink_block_v1.c @@ -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; diff --git a/src/shrink_block_v2.c b/src/shrink_block_v2.c index 111bd58..48a8598 100644 --- a/src/shrink_block_v2.c +++ b/src/shrink_block_v2.c @@ -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;