mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-07 11:58:13 +00:00
Review usage of sizeof(), unify conventions
All functions requiring sizeof() now follow the same convention: NUM_ELEMENTS*NUM_SUBELEMENTS*sizeof()
This commit is contained in:
@@ -183,7 +183,7 @@ unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead)
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
data = (unsigned char *)RL_MALLOC(sizeof(unsigned char)*size);
|
||||
data = (unsigned char *)RL_MALLOC(size*sizeof(unsigned char));
|
||||
|
||||
// NOTE: fread() returns number of read elements instead of bytes, so we read [1 byte, size elements]
|
||||
unsigned int count = (unsigned int)fread(data, sizeof(unsigned char), size, file);
|
||||
@@ -246,7 +246,7 @@ char *LoadFileText(const char *fileName)
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
text = (char *)RL_MALLOC(sizeof(char)*(size + 1));
|
||||
text = (char *)RL_MALLOC((size + 1)*sizeof(char));
|
||||
unsigned int count = (unsigned int)fread(text, sizeof(char), size, textFile);
|
||||
|
||||
// WARNING: \r\n is converted to \n on reading, so,
|
||||
|
Reference in New Issue
Block a user