From cc21115cb4f9ff1f97322104ffb19ca89b5a0eb1 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 21 Nov 2016 19:26:49 -0800 Subject: minor warning fix --- examples/HCStreaming_ringBuffer.c | 49 +++++++++++++++------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) (limited to 'examples') diff --git a/examples/HCStreaming_ringBuffer.c b/examples/HCStreaming_ringBuffer.c index a9c00f4..d49b267 100644 --- a/examples/HCStreaming_ringBuffer.c +++ b/examples/HCStreaming_ringBuffer.c @@ -6,7 +6,7 @@ * Compiler Options **************************************/ #ifdef _MSC_VER /* Visual Studio */ -# define _CRT_SECURE_NO_WARNINGS // for MSVC +# define _CRT_SECURE_NO_WARNINGS /* for MSVC */ # define snprintf sprintf_s #endif @@ -59,17 +59,15 @@ void test_compress(FILE* outFp, FILE* inpFp) static char inpBuf[RING_BUFFER_BYTES]; int inpOffset = 0; - for(;;) - { + for(;;) { // Read random length ([1,MESSAGE_MAX_BYTES]) data to the ring buffer. char* const inpPtr = &inpBuf[inpOffset]; const int randomLength = (rand() % MESSAGE_MAX_BYTES) + 1; const int inpBytes = (int) read_bin(inpFp, inpPtr, randomLength); if (0 == inpBytes) break; - { #define CMPBUFSIZE (LZ4_COMPRESSBOUND(MESSAGE_MAX_BYTES)) - char cmpBuf[CMPBUFSIZE]; + { char cmpBuf[CMPBUFSIZE]; const int cmpBytes = LZ4_compress_HC_continue(lz4Stream, inpPtr, cmpBuf, inpBytes, CMPBUFSIZE); if(cmpBytes <= 0) break; @@ -95,13 +93,11 @@ void test_decompress(FILE* outFp, FILE* inpFp) LZ4_streamDecode_t lz4StreamDecode_body = { 0 }; LZ4_streamDecode_t* lz4StreamDecode = &lz4StreamDecode_body; - for(;;) - { + for(;;) { int cmpBytes = 0; char cmpBuf[CMPBUFSIZE]; - { - const size_t r0 = read_int32(inpFp, &cmpBytes); + { const size_t r0 = read_int32(inpFp, &cmpBytes); size_t r1; if(r0 != 1 || cmpBytes <= 0) break; @@ -111,8 +107,7 @@ void test_decompress(FILE* outFp, FILE* inpFp) break; } - { - char* const decPtr = &decBuf[decOffset]; + { char* const decPtr = &decBuf[decOffset]; const int decBytes = LZ4_decompress_safe_continue( lz4StreamDecode, cmpBuf, decPtr, cmpBytes, MESSAGE_MAX_BYTES); if(decBytes <= 0) @@ -136,8 +131,7 @@ size_t compare(FILE* f0, FILE* f1) { size_t result = 1; - for (;;) - { + for (;;) { char b0[65536]; char b1[65536]; const size_t r0 = fread(b0, 1, sizeof(b0), f0); @@ -145,16 +139,14 @@ size_t compare(FILE* f0, FILE* f1) if ((r0==0) && (r1==0)) return 0; // success - if (r0 != r1) - { + if (r0 != r1) { size_t smallest = r0; if (r1