- 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
**************************************/
#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
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;
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;
}
/* 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 */