From fd15330c03dd254cd2a5cb537ebd3f462fe901e3 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 4 Jan 2025 05:33:40 +0300
Subject: [PATCH] sync with latest SDL2
---
include/SDL2/SDL_hints.h | 2 +-
src/test/SDL_test_fuzzer.c | 15 +++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/include/SDL2/SDL_hints.h b/include/SDL2/SDL_hints.h
index 6d66709..4e37063 100644
--- a/include/SDL2/SDL_hints.h
+++ b/include/SDL2/SDL_hints.h
@@ -2283,7 +2283,7 @@ extern "C" {
/**
* A variable controlling whether the libdecor Wayland backend is preferred
- * over native decrations.
+ * over native decorations.
*
* When this hint is set, libdecor will be used to provide window decorations,
* even if xdg-decoration is available. (Note that, by default, libdecor will
diff --git a/src/test/SDL_test_fuzzer.c b/src/test/SDL_test_fuzzer.c
index 45468f3..ee58b28 100644
--- a/src/test/SDL_test_fuzzer.c
+++ b/src/test/SDL_test_fuzzer.c
@@ -153,10 +153,10 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
{
Sint64 min = pMin;
Sint64 max = pMax;
- Sint64 temp;
- Sint64 number;
+ Uint64 range;
if (pMin > pMax) {
+ Sint32 temp;
temp = min;
min = max;
max = temp;
@@ -164,10 +164,13 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
return (Sint32)min;
}
- number = SDLTest_RandomUint32();
- /* invocation count increment in preceeding call */
-
- return (Sint32)((number % ((max + 1) - min)) + min);
+ range = (Sint64)max - (Sint64)min;
+ if (range < SDL_MAX_SINT32) {
+ return min + (Sint32) (SDLTest_RandomUint32() % (range + 1));
+ } else {
+ Uint64 add = SDLTest_RandomUint32() | SDLTest_RandomUint32();
+ return (Sint32) (min + (Sint64) (add % (range + 1)));
+ }
}
/* !