diff --git a/src/rcore.c b/src/rcore.c index ece265144..932b9ee49 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -2050,8 +2050,8 @@ void EndDrawing(void) // Get image data for the current frame (from backbuffer) // NOTE: This process is quite slow... :( Vector2 scale = GetWindowScaleDPI(); - unsigned char *screenData = rlReadScreenPixels(CORE.Window.render.width*scale.x, CORE.Window.render.height*scale.y); - msf_gif_frame(&gifState, screenData, 10, 16, CORE.Window.render.width*scale.x*4); + unsigned char *screenData = rlReadScreenPixels((int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y)); + msf_gif_frame(&gifState, screenData, 10, 16, (int)((float)CORE.Window.render.width*scale.x)*4); RL_FREE(screenData); // Free image data } @@ -2774,8 +2774,8 @@ void TakeScreenshot(const char *fileName) { #if defined(SUPPORT_MODULE_RTEXTURES) Vector2 scale = GetWindowScaleDPI(); - unsigned char *imgData = rlReadScreenPixels(CORE.Window.render.width*scale.x, CORE.Window.render.height*scale.y); - Image image = { imgData, CORE.Window.render.width*scale.x, CORE.Window.render.height*scale.y, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 }; + unsigned char *imgData = rlReadScreenPixels((int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y)); + Image image = { imgData, (int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y), 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 }; char path[2048] = { 0 }; strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, fileName)); @@ -4842,7 +4842,7 @@ void WaitTime(double seconds) // System halt functions #if defined(_WIN32) - Sleep((unsigned int)sleepSeconds*1000.0); + Sleep((unsigned long)(sleepSeconds*1000.0)); #endif #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__) struct timespec req = { 0 }; @@ -5282,7 +5282,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i gifFrameCounter = 0; Vector2 scale = GetWindowScaleDPI(); - msf_gif_begin(&gifState, CORE.Window.render.width*scale.x, CORE.Window.render.height*scale.y); + msf_gif_begin(&gifState, (int)((float)CORE.Window.render.width*scale.x), (int)((float)CORE.Window.render.height*scale.y)); screenshotCounter++; TRACELOG(LOG_INFO, "SYSTEM: Start animated GIF recording: %s", TextFormat("screenrec%03i.gif", screenshotCounter)); diff --git a/src/rmodels.c b/src/rmodels.c index 97fa3908f..af7e0cd76 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -4844,7 +4844,7 @@ static Model LoadGLTF(const char *fileName) LOAD_ATTRIBUTE(attribute, 4, unsigned short, temp); // Convert data to raylib color data type (4 bytes) - for (int c = 0; c < attribute->count*4; c++) model.meshes[meshIndex].colors[c] = (unsigned char)(((float)temp[c]/65535.0f)*255.0f); + for (unsigned int c = 0; c < attribute->count*4; c++) model.meshes[meshIndex].colors[c] = (unsigned char)(((float)temp[c]/65535.0f)*255.0f); RL_FREE(temp); } @@ -4858,7 +4858,7 @@ static Model LoadGLTF(const char *fileName) LOAD_ATTRIBUTE(attribute, 4, float, temp); // Convert data to raylib color data type (4 bytes), we expect the color data normalized - for (int c = 0; c < attribute->count*4; c++) model.meshes[meshIndex].colors[c] = (unsigned char)(temp[c]*255.0f); + for (unsigned int c = 0; c < attribute->count*4; c++) model.meshes[meshIndex].colors[c] = (unsigned char)(temp[c]*255.0f); RL_FREE(temp); } @@ -4893,7 +4893,7 @@ static Model LoadGLTF(const char *fileName) LOAD_ATTRIBUTE(attribute, 1, unsigned int, temp); // Convert data to raylib indices data type (unsigned short) - for (int d = 0; d < attribute->count; d++) model.meshes[meshIndex].indices[d] = (unsigned short)temp[d]; + for (unsigned int d = 0; d < attribute->count; d++) model.meshes[meshIndex].indices[d] = (unsigned short)temp[d]; TRACELOG(LOG_WARNING, "MODEL: [%s] Indices data converted from u32 to u16, possible loss of data", fileName); @@ -4905,7 +4905,7 @@ static Model LoadGLTF(const char *fileName) // Assign to the primitive mesh the corresponding material index // NOTE: If no material defined, mesh uses the already assigned default material (index: 0) - for (int m = 0; m < data->materials_count; m++) + for (unsigned int m = 0; m < data->materials_count; m++) { // The primitive actually keeps the pointer to the corresponding material, // raylib instead assigns to the mesh the by its index, as loaded in model.materials array diff --git a/src/utils.c b/src/utils.c index 5a438beec..b922c8907 100644 --- a/src/utils.c +++ b/src/utils.c @@ -300,7 +300,7 @@ bool ExportDataAsCode(const char *data, unsigned int size, const char *fileName) for (int i = 0; varFileName[i] != '\0'; i++) if ((varFileName[i] >= 'a') && (varFileName[i] <= 'z')) { varFileName[i] = varFileName[i] - 32; } byteCount += sprintf(txtData + byteCount, "static unsigned char %s_DATA[%i] = { ", varFileName, size); - for (int i = 0; i < size - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), data[i]); + for (unsigned int i = 0; i < size - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), data[i]); byteCount += sprintf(txtData + byteCount, "0x%x };\n", data[size - 1]); // NOTE: Text data size exported is determined by '\0' (NULL) character