Fix data conversion warnings
This commit is contained in:
@@ -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 long crc)
|
||||||
{
|
{
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
@@ -43,7 +43,7 @@ unsigned long CRC_BufferInternal(unsigned char *buffer, int len,
|
|||||||
return (crc);
|
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();
|
CRCTable_Init();
|
||||||
return (CRC_BufferInternal(buffer, len, crc));
|
return (CRC_BufferInternal(buffer, len, crc));
|
||||||
}
|
}
|
||||||
@@ -57,11 +57,11 @@ unsigned long CRC_File(FILE *file) {
|
|||||||
crc = 0xFFFFFFFFL;
|
crc = 0xFFFFFFFFL;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// Fill buffer
|
// Fill buffer
|
||||||
int count = fread(buffer, 1, 512, file);
|
size_t count = fread(buffer, 1, 512, file);
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
crc = CRC_BufferInternal(buffer, count, crc);
|
crc = CRC_BufferInternal(buffer, (int)count, crc);
|
||||||
}
|
}
|
||||||
return (crc ^= 0xFFFFFFFFL);
|
return (crc ^= 0xFFFFFFFFL);
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#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);
|
unsigned long CRC_File(FILE *file);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ void FileTime_Print(FileTime fileTime) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
long long File_GetSize(char *fileName) {
|
long long File_GetSize(char *fileName) {
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
DWORD fSize;
|
DWORD fSize;
|
||||||
@@ -139,6 +140,7 @@ long long File_GetSize(char *fileName) {
|
|||||||
return (fSize);
|
return (fSize);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
long long File_GetSize(char *fileName) {
|
long long File_GetSize(char *fileName) {
|
||||||
struct stat fs;
|
struct stat fs;
|
||||||
lstat(fileName, &fs);
|
lstat(fileName, &fs);
|
||||||
@@ -169,7 +171,7 @@ void File_GetSizeAndTime(char *fileName, long long *size, FileTime *time) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void File_GetName(char *path, char *name) {
|
void File_GetName(char *path, char *name) {
|
||||||
int i, j;
|
size_t i, j;
|
||||||
|
|
||||||
i = strlen(path) - 1;
|
i = strlen(path) - 1;
|
||||||
while (i >= 0) {
|
while (i >= 0) {
|
||||||
@@ -276,7 +278,7 @@ int File_MakeDirectory(char *path) {
|
|||||||
|
|
||||||
void File_IterateDir(char *path,
|
void File_IterateDir(char *path,
|
||||||
int(*func)(char *path, char *name, void *data), void *data) {
|
int(*func)(char *path, char *name, void *data), void *data) {
|
||||||
int handle;
|
intptr_t handle;
|
||||||
struct _finddata_t fileinfo;
|
struct _finddata_t fileinfo;
|
||||||
char f_path[MaxPath];
|
char f_path[MaxPath];
|
||||||
int fin = 0;
|
int fin = 0;
|
||||||
@@ -352,8 +354,8 @@ int File_Copy(const char *pathOrig, const char *pathDest) {
|
|||||||
FILE *fOrig = NULL;
|
FILE *fOrig = NULL;
|
||||||
FILE *fDest = NULL;
|
FILE *fDest = NULL;
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
int readLen = 0;
|
size_t readLen = 0;
|
||||||
int writeLen = 0;
|
size_t writeLen = 0;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
if ((fOrig = fopen(pathOrig, "rb")) == NULL) {
|
if ((fOrig = fopen(pathOrig, "rb")) == NULL) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// Copies a string.
|
// Copies a string.
|
||||||
char *String_Copy(char *str) {
|
char *String_Copy(char *str) {
|
||||||
char *strnew;
|
char *strnew;
|
||||||
int len;
|
size_t len;
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
strnew = malloc(len + 1);
|
strnew = malloc(len + 1);
|
||||||
if (strnew != NULL) {
|
if (strnew != NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user