diff --git a/src/crc.c b/src/crc.c index 4309193..406b455 100644 --- a/src/crc.c +++ b/src/crc.c @@ -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); } \ No newline at end of file diff --git a/src/crc.h b/src/crc.h index 5256b8d..bf1a2dc 100644 --- a/src/crc.h +++ b/src/crc.h @@ -3,7 +3,7 @@ #include -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 diff --git a/src/fileutil.c b/src/fileutil.c index 8441e26..01c9637 100644 --- a/src/fileutil.c +++ b/src/fileutil.c @@ -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) { diff --git a/src/util.c b/src/util.c index 6e6fb26..0c6df3c 100644 --- a/src/util.c +++ b/src/util.c @@ -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) {