]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Respond to PR Comments; Formatting/Style/Lint Fixes
authorW. Felix Handte <w@felixhandte.com>
Wed, 9 May 2018 17:14:20 +0000 (13:14 -0400)
committerW. Felix Handte <w@felixhandte.com>
Wed, 23 May 2018 21:53:03 +0000 (17:53 -0400)
lib/compress/zstd_compress.c
lib/compress/zstd_compress_internal.h
lib/compress/zstd_fast.c

index b877a7fb206db859e6a2f5f49b7d034b08663a77..f0576f0811ce20174e3c6474107a0e0ff3b5ecc4 100644 (file)
@@ -2152,11 +2152,14 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_dictMo
           ZSTD_compressBlock_fast_dictMatchState,
           NULL, NULL, NULL, NULL, NULL, NULL, NULL /* unimplemented as of yet */ }
     };
+    ZSTD_blockCompressor selectedCompressor;
     ZSTD_STATIC_ASSERT((unsigned)ZSTD_fast == 1);
 
     assert((U32)strat >= (U32)ZSTD_fast);
     assert((U32)strat <= (U32)ZSTD_btultra);
-    return blockCompressor[(int)dictMode][(U32)strat];
+    selectedCompressor = blockCompressor[(int)dictMode][(U32)strat];
+    assert(selectedCompressor != NULL);
+    return selectedCompressor;
 }
 
 static void ZSTD_storeLastLiterals(seqStore_t* seqStorePtr,
index 32bbe08b8909b88317b7de0569be0b23ea3595d7..913497e7f68804c940c6d6a2b8583f9b56a68df2 100644 (file)
@@ -515,12 +515,16 @@ MEM_STATIC U32 ZSTD_window_hasExtDict(ZSTD_window_t const window)
 
 /**
  * ZSTD_matchState_dictMode():
- * Does what the label says.
+ * Inspects the provided matchState and figures out what dictMode should be
+ * passed to the compressor.
  */
 MEM_STATIC ZSTD_dictMode_e ZSTD_matchState_dictMode(const ZSTD_matchState_t *ms)
 {
-    return ms->dictMatchState != NULL ? ZSTD_dictMatchState :
-        ZSTD_window_hasExtDict(ms->window) ? ZSTD_extDict : ZSTD_noDict;
+    return ms->dictMatchState != NULL ?
+        ZSTD_dictMatchState :
+        ZSTD_window_hasExtDict(ms->window) ?
+            ZSTD_extDict :
+            ZSTD_noDict;
 }
 
 /**
index d4eaeb6d4fd05b04e857f6b69749a6d539bb4320..60c88e571a1022a004c9c37175e5e909872f6a63 100644 (file)
@@ -72,7 +72,7 @@ size_t ZSTD_compressBlock_fast_generic(
     const BYTE* const dictEnd      = hasDict == ZSTD_dictMatchState ?
                                      dms->window.nextSrc : NULL;
     const U32 dictIndexDelta       = hasDict == ZSTD_dictMatchState ?
-                                     localLowestIndex - (dictEnd - dictBase) :
+                                     localLowestIndex - (U32)(dictEnd - dictBase) :
                                      0;
     ptrdiff_t dictLowestLocalIndex = hasDict == ZSTD_dictMatchState ?
                                      lowestDictIndex + dictIndexDelta :