]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed file identity detection in 32-bit mode
authorYann Collet <cyan@fb.com>
Thu, 20 Dec 2018 22:30:30 +0000 (14:30 -0800)
committerYann Collet <cyan@fb.com>
Thu, 20 Dec 2018 22:30:30 +0000 (14:30 -0800)
also :
some library decided to use `index` as a global variable declared in standard header
shadowing the ones used in fastcover.c  :(

lib/dictBuilder/fastcover.c
programs/util.c

index dfee45743413f24982e73460fee5dc612b6339dc..cf8eb50a1a33dc4d1f97b5d1e5aad2645934f49e 100644 (file)
@@ -159,15 +159,15 @@ static COVER_segment_t FASTCOVER_selectSegment(const FASTCOVER_ctx_t *ctx,
    */
   while (activeSegment.end < end) {
     /* Get hash value of current dmer */
-    const size_t index = FASTCOVER_hashPtrToIndex(ctx->samples + activeSegment.end, f, d);
+    const size_t idx = FASTCOVER_hashPtrToIndex(ctx->samples + activeSegment.end, f, d);
 
     /* Add frequency of this index to score if this is the first occurence of index in active segment */
-    if (segmentFreqs[index] == 0) {
-      activeSegment.score += freqs[index];
+    if (segmentFreqs[idx] == 0) {
+      activeSegment.score += freqs[idx];
     }
     /* Increment end of segment and segmentFreqs*/
     activeSegment.end += 1;
-    segmentFreqs[index] += 1;
+    segmentFreqs[idx] += 1;
     /* If the window is now too large, drop the first position */
     if (activeSegment.end - activeSegment.begin == dmersInK + 1) {
       /* Get hash value of the dmer to be eliminated from active segment */
index 4a369c051483297f1fa9b6b11084bf81a49ae4f9..34634318c638ac71f040627245cf68efc8e9581c 100644 (file)
@@ -16,11 +16,10 @@ extern "C" {
 /*-****************************************
 *  Dependencies
 ******************************************/
-#include <string.h>       /* strncmp */
+#include "util.h"       /* note : ensure that platform.h is included first ! */
 #include <errno.h>
 #include <assert.h>
 
-#include "util.h"
 
 int UTIL_fileExist(const char* filename)
 {