]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed C constant restrictions
authorYann Collet <cyan@fb.com>
Mon, 30 Jan 2017 22:37:08 +0000 (14:37 -0800)
committerYann Collet <cyan@fb.com>
Mon, 30 Jan 2017 22:37:08 +0000 (14:37 -0800)
programs/fileio.c
programs/zstdcli.c

index 568b4f1158c12862aef27ba4e55c3afa9e74e2e4..960c6e3d9bcbb2ce23f2c34b086157797edcddc4 100644 (file)
@@ -124,8 +124,8 @@ void FIO_setBlockSize(unsigned blockSize) {
 #endif
     g_blockSize = blockSize;
 }
-static const U32 g_overlapLogNotSet = 9999;
-static U32 g_overlapLog = g_overlapLogNotSet;
+#define FIO_OVERLAP_LOG_NOTSET 9999
+static U32 g_overlapLog = FIO_OVERLAP_LOG_NOTSET;
 void FIO_setOverlapLog(unsigned overlapLog){
     if (overlapLog && g_nbThreads==1)
         DISPLAYLEVEL(2, "Setting overlapLog is useless in single-thread mode \n");
@@ -279,9 +279,9 @@ static cRess_t FIO_createCResources(const char* dictFileName, int cLevel,
 #ifdef ZSTD_MULTITHREAD
     ress.cctx = ZSTDMT_createCCtx(g_nbThreads);
     if (ress.cctx == NULL) EXM_THROW(30, "zstd: allocation error : can't create ZSTD_CStream");
-    if ((cLevel==ZSTD_maxCLevel()) && (g_overlapLog==g_overlapLogNotSet))
+    if ((cLevel==ZSTD_maxCLevel()) && (g_overlapLog==FIO_OVERLAP_LOG_NOTSET))
         ZSTDMT_setMTCtxParameter(ress.cctx, ZSTDMT_p_overlapSectionLog, 9);   /* use complete window for overlap */
-    if (g_overlapLog != g_overlapLogNotSet)
+    if (g_overlapLog != FIO_OVERLAP_LOG_NOTSET)
         ZSTDMT_setMTCtxParameter(ress.cctx, ZSTDMT_p_overlapSectionLog, g_overlapLog);
 #else
     ress.cctx = ZSTD_createCStream();
index c8cdafb56f99ecf1e6b11aa1c160b9499b799cde..c59bf0c3ab603bee676f3b5f8a9403d5c0b4eaa5 100644 (file)
@@ -63,6 +63,8 @@ static const char*    g_defaultDictName = "dictionary";
 static const unsigned g_defaultMaxDictSize = 110 KB;
 static const int      g_defaultDictCLevel = 3;
 static const unsigned g_defaultSelectivityLevel = 9;
+#define OVERLAP_LOG_DEFAULT 9999
+static U32 g_overlapLog = OVERLAP_LOG_DEFAULT;
 
 
 /*-************************************
@@ -222,8 +224,6 @@ static unsigned parseCoverParameters(const char* stringPtr, COVER_params_t *para
 #endif
 
 
-static const U32 g_overlapLogDefault = 9999;
-static U32 g_overlapLog = g_overlapLogDefault;
 /** parseCompressionParameters() :
  *  reads compression parameters from *stringPtr (e.g. "--zstd=wlog=23,clog=23,hlog=22,slog=6,slen=3,tlen=48,strat=6") into *params
  *  @return 1 means that compression parameters were correct
@@ -634,7 +634,7 @@ int main(int argCount, const char* argv[])
 #ifndef ZSTD_NOCOMPRESS
         FIO_setNbThreads(nbThreads);
         FIO_setBlockSize((U32)blockSize);
-        if (g_overlapLog!=g_overlapLogDefault) FIO_setOverlapLog(g_overlapLog);
+        if (g_overlapLog!=OVERLAP_LOG_DEFAULT) FIO_setOverlapLog(g_overlapLog);
         if ((filenameIdx==1) && outFileName)
           operationResult = FIO_compressFilename(outFileName, filenameTable[0], dictFileName, cLevel, &compressionParams);
         else