@@ -170,9 +170,6 @@ int ROLZCodec1::findMatch(const byte buf[], int pos, int end, uint32 hash32, con
170170 if (n > bestLen) {
171171 bestIdx = i;
172172 bestLen = n;
173-
174- if (bestLen == maxMatch)
175- break ;
176173 }
177174 }
178175
@@ -289,24 +286,24 @@ bool ROLZCodec1::forward(SliceArray<byte>& input, SliceArray<byte>& output, int
289286 if ((match2 >= 0 ) && ((match2 & 0xFFFF ) > (match & 0xFFFF ))) {
290287 // New match is better
291288 match = match2;
292- srcIdx++ ;
289+ srcIdx = srcIdx1 ;
293290
294291 // Register current position
295292 *counter = (*counter + 1 ) & _maskChecks;
296293 matches[*counter] = hash32 | int32 (srcIdx);
297294 }
298-
299- // mode LLLLLMMM -> L lit length, M match length
295+
296+ // token LLLLLMMM -> L lit length, M match length
300297 const int litLen = srcIdx - firstLitIdx;
301- const int mode = (litLen < 31 ) ? (litLen << 3 ) : 0xF8 ;
298+ const int token = (litLen < 31 ) ? (litLen << 3 ) : 0xF8 ;
302299 const int mLen = match & 0xFFFF ;
303300
304301 if (mLen >= 7 ) {
305- tkBuf._array [tkBuf._index ++] = byte (mode | 0x07 );
302+ tkBuf._array [tkBuf._index ++] = byte (token | 0x07 );
306303 lenBuf._index += emitLength (&lenBuf._array [lenBuf._index ], mLen - 7 );
307304 }
308305 else {
309- tkBuf._array [tkBuf._index ++] = byte (mode | mLen );
306+ tkBuf._array [tkBuf._index ++] = byte (token | mLen );
310307 }
311308
312309 // Emit literals
@@ -331,8 +328,8 @@ bool ROLZCodec1::forward(SliceArray<byte>& input, SliceArray<byte>& output, int
331328
332329 if (tkBuf._index != 0 ) {
333330 // At least one match to emit
334- const int mode = (litLen < 31 ) ? (litLen << 3 ) : 0xF8 ;
335- tkBuf._array [tkBuf._index ++] = byte (mode );
331+ const int token = (litLen < 31 ) ? (litLen << 3 ) : 0xF8 ;
332+ tkBuf._array [tkBuf._index ++] = byte (token );
336333 }
337334
338335 if (litLen >= 31 )
@@ -531,15 +528,15 @@ bool ROLZCodec1::inverse(SliceArray<byte>& input, SliceArray<byte>& output, int
531528
532529 // Next chunk
533530 while (dstIdx < sizeChunk) {
534- // mode LLLLLMMM -> L lit length, M match length
535- const int mode = int (tkBuf._array [tkBuf._index ++]);
536- int matchLen = mode & 0x07 ;
531+ // token LLLLLMMM -> L lit length, M match length
532+ const int token = int (tkBuf._array [tkBuf._index ++]);
533+ int matchLen = token & 0x07 ;
537534
538535 if (matchLen == 7 )
539536 matchLen += readLength (lenBuf._array , lenBuf._index );
540537
541538 // Emit literals
542- const int litLen = (mode < 0xF8 ) ? mode >> 3 : readLength (lenBuf._array , lenBuf._index ) + 31 ;
539+ const int litLen = (token < 0xF8 ) ? token >> 3 : readLength (lenBuf._array , lenBuf._index ) + 31 ;
543540
544541 if (litLen > 0 ) {
545542 if (dstIdx + litLen > litBufSize) {
@@ -841,7 +838,7 @@ int ROLZCodec2::findMatch(const byte buf[], int pos, int end, uint32 key)
841838 }
842839
843840 n += 4 ;
844- }
841+ }
845842
846843 if (n > bestLen) {
847844 bestIdx = counter - i;
@@ -966,7 +963,7 @@ bool ROLZCodec2::inverse(SliceArray<byte>& input, SliceArray<byte>& output, int
966963
967964 byte* src = &input._array [input._index ];
968965 const int dstEnd = BigEndian::readInt32 (&src[0 ]);
969-
966+
970967 if ((dstEnd <= 0 ) || (dstEnd > output._length - output._index ))
971968 return false ;
972969
0 commit comments