fixed a bunch of -Wcomma warnings

reported by @rvandermeulen (#398)
This commit is contained in:
Yann Collet 2017-09-10 14:32:38 -07:00
parent a2b4f732f4
commit a30cba08f4
4 changed files with 18 additions and 5 deletions

View File

@ -616,7 +616,11 @@ _next_match:
*token += ML_MASK; *token += ML_MASK;
matchCode -= ML_MASK; matchCode -= ML_MASK;
LZ4_write32(op, 0xFFFFFFFF); LZ4_write32(op, 0xFFFFFFFF);
while (matchCode >= 4*255) op+=4, LZ4_write32(op, 0xFFFFFFFF), matchCode -= 4*255; while (matchCode >= 4*255) {
op+=4;
LZ4_write32(op, 0xFFFFFFFF);
matchCode -= 4*255;
}
op += matchCode / 255; op += matchCode / 255;
*op++ = (BYTE)(matchCode % 255); *op++ = (BYTE)(matchCode % 255);
} else } else

View File

@ -428,7 +428,10 @@ static void BMK_loadFiles(void* buffer, size_t bufferSize,
f = fopen(fileNamesTable[n], "rb"); f = fopen(fileNamesTable[n], "rb");
if (f==NULL) EXM_THROW(10, "impossible to open file %s", fileNamesTable[n]); if (f==NULL) EXM_THROW(10, "impossible to open file %s", fileNamesTable[n]);
DISPLAYUPDATE(2, "Loading %s... \r", fileNamesTable[n]); DISPLAYUPDATE(2, "Loading %s... \r", fileNamesTable[n]);
if (fileSize > bufferSize-pos) fileSize = bufferSize-pos, nbFiles=n; /* buffer too small - stop after this file */ if (fileSize > bufferSize-pos) { /* buffer too small - stop after this file */
fileSize = bufferSize-pos;
nbFiles=n;
}
{ size_t const readSize = fread(((char*)buffer)+pos, 1, (size_t)fileSize, f); { size_t const readSize = fread(((char*)buffer)+pos, 1, (size_t)fileSize, f);
if (readSize != (size_t)fileSize) EXM_THROW(11, "could not read %s", fileNamesTable[n]); if (readSize != (size_t)fileSize) EXM_THROW(11, "could not read %s", fileNamesTable[n]);
pos += readSize; } pos += readSize; }

View File

@ -119,7 +119,10 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match
} }
/* init */ /* init */
if (pos==0) buffPtr[0] = RDG_genChar(seed, lt), pos=1; if (pos==0) {
buffPtr[0] = RDG_genChar(seed, lt);
pos=1;
}
/* Generate compressible data */ /* Generate compressible data */
while (pos < buffSize) while (pos < buffSize)

View File

@ -259,8 +259,11 @@ static int exeNameMatch(const char* exeName, const char* test)
static unsigned readU32FromChar(const char** stringPtr) static unsigned readU32FromChar(const char** stringPtr)
{ {
unsigned result = 0; unsigned result = 0;
while ((**stringPtr >='0') && (**stringPtr <='9')) while ((**stringPtr >='0') && (**stringPtr <='9')) {
result *= 10, result += **stringPtr - '0', (*stringPtr)++ ; result *= 10;
result += **stringPtr - '0';
(*stringPtr)++ ;
}
if ((**stringPtr=='K') || (**stringPtr=='M')) { if ((**stringPtr=='K') || (**stringPtr=='M')) {
result <<= 10; result <<= 10;
if (**stringPtr=='M') result <<= 10; if (**stringPtr=='M') result <<= 10;