From: inikep Date: Thu, 5 May 2016 11:10:57 +0000 (+0200) Subject: fixed compatibility issues X-Git-Tag: v0.6.1^2~14^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bd0faec3285bf93027fae09577b1698701f613f;p=thirdparty%2Fzstd.git fixed compatibility issues --- diff --git a/lib/common/util.h b/lib/common/util.h index e427fc1a1..4f73323b8 100644 --- a/lib/common/util.h +++ b/lib/common/util.h @@ -288,15 +288,14 @@ UTIL_STATIC int UTIL_prepareFileList(const char *dirName, char** bufStart, char* } while ((entry = readdir(dir)) && (*bufStart < bufEnd)) { - if (entry->d_type & DT_DIR) { - if (strcmp (entry->d_name, "..") == 0 || - strcmp (entry->d_name, ".") == 0) continue; - - pathLength = snprintf(path, PATH_MAX, "%s/%s", dirName, entry->d_name); - if (pathLength < 0 || pathLength >= PATH_MAX) { - fprintf(stderr, "Path length has got too long.\n"); - continue; - } + if (strcmp (entry->d_name, "..") == 0 || + strcmp (entry->d_name, ".") == 0) continue; + pathLength = snprintf(path, PATH_MAX, "%s/%s", dirName, entry->d_name); + if (pathLength < 0 || pathLength >= PATH_MAX) { + fprintf(stderr, "Path length has got too long.\n"); + continue; + } + if (UTIL_isDirectory(path)) { // printf ("[%s]\n", path); nbFiles += UTIL_prepareFileList(path, bufStart, bufEnd); /* Recursively call "UTIL_prepareFileList" with the new path. */ } else { @@ -370,7 +369,7 @@ UTIL_STATIC int UTIL_createFileList(const char **inputNames, unsigned nbNames, u UTIL_STATIC void UTIL_freeFileList(const char** filenameTable, char* buf) { free(buf); - free(filenameTable); + free((void*)filenameTable); } diff --git a/programs/bench.c b/programs/bench.c index 0007ef43f..513562185 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -330,6 +330,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize, } /* Bench */ /* clean up */ + free(blockTable); free(compressedBuffer); free(resultBuffer); ZSTD_freeCCtx(refCtx); @@ -525,7 +526,7 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles, unsigned i; nbFiles = UTIL_createFileList(fileNamesTable, nbFiles, MAX_LIST_SIZE, &filenameTable, &buf); if (filenameTable) { - for (i=0; i on unix */ +#define _POSIX_SOURCE 1 /* enable %llu on Windows */ /*-************************************* @@ -72,11 +72,9 @@ # include /* _O_BINARY */ # include /* _setmode, _isatty */ # define SET_BINARY_MODE(file) { int unused = _setmode(_fileno(file), _O_BINARY); (void)unused; } -# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) #else # include /* isatty */ # define SET_BINARY_MODE(file) -# define IS_CONSOLE(stdStream) isatty(fileno(stdStream)) #endif