fixed clang warnings in zlibWrapper

This commit is contained in:
Przemyslaw Skibinski 2016-11-04 11:20:58 +01:00
parent 38b590ad69
commit d007eb5f9f
3 changed files with 10 additions and 9 deletions

View File

@ -19,6 +19,7 @@ CC ?= gcc
CFLAGS ?= -O3 CFLAGS ?= -O3
CFLAGS += $(LOC) -I$(PROGRAMS_PATH) -I$(ZSTDLIBDIR) -I$(ZSTDLIBDIR)/common -I$(ZLIBWRAPPER_PATH) -std=gnu99 CFLAGS += $(LOC) -I$(PROGRAMS_PATH) -I$(ZSTDLIBDIR) -I$(ZSTDLIBDIR)/common -I$(ZLIBWRAPPER_PATH) -std=gnu99
CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef
CFLAGS += $(MOREFLAGS)
LDFLAGS = $(LOC) LDFLAGS = $(LOC)
RM = rm -f RM = rm -f

View File

@ -130,7 +130,7 @@ void BMK_SetBlockSize(size_t blockSize)
**********************************************************/ **********************************************************/
typedef struct typedef struct
{ {
const char* srcPtr; char* srcPtr;
size_t srcSize; size_t srcSize;
char* cPtr; char* cPtr;
size_t cRoom; size_t cRoom;
@ -145,7 +145,7 @@ typedef enum { BMK_ZSTD, BMK_ZSTD_STREAM, BMK_ZLIB, BMK_ZWRAP_ZLIB, BMK_ZWRAP_ZS
#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))
static int BMK_benchMem(const void* srcBuffer, size_t srcSize, static int BMK_benchMem(void* srcBuffer, size_t srcSize,
const char* displayName, int cLevel, const char* displayName, int cLevel,
const size_t* fileSizes, U32 nbFiles, const size_t* fileSizes, U32 nbFiles,
const void* dictBuffer, size_t dictBufferSize, BMK_compressor compressor) const void* dictBuffer, size_t dictBufferSize, BMK_compressor compressor)
@ -171,7 +171,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
UTIL_initTimer(&ticksPerSecond); UTIL_initTimer(&ticksPerSecond);
/* Init blockTable data */ /* Init blockTable data */
{ const char* srcPtr = (const char*)srcBuffer; { char* srcPtr = (char*)srcBuffer;
char* cPtr = (char*)compressedBuffer; char* cPtr = (char*)compressedBuffer;
char* resPtr = (char*)resultBuffer; char* resPtr = (char*)resultBuffer;
U32 fileNb; U32 fileNb;
@ -307,7 +307,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
if (ret != Z_OK) EXM_THROW(1, "deflateSetDictionary failure"); if (ret != Z_OK) EXM_THROW(1, "deflateSetDictionary failure");
if (ZWRAP_isUsingZSTDcompression()) useSetDict = 0; /* zstd doesn't require deflateSetDictionary after ZWRAP_deflateReset_keepDict */ if (ZWRAP_isUsingZSTDcompression()) useSetDict = 0; /* zstd doesn't require deflateSetDictionary after ZWRAP_deflateReset_keepDict */
} }
def.next_in = (const void*) blockTable[blockNb].srcPtr; def.next_in = (void*) blockTable[blockNb].srcPtr;
def.avail_in = blockTable[blockNb].srcSize; def.avail_in = blockTable[blockNb].srcSize;
def.total_in = 0; def.total_in = 0;
def.next_out = (void*) blockTable[blockNb].cPtr; def.next_out = (void*) blockTable[blockNb].cPtr;
@ -338,7 +338,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
ret = deflateSetDictionary(&def, dictBuffer, dictBufferSize); ret = deflateSetDictionary(&def, dictBuffer, dictBufferSize);
if (ret != Z_OK) EXM_THROW(1, "deflateSetDictionary failure"); if (ret != Z_OK) EXM_THROW(1, "deflateSetDictionary failure");
} }
def.next_in = (const void*) blockTable[blockNb].srcPtr; def.next_in = (void*) blockTable[blockNb].srcPtr;
def.avail_in = blockTable[blockNb].srcSize; def.avail_in = blockTable[blockNb].srcSize;
def.total_in = 0; def.total_in = 0;
def.next_out = (void*) blockTable[blockNb].cPtr; def.next_out = (void*) blockTable[blockNb].cPtr;
@ -443,7 +443,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
else else
ret = inflateReset(&inf); ret = inflateReset(&inf);
if (ret != Z_OK) EXM_THROW(1, "inflateReset failure"); if (ret != Z_OK) EXM_THROW(1, "inflateReset failure");
inf.next_in = (const void*) blockTable[blockNb].cPtr; inf.next_in = (void*) blockTable[blockNb].cPtr;
inf.avail_in = blockTable[blockNb].cSize; inf.avail_in = blockTable[blockNb].cSize;
inf.total_in = 0; inf.total_in = 0;
inf.next_out = (void*) blockTable[blockNb].resPtr; inf.next_out = (void*) blockTable[blockNb].resPtr;
@ -475,7 +475,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
inf.opaque = Z_NULL; inf.opaque = Z_NULL;
ret = inflateInit(&inf); ret = inflateInit(&inf);
if (ret != Z_OK) EXM_THROW(1, "inflateInit failure"); if (ret != Z_OK) EXM_THROW(1, "inflateInit failure");
inf.next_in = (const void*) blockTable[blockNb].cPtr; inf.next_in = (void*) blockTable[blockNb].cPtr;
inf.avail_in = blockTable[blockNb].cSize; inf.avail_in = blockTable[blockNb].cSize;
inf.total_in = 0; inf.total_in = 0;
inf.next_out = (void*) blockTable[blockNb].resPtr; inf.next_out = (void*) blockTable[blockNb].resPtr;

View File

@ -85,7 +85,7 @@ typedef struct {
ZSTD_outBuffer outBuffer; ZSTD_outBuffer outBuffer;
ZWRAP_state_t comprState; ZWRAP_state_t comprState;
unsigned long long pledgedSrcSize; unsigned long long pledgedSrcSize;
} ZWRAP_CCtx; } ZWRAP_CCtx __attribute__ ((aligned (4)));
size_t ZWRAP_freeCCtx(ZWRAP_CCtx* zwc) size_t ZWRAP_freeCCtx(ZWRAP_CCtx* zwc)
@ -404,7 +404,7 @@ typedef struct {
int windowBits; int windowBits;
ZSTD_customMem customMem; ZSTD_customMem customMem;
z_stream allocFunc; /* copy of zalloc, zfree, opaque */ z_stream allocFunc; /* copy of zalloc, zfree, opaque */
} ZWRAP_DCtx; } ZWRAP_DCtx __attribute__ ((aligned (4)));
int ZWRAP_isUsingZSTDdecompression(z_streamp strm) int ZWRAP_isUsingZSTDdecompression(z_streamp strm)