summaryrefslogtreecommitdiffstats
path: root/lz4.c
diff options
context:
space:
mode:
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2013-12-03 15:50:46 (GMT)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2013-12-03 15:50:46 (GMT)
commit8ac549f10a3bb36575621f7d969bde22a8aa7de1 (patch)
treeb0c94420464d5244c3c583d1b646602c598cf56a /lz4.c
parent7a863abfc2da21cf69fc2db2ad92e9f8e2c72004 (diff)
downloadlz4-8ac549f10a3bb36575621f7d969bde22a8aa7de1.zip
lz4-8ac549f10a3bb36575621f7d969bde22a8aa7de1.tar.gz
lz4-8ac549f10a3bb36575621f7d969bde22a8aa7de1.tar.bz2
lz4.c : corrected issue 98 within LZ4_compress_limitedOutput()
Makefile : can specify version number git-svn-id: https://lz4.googlecode.com/svn/trunk@109 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
Diffstat (limited to 'lz4.c')
-rw-r--r--lz4.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lz4.c b/lz4.c
index 5668521..4e864de 100644
--- a/lz4.c
+++ b/lz4.c
@@ -469,7 +469,7 @@ FORCE_INLINE int LZ4_compress_generic(
// Encode Literal length
length = (int)(ip - anchor);
token = op++;
- if ((limitedOutput) && unlikely(op + length + (2 + 1 + LASTLITERALS) + (length>>8) > oend)) return 0; // Check output limit
+ if ((limitedOutput) && unlikely(op + length + (2 + 1 + LASTLITERALS) + (length/255) > oend)) return 0; // Check output limit
if (length>=(int)RUN_MASK)
{
int len = length-RUN_MASK;
@@ -534,7 +534,7 @@ _last_literals:
// Encode Last Literals
{
int lastRun = (int)(iend - anchor);
- if ((limitedOutput) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) return 0; // Check output limit
+ if ((limitedOutput) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) return 0; // Check output limit
if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun >= 255 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; }
else *op++ = (BYTE)(lastRun<<ML_BITS);
memcpy(op, anchor, iend - anchor);
@@ -648,10 +648,10 @@ char* LZ4_slideInputBuffer (void* LZ4_Data)
}
else
{
- memcpy((void*)(lz4ds->bufferStart), (const void*)(lz4ds->nextBlock - 64 KB), 64 KB);
- lz4ds->nextBlock -= delta;
- lz4ds->base -= delta;
- }
+ memcpy((void*)(lz4ds->bufferStart), (const void*)(lz4ds->nextBlock - 64 KB), 64 KB);
+ lz4ds->nextBlock -= delta;
+ lz4ds->base -= delta;
+ }
return (char*)(lz4ds->nextBlock);
}