fixed Visual warnings

dev
Yann Collet 2016-01-31 02:51:03 +01:00
parent 61e16ce07c
commit 35f7de52c8
4 changed files with 13 additions and 5 deletions

View File

@ -22,6 +22,15 @@
- zstd source repository : https://github.com/Cyan4973/zstd
*/
/* **************************************
* Compiler Specifics
****************************************/
/* Disable some Visual warning messages */
#ifdef _MSC_VER
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
#endif
/*-************************************
* Includes
**************************************/

View File

@ -79,7 +79,7 @@
#define DICTLISTSIZE 10000
#define MEMMULT 11
static const size_t maxMemory = (sizeof(size_t)==4) ? (2 GB - 64 MB) : (size_t)(3 GB) * MEMMULT;
static const size_t maxMemory = (sizeof(size_t) == 4) ? (2 GB - 64 MB) : ((size_t)(512 MB) << sizeof(size_t));
#define NOISELENGTH 32
#define PRIME1 2654435761U

View File

@ -457,7 +457,7 @@ static size_t ZSTD_compressLiterals (ZSTD_CCtx* zc,
U32 hType = IS_HUF;
size_t clitSize;
if (maxDstSize < 4) return ERROR(dstSize_tooSmall); /* not enough space for compression */
if (maxDstSize < lhSize+1) return ERROR(dstSize_tooSmall); /* not enough space for compression */
if (zc->flagStaticTables && (lhSize==3)) {
hType = IS_PCH;
@ -547,7 +547,7 @@ size_t ZSTD_compressSequences(ZSTD_CCtx* zc,
if ((oend-op) < MIN_SEQUENCES_SIZE) return ERROR(dstSize_tooSmall);
if (nbSeq < 128) *op++ = (BYTE)nbSeq;
else {
op[0] = (nbSeq>>8) + 128; op[1] = (BYTE)nbSeq; op+=2;
op[0] = (BYTE)((nbSeq>>8) + 128); op[1] = (BYTE)nbSeq; op+=2;
}
if (nbSeq==0) goto _check_compressibility;

View File

@ -812,8 +812,7 @@ static size_t ZSTD_decompressSequences(
}
/* check if reached exact end */
if (nbSeq)
return ERROR(corruption_detected); /* DStream should be entirely and exactly consumed; otherwise data is corrupted */
if (nbSeq) return ERROR(corruption_detected);
}
/* last literal segment */