Fix data conversion warnings

This commit is contained in:
2016-08-22 14:28:57 +02:00
parent d76a99d9ae
commit 873bf3dcc8
4 changed files with 12 additions and 10 deletions

View File

@@ -27,7 +27,7 @@ void CRCTable_Init() {
}
}
unsigned long CRC_BufferInternal(unsigned char *buffer, int len,
unsigned long CRC_BufferInternal(unsigned char *buffer, unsigned long len,
unsigned long crc)
{
unsigned char *p;
@@ -43,7 +43,7 @@ unsigned long CRC_BufferInternal(unsigned char *buffer, int len,
return (crc);
}
unsigned long CRC_Buffer(unsigned char *buffer, int len, unsigned long crc) {
unsigned long CRC_Buffer(unsigned char *buffer, unsigned long len, unsigned long crc) {
CRCTable_Init();
return (CRC_BufferInternal(buffer, len, crc));
}
@@ -57,11 +57,11 @@ unsigned long CRC_File(FILE *file) {
crc = 0xFFFFFFFFL;
for (;;) {
// Fill buffer
int count = fread(buffer, 1, 512, file);
size_t count = fread(buffer, 1, 512, file);
if (count == 0)
break;
crc = CRC_BufferInternal(buffer, count, crc);
crc = CRC_BufferInternal(buffer, (int)count, crc);
}
return (crc ^= 0xFFFFFFFFL);
}

View File

@@ -3,7 +3,7 @@
#include <stdio.h>
unsigned long CRC_Buffer(unsigned char *buffer, int len, unsigned long crc);
unsigned long CRC_Buffer(unsigned char *buffer, unsigned long len, unsigned long crc);
unsigned long CRC_File(FILE *file);
#endif

View File

@@ -129,6 +129,7 @@ void FileTime_Print(FileTime fileTime) {
}
#ifdef WIN32
long long File_GetSize(char *fileName) {
HANDLE hFile;
DWORD fSize;
@@ -139,6 +140,7 @@ long long File_GetSize(char *fileName) {
return (fSize);
}
#else
long long File_GetSize(char *fileName) {
struct stat fs;
lstat(fileName, &fs);
@@ -169,7 +171,7 @@ void File_GetSizeAndTime(char *fileName, long long *size, FileTime *time) {
#endif
void File_GetName(char *path, char *name) {
int i, j;
size_t i, j;
i = strlen(path) - 1;
while (i >= 0) {
@@ -276,7 +278,7 @@ int File_MakeDirectory(char *path) {
void File_IterateDir(char *path,
int(*func)(char *path, char *name, void *data), void *data) {
int handle;
intptr_t handle;
struct _finddata_t fileinfo;
char f_path[MaxPath];
int fin = 0;
@@ -352,8 +354,8 @@ int File_Copy(const char *pathOrig, const char *pathDest) {
FILE *fOrig = NULL;
FILE *fDest = NULL;
char *buffer = NULL;
int readLen = 0;
int writeLen = 0;
size_t readLen = 0;
size_t writeLen = 0;
int status = 0;
if ((fOrig = fopen(pathOrig, "rb")) == NULL) {

View File

@@ -11,7 +11,7 @@
// Copies a string.
char *String_Copy(char *str) {
char *strnew;
int len;
size_t len;
len = strlen(str);
strnew = malloc(len + 1);
if (strnew != NULL) {