]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed Visual warnings
authorYann Collet <yann.collet.73@gmail.com>
Sun, 31 Jan 2016 01:51:03 +0000 (02:51 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Sun, 31 Jan 2016 01:51:03 +0000 (02:51 +0100)
dictBuilder/dibcli.c
dictBuilder/dictBuilder.c
lib/zstd_compress.c
lib/zstd_decompress.c

index 3ca6854dbf6a96e36043ab782b4cfedc9a2d8bdc..f93e9707a62a532194c3e0ac475cc2a8ffb1934f 100644 (file)
   - 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
 **************************************/
index ca3f66f17f2e23b3f772cceb88e6af78f9a3818a..fed9b18dfbce68c863a3f7d91472b9e6002f64b2 100644 (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
index 37550e6b7bce0f6abf5a5c01cae52aa63e3e5d7d..6e3d6ca5af4bced9adabef904a7ab8642cc38371 100644 (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;
 
index 96ba8936552312a0024b1676f6bd03f2879ac823..6061c87413c8a6493b9bffe8c3069c260689a509 100644 (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 */