summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2019-04-13 00:03:28 (GMT)
committerYann Collet <cyan@fb.com>2019-04-13 00:03:28 (GMT)
commitc7554c3004e11b3d706143917f33783b1a2e9a29 (patch)
treed82ea9d1ba1d409dbaeea80f8270003c88c461f6
parentdd43b913a292e5404aa8bc981ad11223f216d898 (diff)
downloadlz4-c7554c3004e11b3d706143917f33783b1a2e9a29.zip
lz4-c7554c3004e11b3d706143917f33783b1a2e9a29.tar.gz
lz4-c7554c3004e11b3d706143917f33783b1a2e9a29.tar.bz2
fixed minor Visual conversion warnings
-rw-r--r--programs/util.h12
-rw-r--r--tests/fullbench.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/programs/util.h b/programs/util.h
index 4aba6a3..1385620 100644
--- a/programs/util.h
+++ b/programs/util.h
@@ -391,11 +391,11 @@ UTIL_STATIC void* UTIL_realloc(void* ptr, size_t size)
UTIL_STATIC int UTIL_prepareFileList(const char* dirName, char** bufStart, size_t* pos, char** bufEnd)
{
char* path;
- int dirLength, nbFiles = 0;
+ size_t dirLength, nbFiles = 0;
WIN32_FIND_DATAA cFile;
HANDLE hFile;
- dirLength = (int)strlen(dirName);
+ dirLength = strlen(dirName);
path = (char*) malloc(dirLength + 3);
if (!path) return 0;
@@ -412,7 +412,7 @@ UTIL_STATIC int UTIL_prepareFileList(const char* dirName, char** bufStart, size_
free(path);
do {
- int pathLength;
+ size_t pathLength;
int const fnameLength = (int)strlen(cFile.cFileName);
path = (char*) malloc(dirLength + fnameLength + 2);
if (!path) { FindClose(hFile); return 0; }
@@ -553,15 +553,15 @@ UTIL_createFileList(const char** inputNames, unsigned inputNamesNb, char** alloc
}
} else {
char* bufend = buf + bufSize;
- nbFiles += UTIL_prepareFileList(inputNames[i], &buf, &pos, &bufend);
+ nbFiles += (unsigned)UTIL_prepareFileList(inputNames[i], &buf, &pos, &bufend);
if (buf == NULL) return NULL;
assert(bufend > buf);
- bufSize = bufend - buf;
+ bufSize = (size_t)(bufend - buf);
} }
if (nbFiles == 0) { free(buf); return NULL; }
- fileTable = (const char**)malloc((nbFiles+1) * sizeof(const char*));
+ fileTable = (const char**)malloc(((size_t)nbFiles+1) * sizeof(const char*));
if (!fileTable) { free(buf); return NULL; }
for (i=0, pos=0; i<nbFiles; i++) {
diff --git a/tests/fullbench.c b/tests/fullbench.c
index 456c916..1a52aab 100644
--- a/tests/fullbench.c
+++ b/tests/fullbench.c
@@ -389,7 +389,7 @@ int fullSpeedBench(const char** fileNamesTable, int nbFiles)
/* Allocation */
chunkP = (struct chunkParameters*) malloc(((benchedSize / (size_t)g_chunkSize)+1) * sizeof(struct chunkParameters));
orig_buff = (char*) malloc(benchedSize);
- nbChunks = (int) ((benchedSize + (g_chunkSize-1)) / g_chunkSize);
+ nbChunks = (int) ((benchedSize + (size_t)g_chunkSize - 1) / (size_t)g_chunkSize);
maxCompressedChunkSize = LZ4_compressBound(g_chunkSize);
compressedBuffSize = nbChunks * maxCompressedChunkSize;
compressed_buff = (char*)malloc((size_t)compressedBuffSize);