From d007eb5f9fec9fad15e3d22c71de19339e0c2b9b Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Fri, 4 Nov 2016 11:20:58 +0100 Subject: [PATCH] fixed clang warnings in zlibWrapper --- zlibWrapper/Makefile | 1 + zlibWrapper/examples/zwrapbench.c | 14 +++++++------- zlibWrapper/zstd_zlibwrapper.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/zlibWrapper/Makefile b/zlibWrapper/Makefile index b36a90d6..25857c94 100644 --- a/zlibWrapper/Makefile +++ b/zlibWrapper/Makefile @@ -19,6 +19,7 @@ CC ?= gcc CFLAGS ?= -O3 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 += $(MOREFLAGS) LDFLAGS = $(LOC) RM = rm -f diff --git a/zlibWrapper/examples/zwrapbench.c b/zlibWrapper/examples/zwrapbench.c index d16fcfdd..5ef7e525 100644 --- a/zlibWrapper/examples/zwrapbench.c +++ b/zlibWrapper/examples/zwrapbench.c @@ -130,7 +130,7 @@ void BMK_SetBlockSize(size_t blockSize) **********************************************************/ typedef struct { - const char* srcPtr; + char* srcPtr; size_t srcSize; char* cPtr; 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 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 size_t* fileSizes, U32 nbFiles, 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); /* Init blockTable data */ - { const char* srcPtr = (const char*)srcBuffer; + { char* srcPtr = (char*)srcBuffer; char* cPtr = (char*)compressedBuffer; char* resPtr = (char*)resultBuffer; 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 (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.total_in = 0; 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); 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.total_in = 0; def.next_out = (void*) blockTable[blockNb].cPtr; @@ -443,7 +443,7 @@ static int BMK_benchMem(const void* srcBuffer, size_t srcSize, else ret = inflateReset(&inf); 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.total_in = 0; 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; ret = inflateInit(&inf); 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.total_in = 0; inf.next_out = (void*) blockTable[blockNb].resPtr; diff --git a/zlibWrapper/zstd_zlibwrapper.c b/zlibWrapper/zstd_zlibwrapper.c index 31e784a8..c653d749 100644 --- a/zlibWrapper/zstd_zlibwrapper.c +++ b/zlibWrapper/zstd_zlibwrapper.c @@ -85,7 +85,7 @@ typedef struct { ZSTD_outBuffer outBuffer; ZWRAP_state_t comprState; unsigned long long pledgedSrcSize; -} ZWRAP_CCtx; +} ZWRAP_CCtx __attribute__ ((aligned (4))); size_t ZWRAP_freeCCtx(ZWRAP_CCtx* zwc) @@ -404,7 +404,7 @@ typedef struct { int windowBits; ZSTD_customMem customMem; z_stream allocFunc; /* copy of zalloc, zfree, opaque */ -} ZWRAP_DCtx; +} ZWRAP_DCtx __attribute__ ((aligned (4))); int ZWRAP_isUsingZSTDdecompression(z_streamp strm)