diff --git a/projects/VS2017/raylib/raylib.vcxproj b/projects/VS2017/raylib/raylib.vcxproj index 4fe9b684..a608d8e1 100644 --- a/projects/VS2017/raylib/raylib.vcxproj +++ b/projects/VS2017/raylib/raylib.vcxproj @@ -161,7 +161,7 @@ Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP CompileAsC $(SolutionDir)..\..\src\external\glfw\include @@ -178,7 +178,7 @@ Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP + _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP CompileAsC $(SolutionDir)..\..\src\external\glfw\include @@ -195,7 +195,7 @@ Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;BUILD_LIBTYPE_SHARED + _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;BUILD_LIBTYPE_SHARED CompileAsC $(SolutionDir)..\..\src\external\glfw\include MultiThreadedDebug @@ -214,7 +214,7 @@ Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;BUILD_LIBTYPE_SHARED + _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;BUILD_LIBTYPE_SHARED CompileAsC $(SolutionDir)..\..\src\external\glfw\include MultiThreadedDebug @@ -235,7 +235,7 @@ MaxSpeed true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP $(SolutionDir)..\..\src\external\glfw\include CompileAsC @@ -253,7 +253,7 @@ MaxSpeed true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP + _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP $(SolutionDir)..\..\src\external\glfw\include CompileAsC @@ -271,7 +271,7 @@ MaxSpeed true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;BUILD_LIBTYPE_SHARED + _CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;BUILD_LIBTYPE_SHARED $(SolutionDir)..\..\src\external\glfw\include CompileAsC MultiThreaded @@ -291,7 +291,7 @@ MaxSpeed true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;BUILD_LIBTYPE_SHARED + _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);GRAPHICS_API_OPENGL_33;PLATFORM_DESKTOP;BUILD_LIBTYPE_SHARED $(SolutionDir)..\..\src\external\glfw\include CompileAsC MultiThreaded diff --git a/src/core.c b/src/core.c index 4ce2c04b..b0c38450 100644 --- a/src/core.c +++ b/src/core.c @@ -1690,7 +1690,7 @@ int GetFPS(void) if ((GetTime() - last) > FPS_STEP) { - last = GetTime(); + last = (float)GetTime(); index = (index + 1)%FPS_CAPTURE_FRAMES_COUNT; average -= history[index]; history[index] = fpsFrame/FPS_CAPTURE_FRAMES_COUNT; @@ -1752,10 +1752,10 @@ Color ColorFromNormalized(Vector4 normalized) { Color result; - result.r = normalized.x*255.0f; - result.g = normalized.y*255.0f; - result.b = normalized.z*255.0f; - result.a = normalized.w*255.0f; + result.r = (unsigned char)(normalized.x*255.0f); + result.g = (unsigned char)(normalized.y*255.0f); + result.b = (unsigned char)(normalized.z*255.0f); + result.a = (unsigned char)(normalized.w*255.0f); return result; } @@ -1821,28 +1821,28 @@ Color ColorFromHSV(Vector3 hsv) float h = hsv.x, s = hsv.y, v = hsv.z; // Red channel - float k = fmod((5.0f + h/60.0f), 6); + float k = fmodf((5.0f + h/60.0f), 6); float t = 4.0f - k; k = (t < k)? t : k; k = (k < 1)? k : 1; k = (k > 0)? k : 0; - color.r = (v - v*s*k)*255; + color.r = (unsigned char)((v - v*s*k)*255.0f); // Green channel - k = fmod((3.0f + h/60.0f), 6); + k = fmodf((3.0f + h/60.0f), 6); t = 4.0f - k; k = (t < k)? t : k; k = (k < 1)? k : 1; k = (k > 0)? k : 0; - color.g = (v - v*s*k)*255; + color.g = (unsigned char)((v - v*s*k)*255.0f); // Blue channel - k = fmod((1.0f + h/60.0f), 6); + k = fmodf((1.0f + h/60.0f), 6); t = 4.0f - k; k = (t < k)? t : k; k = (k < 1)? k : 1; k = (k > 0)? k : 0; - color.b = (v - v*s*k)*255; + color.b = (unsigned char)((v - v*s*k)*255.0f); return color; } @@ -2023,7 +2023,7 @@ const char *GetFileNameWithoutExt(const char *filePath) if (filePath != NULL) strcpy(fileName, GetFileName(filePath)); // Get filename with extension - int len = strlen(fileName); + int len = (int)strlen(fileName); for (int i = 0; (i < len) && (i < MAX_FILENAMEWITHOUTEXT_LENGTH); i++) { @@ -2080,7 +2080,7 @@ const char *GetPrevDirectoryPath(const char *dirPath) { static char prevDirPath[MAX_FILEPATH_LENGTH]; memset(prevDirPath, 0, MAX_FILEPATH_LENGTH); - int pathLen = strlen(dirPath); + int pathLen = (int)strlen(dirPath); if (pathLen <= 3) strcpy(prevDirPath, dirPath); @@ -2886,9 +2886,9 @@ static bool InitGraphicsDevice(int width, int height) // Get closest video mode to desired CORE.Window.screen.width/CORE.Window.screen.height for (int i = 0; i < count; i++) { - if (modes[i].width >= CORE.Window.screen.width) + if ((unsigned int)modes[i].width >= CORE.Window.screen.width) { - if (modes[i].height >= CORE.Window.screen.height) + if ((unsigned int)modes[i].height >= CORE.Window.screen.height) { CORE.Window.display.width = modes[i].width; CORE.Window.display.height = modes[i].height; diff --git a/src/models.c b/src/models.c index 7e174cae..dfc070c6 100644 --- a/src/models.c +++ b/src/models.c @@ -142,8 +142,8 @@ void DrawPoint3D(Vector3 position, Color color) rlTranslatef(position.x, position.y, position.z); rlBegin(RL_LINES); rlColor4ub(color.r, color.g, color.b, color.a); - rlVertex3f(0.0,0.0,0.0); - rlVertex3f(0.0,0.0,0.1); + rlVertex3f(0.0f, 0.0f, 0.0f); + rlVertex3f(0.0f, 0.0f, 0.1f); rlEnd(); rlPopMatrix(); } @@ -863,7 +863,7 @@ Material *LoadMaterials(const char *fileName, int *materialCount) #endif // Set materials shader to default (DIFFUSE, SPECULAR, NORMAL) - for (int i = 0; i < count; i++) materials[i].shader = GetShaderDefault(); + for (unsigned int i = 0; i < count; i++) materials[i].shader = GetShaderDefault(); *materialCount = count; return materials; @@ -998,7 +998,7 @@ ModelAnimation *LoadModelAnimations(const char *filename, int *animCount) fseek(iqmFile, iqm.ofs_frames, SEEK_SET); fread(framedata, iqm.num_frames*iqm.num_framechannels*sizeof(unsigned short), 1, iqmFile); - for (int a = 0; a < iqm.num_anims; a++) + for (unsigned int a = 0; a < iqm.num_anims; a++) { animations[a].frameCount = anim[a].num_frames; animations[a].boneCount = iqm.num_poses; @@ -1006,19 +1006,19 @@ ModelAnimation *LoadModelAnimations(const char *filename, int *animCount) animations[a].framePoses = RL_MALLOC(anim[a].num_frames*sizeof(Transform *)); //animations[a].framerate = anim.framerate; // TODO: Use framerate? - for (int j = 0; j < iqm.num_poses; j++) + for (unsigned int j = 0; j < iqm.num_poses; j++) { strcpy(animations[a].bones[j].name, "ANIMJOINTNAME"); animations[a].bones[j].parent = poses[j].parent; } - for (int j = 0; j < anim[a].num_frames; j++) animations[a].framePoses[j] = RL_MALLOC(iqm.num_poses*sizeof(Transform)); + for (unsigned int j = 0; j < anim[a].num_frames; j++) animations[a].framePoses[j] = RL_MALLOC(iqm.num_poses*sizeof(Transform)); int dcounter = anim[a].first_frame*iqm.num_framechannels; - for (int frame = 0; frame < anim[a].num_frames; frame++) + for (unsigned int frame = 0; frame < anim[a].num_frames; frame++) { - for (int i = 0; i < iqm.num_poses; i++) + for (unsigned int i = 0; i < iqm.num_poses; i++) { animations[a].framePoses[frame][i].translation.x = poses[i].channeloffset[0]; @@ -1105,7 +1105,7 @@ ModelAnimation *LoadModelAnimations(const char *filename, int *animCount) } // Build frameposes - for (int frame = 0; frame < anim[a].num_frames; frame++) + for (unsigned int frame = 0; frame < anim[a].num_frames; frame++) { for (int i = 0; i < animations[a].boneCount; i++) { @@ -2458,10 +2458,10 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota Color color = model.materials[model.meshMaterial[i]].maps[MAP_DIFFUSE].color; Color colorTint = WHITE; - colorTint.r = (((float)color.r/255.0)*((float)tint.r/255.0))*255; - colorTint.g = (((float)color.g/255.0)*((float)tint.g/255.0))*255; - colorTint.b = (((float)color.b/255.0)*((float)tint.b/255.0))*255; - colorTint.a = (((float)color.a/255.0)*((float)tint.a/255.0))*255; + colorTint.r = (unsigned char)((((float)color.r/255.0)*((float)tint.r/255.0))*255.0f); + colorTint.g = (unsigned char)((((float)color.g/255.0)*((float)tint.g/255.0))*255.0f); + colorTint.b = (unsigned char)((((float)color.b/255.0)*((float)tint.b/255.0))*255.0f); + colorTint.a = (unsigned char)((((float)color.a/255.0)*((float)tint.a/255.0))*255.0f); model.materials[model.meshMaterial[i]].maps[MAP_DIFFUSE].color = colorTint; rlDrawMesh(model.meshes[i], model.materials[model.meshMaterial[i]], model.transform); @@ -2845,7 +2845,7 @@ static Model LoadOBJ(const char *fileName) if (fileData != NULL) { - int dataSize = strlen(fileData); + unsigned int dataSize = (unsigned int)strlen(fileData); char currentDir[1024] = { 0 }; strcpy(currentDir, GetWorkingDirectory()); chdir(GetDirectoryPath(fileName)); @@ -2897,7 +2897,7 @@ static Model LoadOBJ(const char *fileName) int vtCount = 0; int vnCount = 0; - for (int f = 0; f < attrib.num_faces; f++) + for (unsigned int f = 0; f < attrib.num_faces; f++) { // Get indices for the face tinyobj_vertex_index_t idx0 = attrib.faces[3*f + 0]; @@ -2934,7 +2934,7 @@ static Model LoadOBJ(const char *fileName) } // Init model materials - for (int m = 0; m < materialCount; m++) + for (unsigned int m = 0; m < materialCount; m++) { // Init material to default // NOTE: Uses default shader, only MAP_DIFFUSE supported @@ -2970,18 +2970,18 @@ static Model LoadOBJ(const char *fileName) model.materials[m].maps[MAP_DIFFUSE].texture = GetTextureDefault(); // Get default texture, in case no texture is defined if (materials[m].diffuse_texname != NULL) model.materials[m].maps[MAP_DIFFUSE].texture = LoadTexture(materials[m].diffuse_texname); //char *diffuse_texname; // map_Kd - model.materials[m].maps[MAP_DIFFUSE].color = (Color){ (float)(materials[m].diffuse[0]*255.0f), (float)(materials[m].diffuse[1]*255.0f), (float)(materials[m].diffuse[2]*255.0f), 255 }; //float diffuse[3]; + model.materials[m].maps[MAP_DIFFUSE].color = (Color){ (unsigned char)(materials[m].diffuse[0]*255.0f), (unsigned char)(materials[m].diffuse[1]*255.0f), (unsigned char)(materials[m].diffuse[2]*255.0f), 255 }; //float diffuse[3]; model.materials[m].maps[MAP_DIFFUSE].value = 0.0f; if (materials[m].specular_texname != NULL) model.materials[m].maps[MAP_SPECULAR].texture = LoadTexture(materials[m].specular_texname); //char *specular_texname; // map_Ks - model.materials[m].maps[MAP_SPECULAR].color = (Color){ (float)(materials[m].specular[0]*255.0f), (float)(materials[m].specular[1]*255.0f), (float)(materials[m].specular[2]*255.0f), 255 }; //float specular[3]; + model.materials[m].maps[MAP_SPECULAR].color = (Color){ (unsigned char)(materials[m].specular[0]*255.0f), (unsigned char)(materials[m].specular[1]*255.0f), (unsigned char)(materials[m].specular[2]*255.0f), 255 }; //float specular[3]; model.materials[m].maps[MAP_SPECULAR].value = 0.0f; if (materials[m].bump_texname != NULL) model.materials[m].maps[MAP_NORMAL].texture = LoadTexture(materials[m].bump_texname); //char *bump_texname; // map_bump, bump model.materials[m].maps[MAP_NORMAL].color = WHITE; model.materials[m].maps[MAP_NORMAL].value = materials[m].shininess; - model.materials[m].maps[MAP_EMISSION].color = (Color){ (float)(materials[m].emission[0]*255.0f), (float)(materials[m].emission[1]*255.0f), (float)(materials[m].emission[2]*255.0f), 255 }; //float emission[3]; + model.materials[m].maps[MAP_EMISSION].color = (Color){ (unsigned char)(materials[m].emission[0]*255.0f), (unsigned char)(materials[m].emission[1]*255.0f), (unsigned char)(materials[m].emission[2]*255.0f), 255 }; //float emission[3]; if (materials[m].displacement_texname != NULL) model.materials[m].maps[MAP_HEIGHT].texture = LoadTexture(materials[m].displacement_texname); //char *displacement_texname; // disp } @@ -3175,7 +3175,7 @@ static Model LoadIQM(const char *fileName) { int tcounter = 0; - for (int i = imesh[m].first_triangle; i < (imesh[m].first_triangle + imesh[m].num_triangles); i++) + for (unsigned int i = imesh[m].first_triangle; i < (imesh[m].first_triangle + imesh[m].num_triangles); i++) { // IQM triangles are stored counter clockwise, but raylib sets opengl to clockwise drawing, so we swap them around model.meshes[m].indices[tcounter + 2] = tri[i].vertex[0] - imesh[m].first_vertex; @@ -3190,7 +3190,7 @@ static Model LoadIQM(const char *fileName) fseek(iqmFile, iqm.ofs_vertexarrays, SEEK_SET); fread(va, iqm.num_vertexarrays*sizeof(IQMVertexArray), 1, iqmFile); - for (int i = 0; i < iqm.num_vertexarrays; i++) + for (unsigned int i = 0; i < iqm.num_vertexarrays; i++) { switch (va[i].type) { @@ -3200,10 +3200,10 @@ static Model LoadIQM(const char *fileName) fseek(iqmFile, va[i].offset, SEEK_SET); fread(vertex, iqm.num_vertexes*3*sizeof(float), 1, iqmFile); - for (int m = 0; m < iqm.num_meshes; m++) + for (unsigned int m = 0; m < iqm.num_meshes; m++) { int vCounter = 0; - for (int i = imesh[m].first_vertex*3; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*3; i++) + for (unsigned int i = imesh[m].first_vertex*3; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*3; i++) { model.meshes[m].vertices[vCounter] = vertex[i]; model.meshes[m].animVertices[vCounter] = vertex[i]; @@ -3217,10 +3217,10 @@ static Model LoadIQM(const char *fileName) fseek(iqmFile, va[i].offset, SEEK_SET); fread(normal, iqm.num_vertexes*3*sizeof(float), 1, iqmFile); - for (int m = 0; m < iqm.num_meshes; m++) + for (unsigned int m = 0; m < iqm.num_meshes; m++) { int vCounter = 0; - for (int i = imesh[m].first_vertex*3; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*3; i++) + for (unsigned int i = imesh[m].first_vertex*3; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*3; i++) { model.meshes[m].normals[vCounter] = normal[i]; model.meshes[m].animNormals[vCounter] = normal[i]; @@ -3234,10 +3234,10 @@ static Model LoadIQM(const char *fileName) fseek(iqmFile, va[i].offset, SEEK_SET); fread(text, iqm.num_vertexes*2*sizeof(float), 1, iqmFile); - for (int m = 0; m < iqm.num_meshes; m++) + for (unsigned int m = 0; m < iqm.num_meshes; m++) { int vCounter = 0; - for (int i = imesh[m].first_vertex*2; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*2; i++) + for (unsigned int i = imesh[m].first_vertex*2; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*2; i++) { model.meshes[m].texcoords[vCounter] = text[i]; vCounter++; @@ -3250,10 +3250,10 @@ static Model LoadIQM(const char *fileName) fseek(iqmFile, va[i].offset, SEEK_SET); fread(blendi, iqm.num_vertexes*4*sizeof(char), 1, iqmFile); - for (int m = 0; m < iqm.num_meshes; m++) + for (unsigned int m = 0; m < iqm.num_meshes; m++) { int boneCounter = 0; - for (int i = imesh[m].first_vertex*4; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*4; i++) + for (unsigned int i = imesh[m].first_vertex*4; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*4; i++) { model.meshes[m].boneIds[boneCounter] = blendi[i]; boneCounter++; @@ -3266,10 +3266,10 @@ static Model LoadIQM(const char *fileName) fseek(iqmFile, va[i].offset, SEEK_SET); fread(blendw, iqm.num_vertexes*4*sizeof(unsigned char), 1, iqmFile); - for (int m = 0; m < iqm.num_meshes; m++) + for (unsigned int m = 0; m < iqm.num_meshes; m++) { int boneCounter = 0; - for (int i = imesh[m].first_vertex*4; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*4; i++) + for (unsigned int i = imesh[m].first_vertex*4; i < (imesh[m].first_vertex + imesh[m].num_vertexes)*4; i++) { model.meshes[m].boneWeights[boneCounter] = blendw[i]/255.0f; boneCounter++; @@ -3288,7 +3288,7 @@ static Model LoadIQM(const char *fileName) model.bones = RL_MALLOC(iqm.num_joints*sizeof(BoneInfo)); model.bindPose = RL_MALLOC(iqm.num_joints*sizeof(Transform)); - for (int i = 0; i < iqm.num_joints; i++) + for (unsigned int i = 0; i < iqm.num_joints; i++) { // Bones model.bones[i].parent = ijoint[i].parent; @@ -3460,17 +3460,17 @@ static Image LoadImageFromCgltfImage(cgltf_image *image, const char *texPath, Co else if (image->buffer_view) { unsigned char *data = RL_MALLOC(image->buffer_view->size); - int n = image->buffer_view->offset; - int stride = image->buffer_view->stride ? image->buffer_view->stride : 1; + int n = (int)image->buffer_view->offset; + int stride = (int)image->buffer_view->stride ? (int)image->buffer_view->stride : 1; - for (int i = 0; i < image->buffer_view->size; i++) + for (unsigned int i = 0; i < image->buffer_view->size; i++) { data[i] = ((unsigned char *)image->buffer_view->buffer->data)[n]; n += stride; } int width, height; - unsigned char *raw = stbi_load_from_memory(data, image->buffer_view->size, &width, &height, NULL, 4); + unsigned char *raw = stbi_load_from_memory(data, (int)image->buffer_view->size, &width, &height, NULL, 4); free(data); rimage.data = raw; @@ -3511,12 +3511,12 @@ static Model LoadGLTF(const char *fileName) #define LOAD_ACCESSOR(type, nbcomp, acc, dst) \ { \ int n = 0; \ - type* buf = (type*)acc->buffer_view->buffer->data+acc->buffer_view->offset/sizeof(type)+acc->offset/sizeof(type); \ - for (int k = 0; k < acc->count; k++) {\ + type* buf = (type*)acc->buffer_view->buffer->data + acc->buffer_view->offset/sizeof(type) + acc->offset/sizeof(type); \ + for (unsigned int k = 0; k < acc->count; k++) {\ for (int l = 0; l < nbcomp; l++) {\ - dst[nbcomp*k+l] = buf[n+l];\ + dst[nbcomp*k + l] = buf[n + l];\ }\ - n += acc->stride/sizeof(type);\ + n += (int)(acc->stride/sizeof(type));\ }\ } @@ -3544,12 +3544,12 @@ static Model LoadGLTF(const char *fileName) int primitivesCount = 0; - for (int i = 0; i < data->meshes_count; i++) primitivesCount += (int)data->meshes[i].primitives_count; + for (unsigned int i = 0; i < data->meshes_count; i++) primitivesCount += (int)data->meshes[i].primitives_count; // Process glTF data and map to model model.meshCount = primitivesCount; model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh)); - model.materialCount = data->materials_count + 1; + model.materialCount = (int)data->materials_count + 1; model.materials = RL_MALLOC(model.materialCount*sizeof(Material)); model.meshMaterial = RL_MALLOC(model.meshCount*sizeof(int)); @@ -3625,16 +3625,16 @@ static Model LoadGLTF(const char *fileName) int primitiveIndex = 0; - for (int i = 0; i < data->meshes_count; i++) + for (unsigned int i = 0; i < data->meshes_count; i++) { - for (int p = 0; p < data->meshes[i].primitives_count; p++) + for (unsigned int p = 0; p < data->meshes[i].primitives_count; p++) { - for (int j = 0; j < data->meshes[i].primitives[p].attributes_count; j++) + for (unsigned int j = 0; j < data->meshes[i].primitives[p].attributes_count; j++) { if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_position) { cgltf_accessor *acc = data->meshes[i].primitives[p].attributes[j].data; - model.meshes[primitiveIndex].vertexCount = acc->count; + model.meshes[primitiveIndex].vertexCount = (int)acc->count; model.meshes[primitiveIndex].vertices = RL_MALLOC(sizeof(float)*model.meshes[primitiveIndex].vertexCount*3); LOAD_ACCESSOR(float, 3, acc, model.meshes[primitiveIndex].vertices) @@ -3669,7 +3669,7 @@ static Model LoadGLTF(const char *fileName) { if (acc->component_type == cgltf_component_type_r_16u) { - model.meshes[primitiveIndex].triangleCount = acc->count/3; + model.meshes[primitiveIndex].triangleCount = (int)acc->count/3; model.meshes[primitiveIndex].indices = RL_MALLOC(sizeof(unsigned short)*model.meshes[primitiveIndex].triangleCount*3); LOAD_ACCESSOR(unsigned short, 1, acc, model.meshes[primitiveIndex].indices) } @@ -3688,7 +3688,7 @@ static Model LoadGLTF(const char *fileName) if (data->meshes[i].primitives[p].material) { // Compute the offset - model.meshMaterial[primitiveIndex] = data->meshes[i].primitives[p].material - data->materials; + model.meshMaterial[primitiveIndex] = (int)(data->meshes[i].primitives[p].material - data->materials); } else { diff --git a/src/raudio.c b/src/raudio.c index 5224d516..dddb08e6 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -2024,7 +2024,7 @@ static int SaveWAV(Wave wave, const char *fileName) fwrite(&waveFormat, sizeof(WaveFormat), 1, wavFile); fwrite(&waveData, sizeof(WaveData), 1, wavFile); - success = fwrite(wave.data, dataSize, 1, wavFile); + success = (int)fwrite(wave.data, dataSize, 1, wavFile); fclose(wavFile); } diff --git a/src/rlgl.h b/src/rlgl.h index c2473ee9..acf2270d 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -1577,10 +1577,10 @@ void rlglInit(int width, int height) glGetIntegerv(GL_NUM_EXTENSIONS, &numExt); // Allocate numExt strings pointers - const char **extList = RL_MALLOC(sizeof(const char *)*numExt); + char **extList = RL_MALLOC(sizeof(char *)*numExt); // Get extensions strings - for (int i = 0; i < numExt; i++) extList[i] = (const char *)glGetStringi(GL_EXTENSIONS, i); + for (int i = 0; i < numExt; i++) extList[i] = (char *)glGetStringi(GL_EXTENSIONS, i); #elif defined(GRAPHICS_API_OPENGL_ES2) // Allocate 512 strings pointers (2 KB) diff --git a/src/shapes.c b/src/shapes.c index 6b0a7f21..66e0f55c 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -223,13 +223,13 @@ void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle { // Calculate the maximum angle between segments based on the error rate (usually 0.5f) float th = acosf(2*powf(1 - SMOOTH_CIRCLE_ERROR_RATE/radius, 2) - 1); - segments = (endAngle - startAngle)*ceilf(2*PI/th)/360; + segments = (int)((endAngle - startAngle)*ceilf(2*PI/th)/360); if (segments <= 0) segments = 4; } float stepLength = (float)(endAngle - startAngle)/(float)segments; - float angle = startAngle; + float angle = (float)startAngle; #if defined(SUPPORT_QUADS_DRAW_MODE) if (rlCheckBufferLimit(4*segments/2)) rlglDraw(); @@ -312,13 +312,13 @@ void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, int end { // Calculate the maximum angle between segments based on the error rate (usually 0.5f) float th = acosf(2*powf(1 - SMOOTH_CIRCLE_ERROR_RATE/radius, 2) - 1); - segments = (endAngle - startAngle)*ceilf(2*PI/th)/360; + segments = (int)((endAngle - startAngle)*ceilf(2*PI/th)/360); if (segments <= 0) segments = 4; } float stepLength = (float)(endAngle - startAngle)/(float)segments; - float angle = startAngle; + float angle = (float)startAngle; // Hide the cap lines when the circle is full bool showCapLines = true; @@ -364,11 +364,11 @@ void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Co for (int i = 0; i < 360; i += 10) { rlColor4ub(color1.r, color1.g, color1.b, color1.a); - rlVertex2f(centerX, centerY); + rlVertex2f((float)centerX, (float)centerY); rlColor4ub(color2.r, color2.g, color2.b, color2.a); - rlVertex2f(centerX + sinf(DEG2RAD*i)*radius, centerY + cosf(DEG2RAD*i)*radius); + rlVertex2f((float)centerX + sinf(DEG2RAD*i)*radius, (float)centerY + cosf(DEG2RAD*i)*radius); rlColor4ub(color2.r, color2.g, color2.b, color2.a); - rlVertex2f(centerX + sinf(DEG2RAD*(i + 10))*radius, centerY + cosf(DEG2RAD*(i + 10))*radius); + rlVertex2f((float)centerX + sinf(DEG2RAD*(i + 10))*radius, (float)centerY + cosf(DEG2RAD*(i + 10))*radius); } rlEnd(); } @@ -406,9 +406,9 @@ void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color c for (int i = 0; i < 360; i += 10) { rlColor4ub(color.r, color.g, color.b, color.a); - rlVertex2f(centerX, centerY); - rlVertex2f(centerX + sinf(DEG2RAD*i)*radiusH, centerY + cosf(DEG2RAD*i)*radiusV); - rlVertex2f(centerX + sinf(DEG2RAD*(i + 10))*radiusH, centerY + cosf(DEG2RAD*(i + 10))*radiusV); + rlVertex2f((float)centerX, (float)centerY); + rlVertex2f((float)centerX + sinf(DEG2RAD*i)*radiusH, (float)centerY + cosf(DEG2RAD*i)*radiusV); + rlVertex2f((float)centerX + sinf(DEG2RAD*(i + 10))*radiusH, (float)centerY + cosf(DEG2RAD*(i + 10))*radiusV); } rlEnd(); } @@ -455,7 +455,7 @@ void DrawRing(Vector2 center, float innerRadius, float outerRadius, int startAng { // Calculate the maximum angle between segments based on the error rate (usually 0.5f) float th = acosf(2*powf(1 - SMOOTH_CIRCLE_ERROR_RATE/outerRadius, 2) - 1); - segments = (endAngle - startAngle)*ceilf(2*PI/th)/360; + segments = (int)((endAngle - startAngle)*ceilf(2*PI/th)/360); if (segments <= 0) segments = 4; } @@ -468,7 +468,7 @@ void DrawRing(Vector2 center, float innerRadius, float outerRadius, int startAng } float stepLength = (float)(endAngle - startAngle)/(float)segments; - float angle = startAngle; + float angle = (float)startAngle; #if defined(SUPPORT_QUADS_DRAW_MODE) if (rlCheckBufferLimit(4*segments)) rlglDraw(); @@ -546,7 +546,7 @@ void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, int sta { // Calculate the maximum angle between segments based on the error rate (usually 0.5f) float th = acosf(2*powf(1 - SMOOTH_CIRCLE_ERROR_RATE/outerRadius, 2) - 1); - segments = (endAngle - startAngle)*ceilf(2*PI/th)/360; + segments = (int)((endAngle - startAngle)*ceilf(2*PI/th)/360); if (segments <= 0) segments = 4; } @@ -558,7 +558,7 @@ void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, int sta } float stepLength = (float)(endAngle - startAngle)/(float)segments; - float angle = startAngle; + float angle = (float)startAngle; bool showCapLines = true; int limit = 4*(segments + 1); @@ -755,7 +755,7 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co { // Calculate the maximum angle between segments based on the error rate (usually 0.5f) float th = acosf(2*powf(1 - SMOOTH_CIRCLE_ERROR_RATE/radius, 2) - 1); - segments = ceilf(2*PI/th)/4; + segments = (int)(ceilf(2*PI/th)/4.0f); if (segments <= 0) segments = 4; } @@ -975,7 +975,7 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int { // Calculate the maximum angle between segments based on the error rate (usually 0.5f) float th = acosf(2*powf(1 - SMOOTH_CIRCLE_ERROR_RATE/radius, 2) - 1); - segments = ceilf(2*PI/th)/2; + segments = (int)(ceilf(2*PI/th)/2.0f); if (segments <= 0) segments = 4; } diff --git a/src/text.c b/src/text.c index 1bd8a0f8..78c734d8 100644 --- a/src/text.c +++ b/src/text.c @@ -957,7 +957,7 @@ void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, f bool isGlyphSelected = false; if ((selectStart >= 0) && (k >= selectStart) && (k < (selectStart + selectLength))) { - DrawRectangleRec((Rectangle){ rec.x + textOffsetX - 1, rec.y + textOffsetY, glyphWidth, (int)((float)font.baseSize*scaleFactor) }, selectBackTint); + DrawRectangleRec((Rectangle){ rec.x + textOffsetX - 1, rec.y + textOffsetY, (float)glyphWidth, (float)font.baseSize*scaleFactor }, selectBackTint); isGlyphSelected = true; } @@ -1229,7 +1229,7 @@ char *TextReplace(char *text, const char *replace, const char *by) while (count--) { insertPoint = strstr(text, replace); - lastReplacePos = insertPoint - text; + lastReplacePos = (int)(insertPoint - text); temp = strncpy(temp, text, lastReplacePos) + lastReplacePos; temp = strcpy(temp, by) + byLen; text += lastReplacePos + replaceLen; // Move to next "end of replace" @@ -1346,7 +1346,7 @@ int TextFindIndex(const char *text, const char *find) char *ptr = strstr(text, find); - if (ptr != NULL) position = ptr - text; + if (ptr != NULL) position = (int)(ptr - text); return position; } diff --git a/src/textures.c b/src/textures.c index 7df3a258..724dd5c3 100644 --- a/src/textures.c +++ b/src/textures.c @@ -689,7 +689,7 @@ Rectangle GetImageAlphaBorder(Image image, float threshold) // Check for empty blank image if ((xMin != 65536) && (xMax != 65536)) { - crop = (Rectangle){ xMin, yMin, (xMax + 1) - xMin, (yMax + 1) - yMin }; + crop = (Rectangle){ (float)xMin, (float)yMin, (float)((xMax + 1) - xMin), (float)((yMax + 1) - yMin) }; } RL_FREE(pixels); @@ -1273,12 +1273,12 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType) Image faces = { 0 }; // Vertical column image Rectangle faceRecs[6] = { 0 }; // Face source rectangles - for (int i = 0; i < 6; i++) faceRecs[i] = (Rectangle){ 0, 0, size, size }; + for (int i = 0; i < 6; i++) faceRecs[i] = (Rectangle){ 0, 0, (float)size, (float)size }; if (layoutType == CUBEMAP_LINE_VERTICAL) { faces = image; - for (int i = 0; i < 6; i++) faceRecs[i].y = size*i; + for (int i = 0; i < 6; i++) faceRecs[i].y = (float)size*i; } else if (layoutType == CUBEMAP_PANORAMA) { @@ -1287,24 +1287,24 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType) } else { - if (layoutType == CUBEMAP_LINE_HORIZONTAL) for (int i = 0; i < 6; i++) faceRecs[i].x = size*i; + if (layoutType == CUBEMAP_LINE_HORIZONTAL) for (int i = 0; i < 6; i++) faceRecs[i].x = (float)size*i; else if (layoutType == CUBEMAP_CROSS_THREE_BY_FOUR) { - faceRecs[0].x = size; faceRecs[0].y = size; - faceRecs[1].x = size; faceRecs[1].y = 3*size; - faceRecs[2].x = size; faceRecs[2].y = 0; - faceRecs[3].x = size; faceRecs[3].y = 2*size; - faceRecs[4].x = 0; faceRecs[4].y = size; - faceRecs[5].x = 2*size; faceRecs[5].y = size; + faceRecs[0].x = (float)size; faceRecs[0].y = (float)size; + faceRecs[1].x = (float)size; faceRecs[1].y = (float)size*3; + faceRecs[2].x = (float)size; faceRecs[2].y = 0; + faceRecs[3].x = (float)size; faceRecs[3].y = (float)size*2; + faceRecs[4].x = 0; faceRecs[4].y = (float)size; + faceRecs[5].x = (float)size*2; faceRecs[5].y = (float)size; } else if (layoutType == CUBEMAP_CROSS_FOUR_BY_THREE) { - faceRecs[0].x = 2*size; faceRecs[0].y = size; - faceRecs[1].x = 0; faceRecs[1].y = size; - faceRecs[2].x = size; faceRecs[2].y = 0; - faceRecs[3].x = size; faceRecs[3].y = 2*size; - faceRecs[4].x = size; faceRecs[4].y = size; - faceRecs[5].x = 3*size; faceRecs[5].y = size; + faceRecs[0].x = (float)size*2; faceRecs[0].y = (float)size; + faceRecs[1].x = 0; faceRecs[1].y = (float)size; + faceRecs[2].x = (float)size; faceRecs[2].y = 0; + faceRecs[3].x = (float)size; faceRecs[3].y = (float)size*2; + faceRecs[4].x = (float)size; faceRecs[4].y = (float)size; + faceRecs[5].x = (float)size*3; faceRecs[5].y = (float)size; } // Convert image data to 6 faces in a vertical column, that's the optimum layout for loading @@ -1314,7 +1314,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType) // TODO: Image formating does not work with compressed textures! } - for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, size*i, size, size }, WHITE); + for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE); cubemap.id = rlLoadTextureCubemap(faces.data, size, faces.format); if (cubemap.id == 0) TRACELOG(LOG_WARNING, "IMAGE: Failed to load cubemap image"); @@ -1396,7 +1396,7 @@ void ImageAlphaCrop(Image *image, float threshold) } } - Rectangle crop = { xMin, yMin, (xMax + 1) - xMin, (yMax + 1) - yMin }; + Rectangle crop = { (float)xMin, (float)yMin, (float)((xMax + 1) - xMin), (float)((yMax + 1) - yMin) }; RL_FREE(pixels); @@ -1479,23 +1479,23 @@ void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, i // Support offsets out of canvas new size -> original image is cropped if (offsetX < 0) { - ImageCrop(image, (Rectangle) { -offsetX, 0, image->width + offsetX, image->height }); + ImageCrop(image, (Rectangle) { -(float)offsetX, 0, (float)(image->width + offsetX), (float)image->height }); offsetX = 0; } else if (offsetX > (newWidth - image->width)) { - ImageCrop(image, (Rectangle) { 0, 0, image->width - (offsetX - (newWidth - image->width)), image->height }); + ImageCrop(image, (Rectangle) { 0, 0, (float)(image->width - (offsetX - (newWidth - image->width))), (float)image->height }); offsetX = newWidth - image->width; } if (offsetY < 0) { - ImageCrop(image, (Rectangle) { 0, -offsetY, image->width, image->height + offsetY }); + ImageCrop(image, (Rectangle) { 0, -(float)offsetY, (float)image->width, (float)(image->height + offsetY) }); offsetY = 0; } else if (offsetY > (newHeight - image->height)) { - ImageCrop(image, (Rectangle) { 0, 0, image->width, image->height - (offsetY - (newHeight - image->height)) }); + ImageCrop(image, (Rectangle) { 0, 0, (float)image->width, (float)(image->height - (offsetY - (newHeight - image->height))) }); offsetY = newHeight - image->height; } @@ -1525,15 +1525,15 @@ void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, i if (newWidth < image->width) { - srcRec.x = offsetX; - srcRec.width = newWidth; + srcRec.x = (float)offsetX; + srcRec.width = (float)newWidth; dstRec.x = 0.0f; } if (newHeight < image->height) { - srcRec.y = offsetY; - srcRec.height = newHeight; + srcRec.y = (float)offsetY; + srcRec.height = (float)newHeight; dstRec.y = 0.0f; } @@ -1913,7 +1913,7 @@ Image ImageText(const char *text, int fontSize, Color color) // Create an image from text (custom sprite font) Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint) { - int length = strlen(text); + int length = (int)strlen(text); int textOffsetX = 0; // Image drawing position X int textOffsetY = 0; // Offset between lines (on line break '\n') @@ -1940,14 +1940,14 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co // NOTE: Fixed line spacing of 1.5 line-height // TODO: Support custom line spacing defined by user textOffsetY += (font.baseSize + font.baseSize/2); - textOffsetX = 0.0f; + textOffsetX = 0; } else { if ((codepoint != ' ') && (codepoint != '\t')) { - Rectangle rec = { textOffsetX + font.chars[index].offsetX, textOffsetY + font.chars[index].offsetY, font.recs[index].width, font.recs[index].height }; - ImageDraw(&imText, font.chars[index].image, (Rectangle){ 0, 0, font.chars[index].image.width, font.chars[index].image.height }, rec, tint); + Rectangle rec = { (float)(textOffsetX + font.chars[index].offsetX), (float)(textOffsetY + font.chars[index].offsetY), (float)font.recs[index].width, (float)font.recs[index].height }; + ImageDraw(&imText, font.chars[index].image, (Rectangle){ 0, 0, (float)font.chars[index].image.width, (float)font.chars[index].image.height }, rec, tint); } if (font.chars[index].advanceX == 0) textOffsetX += (int)(font.recs[index].width + spacing); @@ -1974,13 +1974,13 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co // Draw rectangle within an image void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color) { - ImageDrawRectangleRec(dst, (Rectangle){ posX, posY, width, height }, color); + ImageDrawRectangleRec(dst, (Rectangle){ (float)posX, (float)posY, (float)width, (float)height }, color); } // Draw rectangle within an image (Vector version) void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color) { - ImageDrawRectangle(dst, position.x, position.y, size.x, size.y, color); + ImageDrawRectangle(dst, (int)position.x, (int)position.y, (int)size.x, (int)size.y, color); } // Draw rectangle within an image @@ -1997,10 +1997,10 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color) // Draw rectangle lines within an image void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color) { - ImageDrawRectangle(dst, rec.x, rec.y, rec.width, thick, color); - ImageDrawRectangle(dst, rec.x, rec.y + thick, thick, rec.height - thick*2, color); - ImageDrawRectangle(dst, rec.x + rec.width - thick, rec.y + thick, thick, rec.height - thick*2, color); - ImageDrawRectangle(dst, rec.x, rec.y + rec.height - thick, rec.width, thick, color); + ImageDrawRectangle(dst, (int)rec.x, (int)rec.y, (int)rec.width, thick, color); + ImageDrawRectangle(dst, (int)rec.x, (int)(rec.y + thick), thick, (int)(rec.height - thick*2), color); + ImageDrawRectangle(dst, (int)(rec.x + rec.width - thick), (int)(rec.y + thick), thick, (int)(rec.height - thick*2), color); + ImageDrawRectangle(dst, (int)rec.x, (int)(rec.y + rec.height - thick), (int)rec.width, thick, color); } // Clear image background with given color @@ -2338,10 +2338,10 @@ void ImageColorTint(Image *image, Color color) for (int x = 0; x < image->width; x++) { int index = y * image->width + x; - unsigned char r = 255*((float)pixels[index].r/255*cR); - unsigned char g = 255*((float)pixels[index].g/255*cG); - unsigned char b = 255*((float)pixels[index].b/255*cB); - unsigned char a = 255*((float)pixels[index].a/255*cA); + unsigned char r = (unsigned char)(((float)pixels[index].r/255*cR)*255.0f); + unsigned char g = (unsigned char)(((float)pixels[index].g/255*cG)*255.0f); + unsigned char b = (unsigned char)(((float)pixels[index].b/255*cB)*255.0f); + unsigned char a = (unsigned char)(((float)pixels[index].a/255*cA)*255.0f); pixels[y*image->width + x].r = r; pixels[y*image->width + x].g = g; @@ -3614,7 +3614,7 @@ static int SaveKTX(Image image, const char *fileName) if (ktxHeader.glFormat == -1) TRACELOG(LOG_WARNING, "IMAGE: GL format not supported for KTX export (%i)", ktxHeader.glFormat); else { - success = fwrite(&ktxHeader, sizeof(KTXHeader), 1, ktxFile); + success = (int)fwrite(&ktxHeader, sizeof(KTXHeader), 1, ktxFile); int width = image.width; int height = image.height; @@ -3624,8 +3624,8 @@ static int SaveKTX(Image image, const char *fileName) for (int i = 0; i < image.mipmaps; i++) { unsigned int dataSize = GetPixelDataSize(width, height, image.format); - success = fwrite(&dataSize, sizeof(unsigned int), 1, ktxFile); - success = fwrite((unsigned char *)image.data + dataOffset, dataSize, 1, ktxFile); + success = (int)fwrite(&dataSize, sizeof(unsigned int), 1, ktxFile); + success = (int)fwrite((unsigned char *)image.data + dataOffset, dataSize, 1, ktxFile); width /= 2; height /= 2; diff --git a/src/utils.c b/src/utils.c index 9f4b2ded..c64144a6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -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