fixed minor warnings when compiling with gcc -g (aka -std=gnu90)

This commit is contained in:
Yann Collet 2016-04-09 16:17:18 +02:00
parent b5a3cbd96d
commit 9990986bdc
2 changed files with 19 additions and 18 deletions

View File

@ -3952,7 +3952,7 @@ static void ZSTDv05_decodeSequence(seq_t* seq, seqState_t* seqState)
} }
FORCE_INLINE size_t ZSTDv05_execSequence(BYTE* op, static size_t ZSTDv05_execSequence(BYTE* op,
BYTE* const oend, seq_t sequence, BYTE* const oend, seq_t sequence,
const BYTE** litPtr, const BYTE* const litLimit_8, const BYTE** litPtr, const BYTE* const litLimit_8,
const BYTE* const base, const BYTE* const vBase, const BYTE* const dictEnd) const BYTE* const base, const BYTE* const vBase, const BYTE* const dictEnd)

View File

@ -1,6 +1,6 @@
/* /*
bench.c - Demo module to benchmark open-source compression algorithms bench.c - open-source compression benchmark module
Copyright (C) Yann Collet 2012-2015 Copyright (C) Yann Collet 2012-2016
GPL v2 License GPL v2 License
@ -19,8 +19,8 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You can contact the author at : You can contact the author at :
- zstd homepage : http://www.zstd.net
- zstd source repository : https://github.com/Cyan4973/zstd - zstd source repository : https://github.com/Cyan4973/zstd
- ztsd public forum : https://groups.google.com/forum/#!forum/lz4c
*/ */
/* ************************************** /* **************************************
@ -44,13 +44,13 @@
/* ************************************* /* *************************************
* Includes * Includes
***************************************/ ***************************************/
#define _POSIX_C_SOURCE 199309L /* before <time.h> - needed for nanosleep() */ #define _POSIX_C_SOURCE 199309L /* before <time.h> - needed for nanosleep() */
#include <stdlib.h> /* malloc, free */ #include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */ #include <string.h> /* memset */
#include <stdio.h> /* fprintf, fopen, ftello64 */ #include <stdio.h> /* fprintf, fopen, ftello64 */
#include <sys/types.h> /* stat64 */ #include <sys/types.h> /* stat64 */
#include <sys/stat.h> /* stat64 */ #include <sys/stat.h> /* stat64 */
#include <time.h> /* clock_t, nanosleep, clock, CLOCKS_PER_SEC */ #include <time.h> /* clock_t, nanosleep, clock, CLOCKS_PER_SEC */
/* sleep : posix - windows - others */ /* sleep : posix - windows - others */
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
@ -97,7 +97,6 @@
#include "xxhash.h" #include "xxhash.h"
/* ************************************* /* *************************************
* Compiler specifics * Compiler specifics
***************************************/ ***************************************/
@ -105,8 +104,12 @@
# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) # define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
#endif #endif
#ifdef _MSC_VER #if defined(_MSC_VER)
#define snprintf sprintf_s # define snprintf sprintf_s
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
/* part of <stdio.h> */
#else
extern int snprintf (char* s, size_t maxlen, const char* format, ...); /* not declared in <stdio.h> when C version < c99 */
#endif #endif
@ -187,7 +190,7 @@ void BMK_SetBlockSize(size_t blockSize)
static U64 BMK_clockSpan( BMK_time_t clockStart, BMK_time_t ticksPerSecond ) static U64 BMK_clockSpan( BMK_time_t clockStart, BMK_time_t ticksPerSecond )
{ {
BMK_time_t clockEnd; BMK_time_t clockEnd;
(void)ticksPerSecond; (void)ticksPerSecond;
BMK_getTime(clockEnd); BMK_getTime(clockEnd);
return BMK_getSpanTimeMicro(ticksPerSecond, clockStart, clockEnd); return BMK_getSpanTimeMicro(ticksPerSecond, clockStart, clockEnd);
@ -230,7 +233,7 @@ typedef struct
double dSpeed; double dSpeed;
} benchResult_t; } benchResult_t;
#define MIN(a,b) ((a)<(b) ? (a) : (b)) #define MIN(a,b) ((a)<(b) ? (a) : (b))
#define MAX(a,b) ((a)>(b) ? (a) : (b)) #define MAX(a,b) ((a)>(b) ? (a) : (b))
@ -406,7 +409,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
if (crcOrig == crcCheck) { if (crcOrig == crcCheck) {
result->ratio = ratio; result->ratio = ratio;
result->cSize = cSize; result->cSize = cSize;
result->cSpeed = (double)srcSize / fastestC; result->cSpeed = (double)srcSize / fastestC;
result->dSpeed = (double)srcSize / fastestD; result->dSpeed = (double)srcSize / fastestD;
} }
DISPLAYLEVEL(2, "%2i#\n", cLevel); DISPLAYLEVEL(2, "%2i#\n", cLevel);
@ -463,7 +466,7 @@ static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize,
if (cLevelLast < cLevel) cLevelLast = cLevel; if (cLevelLast < cLevel) cLevelLast = cLevel;
for (l=cLevel; l <= cLevelLast; l++) { for (l=cLevel; l <= cLevelLast; l++) {
BMK_benchMem(srcBuffer, benchedSize, BMK_benchMem(srcBuffer, benchedSize,
displayName, l, displayName, l,
fileSizes, nbFiles, fileSizes, nbFiles,
@ -477,15 +480,13 @@ static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize,
total.cSpeed += result.cSpeed; total.cSpeed += result.cSpeed;
total.dSpeed += result.dSpeed; total.dSpeed += result.dSpeed;
total.ratio += result.ratio; total.ratio += result.ratio;
} } }
} if (g_displayLevel == 1 && cLevelLast > cLevel) {
if (g_displayLevel == 1 && cLevelLast > cLevel)
{
total.cSize /= 1+cLevelLast-cLevel; total.cSize /= 1+cLevelLast-cLevel;
total.cSpeed /= 1+cLevelLast-cLevel; total.cSpeed /= 1+cLevelLast-cLevel;
total.dSpeed /= 1+cLevelLast-cLevel; total.dSpeed /= 1+cLevelLast-cLevel;
total.ratio /= 1+cLevelLast-cLevel; total.ratio /= 1+cLevelLast-cLevel;
DISPLAY("avg%11i (%5.3f) %6.1f MB/s %6.1f MB/s %s\n", (int)total.cSize, total.ratio, total.cSpeed, total.dSpeed, displayName); DISPLAY("avg%11i (%5.3f) %6.1f MB/s %6.1f MB/s %s\n", (int)total.cSize, total.ratio, total.cSpeed, total.dSpeed, displayName);
} }
} }