Avoid all MSVC compile warnings
Most warning were related to types conversion (casting required) and unsigned/signed types comparisons. Added preprocessor directives (_CRT_SECURE_NO_DEPRECATE; _CRT_NONSTDC_NO_DEPRECATE) to avoid warnings about unsafe functions, those functions are safe while used properly and recommended alternatives are MS only. Some external libraries still generate warnings.
This commit is contained in:
parent
9a1e934621
commit
fdad1f023b
9 changed files with 140 additions and 140 deletions
|
@ -186,7 +186,7 @@ unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead)
|
|||
data = (unsigned char *)RL_MALLOC(sizeof(unsigned char)*size);
|
||||
|
||||
// NOTE: fread() returns number of read elements instead of bytes, so we read [1 byte, size elements]
|
||||
unsigned int count = fread(data, sizeof(unsigned char), size, file);
|
||||
unsigned int count = (unsigned int)fread(data, sizeof(unsigned char), size, file);
|
||||
*bytesRead = count;
|
||||
|
||||
if (count != size) TRACELOG(LOG_WARNING, "FILEIO: [%s] File partially loaded", fileName);
|
||||
|
@ -212,7 +212,7 @@ void SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite)
|
|||
|
||||
if (file != NULL)
|
||||
{
|
||||
unsigned int count = fwrite(data, sizeof(unsigned char), bytesToWrite, file);
|
||||
unsigned int count = (unsigned int)fwrite(data, sizeof(unsigned char), bytesToWrite, file);
|
||||
|
||||
if (count == 0) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to write file", fileName);
|
||||
else if (count != bytesToWrite) TRACELOG(LOG_WARNING, "FILEIO: [%s] File partially written", fileName);
|
||||
|
@ -241,13 +241,13 @@ char *LoadFileText(const char *fileName)
|
|||
// text mode causes carriage return-linefeed translation...
|
||||
// ...but using fseek() should return correct byte-offset
|
||||
fseek(textFile, 0, SEEK_END);
|
||||
int size = ftell(textFile);
|
||||
unsigned int size = (unsigned int)ftell(textFile);
|
||||
fseek(textFile, 0, SEEK_SET);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
text = (char *)RL_MALLOC(sizeof(char)*(size + 1));
|
||||
int count = fread(text, sizeof(char), size, textFile);
|
||||
unsigned int count = (unsigned int)fread(text, sizeof(char), size, textFile);
|
||||
|
||||
// WARNING: \r\n is converted to \n on reading, so,
|
||||
// read bytes count gets reduced by the number of lines
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue