From 38a5aed97422f3cdc5fbbf1fa0ef406477af391b Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 28 Jul 2023 23:55:50 +0300
Subject: [PATCH] minor os/2 stuff merged from the bitwiseworks' fork
---
cmake/sdlplatform.cmake | 2 ++
configure | 2 +-
configure.ac | 2 +-
src/joystick/os2/SDL_os2joystick.c | 8 ++++++--
test/CMakeLists.txt | 2 ++
5 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/cmake/sdlplatform.cmake b/cmake/sdlplatform.cmake
index f55ad313b309..7daaa2352eb6 100644
--- a/cmake/sdlplatform.cmake
+++ b/cmake/sdlplatform.cmake
@@ -48,6 +48,8 @@ macro(SDL_DetectCMakePlatform)
set(SDL_CMAKE_PLATFORM HAIKU)
elseif(NINTENDO_3DS)
set(SDL_CMAKE_PLATFORM N3DS)
+ elseif(OS2)
+ set(SDL_CMAKE_PLATFORM OS2)
endif()
if(SDL_CMAKE_PLATFORM)
set(${SDL_CMAKE_PLATFORM} TRUE)
diff --git a/configure b/configure
index 6d4816b67d40..8407ad311d0e 100755
--- a/configure
+++ b/configure
@@ -28247,7 +28247,7 @@ fi
enable_hidapi_libusb=yes
require_hidapi_libusb=yes
;;
- *-*-os2* )
+ *-*-os2* )
enable_hidapi_libusb=yes
;;
esac
diff --git a/configure.ac b/configure.ac
index 3ca348000f40..374ddb41d25d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3614,7 +3614,7 @@ CheckHIDAPI()
enable_hidapi_libusb=yes
require_hidapi_libusb=yes
;;
- *-*-os2* )
+ *-*-os2* )
enable_hidapi_libusb=yes
;;
esac
diff --git a/src/joystick/os2/SDL_os2joystick.c b/src/joystick/os2/SDL_os2joystick.c
index d7939971217b..7f72b625e0ab 100644
--- a/src/joystick/os2/SDL_os2joystick.c
+++ b/src/joystick/os2/SDL_os2joystick.c
@@ -702,10 +702,14 @@ static int joyGetEnv(struct _joycfg * joydata)
char tempnumber[5]; /* Temporary place to put numeric texts */
joyenv = SDL_getenv("SDL_OS2_JOYSTICK");
- if (joyenv == NULL) return 0;
+ if (joyenv == NULL) {
+ return 0;
+ }
/* Joystick Environment is defined! */
- while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */
+ while (*joyenv == ' ' && *joyenv != 0) {
+ joyenv++; /* jump spaces... */
+ }
/* If the string name starts with '... get if fully */
if (*joyenv == '\'') {
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 778cb79d594d..a7099e16c08a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -160,6 +160,8 @@ elseif(WINDOWS)
elseif(HAVE_X11)
add_sdl_test_executable(testnative NEEDS_RESOURCES testnative.c testnativex11.c testutils.c)
target_link_libraries(testnative X11)
+elseif(OS2)
+ add_sdl_test_executable(testnative NEEDS_RESOURCES testnative.c testnativeos2.c testutils.c)
endif()
add_sdl_test_executable(testoverlay2 NEEDS_RESOURCES testoverlay2.c testyuv_cvt.c testutils.c)