diff options
author | Yann Collet <cyan@fb.com> | 2019-05-31 20:25:12 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2019-05-31 20:25:12 (GMT) |
commit | 33a04fb8bd19fb4450ea37dad6aa0fd0d7f4007c (patch) | |
tree | 7a1e3ecd6a7d991ffd207003546b17e033239707 | |
parent | 99f1721ff5e3ab74fbe1fc8c68337ba87c1a8be9 (diff) | |
download | lz4-33a04fb8bd19fb4450ea37dad6aa0fd0d7f4007c.zip lz4-33a04fb8bd19fb4450ea37dad6aa0fd0d7f4007c.tar.gz lz4-33a04fb8bd19fb4450ea37dad6aa0fd0d7f4007c.tar.bz2 |
fullbench: ensure decompressionFunction and dName are initialized
Visual Studio seems to miss that they are necessarily initialized in the switch() { case: }
-rw-r--r-- | tests/fullbench.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/fullbench.c b/tests/fullbench.c index dbdb02c..4609f13 100644 --- a/tests/fullbench.c +++ b/tests/fullbench.c @@ -571,9 +571,15 @@ int fullSpeedBench(const char** fileNamesTable, int nbFiles) nbChunks = (int) (((int)benchedSize + (g_chunkSize-1))/ g_chunkSize); for (i=0; i<nbChunks; i++) { - chunkP[i].id = i; + chunkP[i].id = (U32)i; chunkP[i].origBuffer = in; in += g_chunkSize; - if ((int)remaining > g_chunkSize) { chunkP[i].origSize = g_chunkSize; remaining -= g_chunkSize; } else { chunkP[i].origSize = (int)remaining; remaining = 0; } + if ((int)remaining > g_chunkSize) { + chunkP[i].origSize = g_chunkSize; + remaining -= (size_t)g_chunkSize; + } else { + chunkP[i].origSize = (int)remaining; + remaining = 0; + } chunkP[i].compressedBuffer = out; out += maxCompressedChunkSize; chunkP[i].compressedSize = 0; } @@ -586,8 +592,8 @@ int fullSpeedBench(const char** fileNamesTable, int nbFiles) /* Decompression Algorithms */ for (dAlgNb=0; (dAlgNb <= NB_DECOMPRESSION_ALGORITHMS) && g_decompressionTest; dAlgNb++) { - const char* dName; - int (*decompressionFunction)(const char*, char*, int, int); + const char* dName = NULL; + int (*decompressionFunction)(const char*, char*, int, int) = NULL; double bestTime = 100000000.; int checkResult = 1; @@ -609,6 +615,7 @@ int fullSpeedBench(const char** fileNamesTable, int nbFiles) case 11: if (dAlgNb == 10) { decompressionFunction = local_LZ4F_decompress; dName = "LZ4F_decompress"; } /* can be skipped */ if (dAlgNb == 11) { decompressionFunction = local_LZ4F_decompress_followHint; dName = "LZ4F_decompress_followHint"; } /* can be skipped */ + /* prepare compressed data using frame format */ { size_t const fcsize = LZ4F_compressFrame(compressed_buff, (size_t)compressedBuffSize, orig_buff, benchedSize, NULL); assert(!LZ4F_isError(fcsize)); chunkP[0].origSize = (int)benchedSize; @@ -620,6 +627,9 @@ int fullSpeedBench(const char** fileNamesTable, int nbFiles) continue; /* skip if unknown ID */ } + assert(decompressionFunction != NULL); + assert(dName != NULL); + { size_t i; for (i=0; i<benchedSize; i++) orig_buff[i]=0; } /* zeroing source area, for CRC checking */ for (loopNb = 1; loopNb <= g_nbIterations; loopNb++) { |