diff --git a/src/sdl/IMG_xpm.c b/src/sdl/IMG_xpm.c
index 43fb4ded235ee33ac961870dcc18a7aa104a9db0..458131620e16cc1ff543739323d24bd611340619 100644
--- a/src/sdl/IMG_xpm.c
+++ b/src/sdl/IMG_xpm.c
@@ -1012,7 +1012,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
     size_t index;
     int x, y;
     int w, h, cpp;
-    size_t ncolors;
+    long unsigned int ncolors;
     size_t indexed;
     Uint8 *dst;
     struct color_hash *colors = NULL;