]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
sample set limitation closer to 2 GB
authorYann Collet <yann.collet.73@gmail.com>
Wed, 6 Jul 2016 14:25:46 +0000 (16:25 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Wed, 6 Jul 2016 14:25:46 +0000 (16:25 +0200)
lib/dictBuilder/zdict.c

index f559f5583c72c9e8482bcc0cd081b9a329a2cf3d..f1af41962b483462f2c0efcc6eb5bc3dcceb4219 100644 (file)
@@ -34,7 +34,7 @@
 /*-**************************************
 *  Tuning parameters
 ****************************************/
-#define ZDICT_MAX_SAMPLES_SIZE (1500U << 20)
+#define ZDICT_MAX_SAMPLES_SIZE (2000U << 20)
 
 
 /*-**************************************
@@ -497,7 +497,6 @@ static size_t ZDICT_trainBuffer(dictItem* dictList, U32 dictListSize,
     BYTE* doneMarks = (BYTE*)malloc((bufferSize+16)*sizeof(*doneMarks));   /* +16 for overflow security */
     U32* filePos = (U32*)malloc(nbFiles * sizeof(*filePos));
     U32 minRatio = nbFiles >> shiftRatio;
-    int divSuftSortResult;
     size_t result = 0;
 
     /* init */
@@ -510,18 +509,17 @@ static size_t ZDICT_trainBuffer(dictItem* dictList, U32 dictListSize,
     memset(doneMarks, 0, bufferSize+16);
 
     /* limit sample set size (divsufsort limitation)*/
-    if (bufferSize > ZDICT_MAX_SAMPLES_SIZE) DISPLAYLEVEL(3, "sample set too large : reduce to %u MB ...\n", (U32)(ZDICT_MAX_SAMPLES_SIZE>>20));
+    if (bufferSize > ZDICT_MAX_SAMPLES_SIZE) DISPLAYLEVEL(3, "sample set too large : reduced to %u MB ...\n", (U32)(ZDICT_MAX_SAMPLES_SIZE>>20));
     while (bufferSize > ZDICT_MAX_SAMPLES_SIZE) bufferSize -= fileSizes[--nbFiles];
 
     /* sort */
     DISPLAYLEVEL(2, "sorting %u files of total size %u MB ...\n", nbFiles, (U32)(bufferSize>>20));
-    divSuftSortResult = divsufsort((const unsigned char*)buffer, suffix, (int)bufferSize, 0);
-    if (divSuftSortResult != 0) { result = ERROR(GENERIC); goto _cleanup; }
+    { int const divSuftSortResult = divsufsort((const unsigned char*)buffer, suffix, (int)bufferSize, 0);
+      if (divSuftSortResult != 0) { result = ERROR(GENERIC); goto _cleanup; } }
     suffix[bufferSize] = (int)bufferSize;   /* leads into noise */
     suffix0[0] = (int)bufferSize;           /* leads into noise */
-    {
-        /* build reverse suffix sort */
-        size_t pos;
+    /* build reverse suffix sort */
+    {   size_t pos;
         for (pos=0; pos < bufferSize; pos++)
             reverseSuffix[suffix[pos]] = (U32)pos;
         /* build file pos */