mirror of
https://github.com/encounter/SDL.git
synced 2025-12-14 15:46:14 +00:00
Fix format string warnings for width-based integers
The DJGPP compiler emits many warnings for conflicts between print format specifiers and argument types. To fix the warnings, I added `SDL_PRIx32` macros for use with `Sint32` and `Uint32` types. The macros alias those found in <inttypes.h> or fallback to a reasonable default. As an alternative, print arguments could be cast to plain old integers. I opted slightly for the current solution as it felt more technically correct, despite making the format strings more verbose.
This commit is contained in:
committed by
Sam Lantinga
parent
5427f4861b
commit
f443a6fc7a
@@ -306,7 +306,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
|
||||
}
|
||||
}
|
||||
if (biWidth <= 0 || biHeight == 0) {
|
||||
SDL_SetError("BMP file with bad dimensions (%dx%d)", biWidth, biHeight);
|
||||
SDL_SetError("BMP file with bad dimensions (%" SDL_PRIs32 "x%" SDL_PRIs32 ")", biWidth, biHeight);
|
||||
was_error = SDL_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect
|
||||
/* Send the data to the display */
|
||||
if (SDL_getenv("SDL_VIDEO_DUMMY_SAVE_FRAMES")) {
|
||||
char file[128];
|
||||
SDL_snprintf(file, sizeof(file), "SDL_window%d-%8.8d.bmp",
|
||||
SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIu32 "-%8.8d.bmp",
|
||||
SDL_GetWindowID(window), ++frame_number);
|
||||
SDL_SaveBMP(surface, file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user