diff options
Diffstat (limited to 'programs')
-rw-r--r-- | programs/frametest.c | 14 | ||||
-rw-r--r-- | programs/fullbench.c | 12 | ||||
-rw-r--r-- | programs/fuzzer.c | 1 |
3 files changed, 14 insertions, 13 deletions
diff --git a/programs/frametest.c b/programs/frametest.c index aa1a727..19e8e82 100644 --- a/programs/frametest.c +++ b/programs/frametest.c @@ -279,7 +279,7 @@ int basicTests(U32 seed, double compressibility) DISPLAYLEVEL(3, "Decompression test : \n"); { size_t decodedBufferSize = COMPRESSIBLE_NOISE_LENGTH; - unsigned maxBits = FUZ_highbit(decodedBufferSize); + unsigned maxBits = FUZ_highbit((U32)decodedBufferSize); BYTE* op = (BYTE*)decodedBuffer; BYTE* const oend = (BYTE*)decodedBuffer + COMPRESSIBLE_NOISE_LENGTH; BYTE* ip = (BYTE*)compressedBuffer; @@ -377,8 +377,8 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi void* compressedBuffer = NULL; void* decodedBuffer = NULL; U32 coreRand = seed; - LZ4F_decompressionContext_t dCtx; - LZ4F_compressionContext_t cCtx; + LZ4F_decompressionContext_t dCtx = NULL; + LZ4F_compressionContext_t cCtx = NULL; size_t result; XXH64_stateSpace_t xxh64; # define CHECK(cond, ...) if (cond) { DISPLAY("Error => "); DISPLAY(__VA_ARGS__); \ @@ -424,13 +424,13 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi prefs.autoFlush = autoflush; DISPLAYUPDATE(2, "\r%5i ", testNb); - crcOrig = XXH64((BYTE*)srcBuffer+srcStart, srcSize, 1); + crcOrig = XXH64((BYTE*)srcBuffer+srcStart, (U32)srcSize, 1); if ((FUZ_rand(&randState)&0xF) == 2) { LZ4F_preferences_t* framePrefs = &prefs; if ((FUZ_rand(&randState)&7) == 1) framePrefs = NULL; - cSize = LZ4F_compressFrame(compressedBuffer, LZ4F_compressFrameBound(srcSize, framePrefs), srcBuffer + srcStart, srcSize, framePrefs); + cSize = LZ4F_compressFrame(compressedBuffer, LZ4F_compressFrameBound(srcSize, framePrefs), (char*)srcBuffer + srcStart, srcSize, framePrefs); CHECK(LZ4F_isError(cSize), "LZ4F_compressFrame failed : error %i (%s)", (int)cSize, LZ4F_getErrorName(cSize)); } else @@ -439,7 +439,7 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi const BYTE* const iend = ip + srcSize; BYTE* op = compressedBuffer; BYTE* const oend = op + LZ4F_compressFrameBound(srcDataLength, NULL); - unsigned maxBits = FUZ_highbit(srcSize); + unsigned maxBits = FUZ_highbit((U32)srcSize); result = LZ4F_compressBegin(cCtx, op, oend-op, &prefs); CHECK(LZ4F_isError(result), "Compression header failed (error %i)", (int)result); op += result; @@ -475,7 +475,7 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi const BYTE* const iend = ip + cSize; BYTE* op = decodedBuffer; BYTE* const oend = op + srcDataLength; - unsigned maxBits = FUZ_highbit(cSize); + unsigned maxBits = FUZ_highbit((U32)cSize); unsigned nonContiguousDst = (FUZ_rand(&randState) & 3) == 1; nonContiguousDst += FUZ_rand(&randState) & nonContiguousDst; /* 0=>0; 1=>1,2 */ XXH64_resetState(&xxh64, 1); diff --git a/programs/fullbench.c b/programs/fullbench.c index 5ee1710..f34c68c 100644 --- a/programs/fullbench.c +++ b/programs/fullbench.c @@ -268,7 +268,7 @@ static int local_LZ4_compress_limitedOutput_withState(const char* in, char* out, return LZ4_compress_limitedOutput_withState(stateLZ4, in, out, inSize, LZ4_compressBound(inSize)); } -static void* ctx; +static LZ4_stream_t* ctx; static int local_LZ4_compress_continue(const char* in, char* out, int inSize) { return LZ4_compress_continue(ctx, in, out, inSize); @@ -323,7 +323,7 @@ static int local_LZ4_compressHC_limitedOutput_continue(const char* in, char* out static int local_LZ4F_compressFrame(const char* in, char* out, int inSize) { - return LZ4F_compressFrame(out, 2*inSize + 16, in, inSize, NULL); + return (int)LZ4F_compressFrame(out, 2*inSize + 16, in, inSize, NULL); } static int local_LZ4_decompress_fast(const char* in, char* out, int inSize, int outSize) @@ -378,7 +378,7 @@ static int local_LZ4F_decompress(const char* in, char* out, int inSize, int outS result = LZ4F_decompress(g_dCtx, out, &dstSize, in, &srcSize, NULL); if (result!=0) { DISPLAY("Error decompressing frame : unfinished frame\n"); exit(8); } if (srcSize != (size_t)inSize) { DISPLAY("Error decompressing frame : read size incorrect\n"); exit(9); } - return dstSize; + return (int)dstSize; } @@ -526,7 +526,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles) case 12: compressionFunction = local_LZ4_compressHC_limitedOutput_continue; initFunction = LZ4_createHC; compressorName = "LZ4_compressHC_limitedOutput_continue"; break; case 13: compressionFunction = local_LZ4_compress_forceDict; initFunction = local_LZ4_resetDictT; compressorName = "LZ4_compress_forceDict"; break; case 14: compressionFunction = local_LZ4F_compressFrame; compressorName = "LZ4F_compressFrame"; - chunkP[0].origSize = benchedSize; nbChunks=1; + chunkP[0].origSize = (int)benchedSize; nbChunks=1; break; default : DISPLAY("ERROR ! Bad algorithm Id !! \n"); free(chunkP); return 1; } @@ -602,8 +602,8 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles) case 9: decompressionFunction = local_LZ4F_decompress; dName = "LZ4F_decompress"; errorCode = LZ4F_compressFrame(compressed_buff, compressedBuffSize, orig_buff, benchedSize, NULL); if (LZ4F_isError(errorCode)) { DISPLAY("Preparation error compressing frame\n"); return 1; } - chunkP[0].origSize = benchedSize; - chunkP[0].compressedSize = errorCode; + chunkP[0].origSize = (int)benchedSize; + chunkP[0].compressedSize = (int)errorCode; nbChunks = 1; break; default : DISPLAY("ERROR ! Bad decompression algorithm Id !! \n"); free(chunkP); return 1; diff --git a/programs/fuzzer.c b/programs/fuzzer.c index f19382c..c98333d 100644 --- a/programs/fuzzer.c +++ b/programs/fuzzer.c @@ -29,6 +29,7 @@ #ifdef _MSC_VER /* Visual Studio */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ # pragma warning(disable : 4146) /* disable: C4146: minus unsigned expression */ +# pragma warning(disable : 4310) /* disable: C4310: constant char value > 127 */ #endif |