shithub: cstory

Download patch

ref: b065882f24dcffdd06492e1a9b11e1a9168846e5
parent: 988f1128dd96f06c57da106175ccec158160f81d
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Sep 10 13:42:18 EDT 2020

More size_t

--- a/src/Backends/Misc.h
+++ b/src/Backends/Misc.h
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <stddef.h>
 #include <string>
 
 #include "../Attributes.h"
@@ -90,8 +91,8 @@
 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);
--- a/src/Backends/Platform/GLFW3.cpp
+++ b/src/Backends/Platform/GLFW3.cpp
@@ -201,7 +201,7 @@
 	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 @@
 
 	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_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 @@
 
 	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
 				{
--- a/src/Backends/Platform/Null.cpp
+++ b/src/Backends/Platform/Null.cpp
@@ -34,7 +34,7 @@
 	
 }
 
-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;
@@ -41,7 +41,7 @@
 	(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;
--- a/src/Backends/Platform/SDL2.cpp
+++ b/src/Backends/Platform/SDL2.cpp
@@ -119,7 +119,7 @@
 	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_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);
 
--- a/src/Backends/Platform/WiiU.cpp
+++ b/src/Backends/Platform/WiiU.cpp
@@ -76,7 +76,7 @@
 	
 }
 
-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;
@@ -83,7 +83,7 @@
 	(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;