From b065882f24dcffdd06492e1a9b11e1a9168846e5 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 10 Sep 2020 17:42:18 +0100 Subject: [PATCH] More size_t --- src/Backends/Misc.h | 5 +++-- src/Backends/Platform/GLFW3.cpp | 12 ++++++------ src/Backends/Platform/Null.cpp | 4 ++-- src/Backends/Platform/SDL2.cpp | 4 ++-- src/Backends/Platform/WiiU.cpp | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Backends/Misc.h b/src/Backends/Misc.h index a4cfd293..f12db458 100644 --- a/src/Backends/Misc.h +++ b/src/Backends/Misc.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include "../Attributes.h" @@ -90,8 +91,8 @@ void Backend_Deinit(void); void Backend_PostWindowCreation(void); bool Backend_GetBasePath(std::string *string_buffer); void Backend_HideMouse(void); -void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height); -void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height); +void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height); +void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height); void PlaybackBackend_EnableDragAndDrop(void); bool Backend_SystemTask(bool active); void Backend_GetKeyboardState(bool *keyboard_state); diff --git a/src/Backends/Platform/GLFW3.cpp b/src/Backends/Platform/GLFW3.cpp index 54101567..0583e4ef 100644 --- a/src/Backends/Platform/GLFW3.cpp +++ b/src/Backends/Platform/GLFW3.cpp @@ -201,7 +201,7 @@ void Backend_HideMouse(void) glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); } -void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height) { // Convert to RGBA, since that's the only thing GLFW3 accepts unsigned char *rgba_pixels = (unsigned char*)malloc(width * height * 4); @@ -211,9 +211,9 @@ void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, if (rgba_pixels != NULL) { - for (unsigned int y = 0; y < height; ++y) + for (size_t y = 0; y < height; ++y) { - for (unsigned int x = 0; x < width; ++x) + for (size_t x = 0; x < width; ++x) { *rgba_pointer++ = *rgb_pointer++; *rgba_pointer++ = *rgb_pointer++; @@ -229,7 +229,7 @@ void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, } } -void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height) { // Convert to RGBA, since that's the only thing GLFW3 accepts unsigned char *rgba_pixels = (unsigned char*)malloc(width * height * 4); @@ -239,9 +239,9 @@ void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsi if (rgba_pixels != NULL) { - for (unsigned int y = 0; y < height; ++y) + for (size_t y = 0; y < height; ++y) { - for (unsigned int x = 0; x < width; ++x) + for (size_t x = 0; x < width; ++x) { if (rgb_pointer[0] == 0xFF && rgb_pointer[1] == 0 && rgb_pointer[2] == 0xFF) // Colour-key { diff --git a/src/Backends/Platform/Null.cpp b/src/Backends/Platform/Null.cpp index 9c3c6032..73995fa3 100644 --- a/src/Backends/Platform/Null.cpp +++ b/src/Backends/Platform/Null.cpp @@ -34,14 +34,14 @@ void Backend_HideMouse(void) } -void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height) { (void)rgb_pixels; (void)width; (void)height; } -void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height) { (void)rgb_pixels; (void)width; diff --git a/src/Backends/Platform/SDL2.cpp b/src/Backends/Platform/SDL2.cpp index 948f9101..c9a2a67f 100644 --- a/src/Backends/Platform/SDL2.cpp +++ b/src/Backends/Platform/SDL2.cpp @@ -119,7 +119,7 @@ void Backend_HideMouse(void) SDL_ShowCursor(SDL_DISABLE); } -void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height) { SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom((void*)rgb_pixels, width, height, 0, width * 3, SDL_PIXELFORMAT_RGB24); @@ -134,7 +134,7 @@ void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, } } -void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height) { cursor_surface_pixels = (unsigned char*)malloc(width * height * 3); diff --git a/src/Backends/Platform/WiiU.cpp b/src/Backends/Platform/WiiU.cpp index 15ca7e24..86b43c2c 100644 --- a/src/Backends/Platform/WiiU.cpp +++ b/src/Backends/Platform/WiiU.cpp @@ -76,14 +76,14 @@ void Backend_HideMouse(void) } -void Backend_SetWindowIcon(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetWindowIcon(const unsigned char *rgb_pixels, size_t width, size_t height) { (void)rgb_pixels; (void)width; (void)height; } -void Backend_SetCursor(const unsigned char *rgb_pixels, unsigned int width, unsigned int height) +void Backend_SetCursor(const unsigned char *rgb_pixels, size_t width, size_t height) { (void)rgb_pixels; (void)width;