OS/2 fixes: SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Sat, 24 Mar 2018 22:25:33 +0300
branchSDL-1.2
changeset 119646c37a15030e7
parent 11963 bed18a4357e5
child 11965 afbe1aac2dd1
OS/2 fixes:

- update SDL_platform.h to handle __EMX__
- update SDL_config_os2.h
- fix a typo in SDL_dart.c (bitwise AND, not logical AND)
- fix NULL / NULLHANDLE confusion in SDL_sysloadso.c and SDL_os2fslib.c
include/SDL_config_os2.h
include/SDL_platform.h
src/audio/dart/SDL_dart.c
src/loadso/os2/SDL_sysloadso.c
src/video/os2fslib/SDL_os2fslib.c
     1.1 --- a/include/SDL_config_os2.h	Sat Mar 24 22:21:15 2018 +0300
     1.2 +++ b/include/SDL_config_os2.h	Sat Mar 24 22:25:33 2018 +0300
     1.3 @@ -27,17 +27,6 @@
     1.4  
     1.5  /* This is a set of defines to configure the SDL features */
     1.6  
     1.7 -typedef signed char         int8_t;
     1.8 -typedef unsigned char       uint8_t;
     1.9 -typedef signed short        int16_t;
    1.10 -typedef unsigned short      uint16_t;
    1.11 -typedef signed int          int32_t;
    1.12 -typedef unsigned int        uint32_t;
    1.13 -typedef unsigned int        size_t;
    1.14 -typedef unsigned long       uintptr_t;
    1.15 -typedef signed long long    int64_t;
    1.16 -typedef unsigned long long  uint64_t;
    1.17 -
    1.18  #define SDL_HAS_64BIT_TYPE	1
    1.19  
    1.20  /* Use Watcom's LIBC */
    1.21 @@ -67,7 +56,6 @@
    1.22  #define HAVE_ALLOCA 1
    1.23  #define HAVE_GETENV 1
    1.24  #define HAVE_PUTENV 1
    1.25 -#define HAVE_UNSETENV 1
    1.26  #define HAVE_QSORT 1
    1.27  #define HAVE_ABS 1
    1.28  #define HAVE_BCOPY 1
    1.29 @@ -89,12 +77,13 @@
    1.30  #define HAVE_STRSTR 1
    1.31  #define HAVE_ITOA 1
    1.32  #define HAVE__LTOA 1
    1.33 -#define HAVE__UITOA 1
    1.34  #define HAVE__ULTOA 1
    1.35  #define HAVE_STRTOL 1
    1.36 +#define HAVE_STRTOUL 1
    1.37  #define HAVE__I64TOA 1
    1.38  #define HAVE__UI64TOA 1
    1.39  #define HAVE_STRTOLL 1
    1.40 +#define HAVE_STRTOULL 1
    1.41  #define HAVE_STRTOD 1
    1.42  #define HAVE_ATOI 1
    1.43  #define HAVE_ATOF 1
    1.44 @@ -102,11 +91,11 @@
    1.45  #define HAVE_STRNCMP 1
    1.46  #define HAVE_STRICMP 1
    1.47  #define HAVE_STRCASECMP 1
    1.48 +#define HAVE_STRNCASECMP 1
    1.49  #define HAVE_SSCANF 1
    1.50  #define HAVE_SNPRINTF 1
    1.51  #define HAVE_VSNPRINTF 1
    1.52  #define HAVE_SETJMP 1
    1.53 -#define HAVE_CLOCK_GETTIME 1
    1.54  
    1.55  /* Enable various audio drivers */
    1.56  #define SDL_AUDIO_DRIVER_DART	1
    1.57 @@ -133,7 +122,7 @@
    1.58  #define SDL_VIDEO_DRIVER_OS2FS	1
    1.59  
    1.60  /* Enable OpenGL support */
    1.61 -/* Nothing here yet for OS/2... :( */
    1.62 +/* Nothing yet for OS/2. */
    1.63  
    1.64  /* Enable assembly routines where available */
    1.65  #define SDL_ASSEMBLY_ROUTINES	1
     2.1 --- a/include/SDL_platform.h	Sat Mar 24 22:21:15 2018 +0300
     2.2 +++ b/include/SDL_platform.h	Sat Mar 24 22:25:33 2018 +0300
     2.3 @@ -82,7 +82,7 @@
     2.4  #undef __OPENBSD__
     2.5  #define __OPENBSD__	1
     2.6  #endif
     2.7 -#if defined(__OS2__)
     2.8 +#if defined(__OS2__) || defined(__EMX__)
     2.9  #undef __OS2__
    2.10  #define __OS2__		1
    2.11  #endif
     3.1 --- a/src/audio/dart/SDL_dart.c	Sat Mar 24 22:21:15 2018 +0300
     3.2 +++ b/src/audio/dart/SDL_dart.c	Sat Mar 24 22:25:33 2018 +0300
     3.3 @@ -48,7 +48,7 @@
     3.4  			    PMCI_MIX_BUFFER pBuffer,
     3.5  			    ULONG ulFlags)
     3.6  {
     3.7 -  if (ulFlags && MIX_WRITE_COMPLETE)
     3.8 +  if (ulFlags & MIX_WRITE_COMPLETE)
     3.9    { // Playback of buffer completed!
    3.10  
    3.11      // Get pointer to buffer description
     4.1 --- a/src/loadso/os2/SDL_sysloadso.c	Sat Mar 24 22:21:15 2018 +0300
     4.2 +++ b/src/loadso/os2/SDL_sysloadso.c	Sat Mar 24 22:25:33 2018 +0300
     4.3 @@ -35,12 +35,12 @@
     4.4  
     4.5  void *SDL_LoadObject(const char *sofile)
     4.6  {
     4.7 -    HMODULE handle = NULL;
     4.8 +    HMODULE handle = NULLHANDLE;
     4.9      char buf[512];
    4.10      APIRET ulrc = DosLoadModule(buf, sizeof (buf), (char *) sofile, &handle);
    4.11  
    4.12      /* Generate an error message if all loads failed */
    4.13 -    if ((ulrc != NO_ERROR) || (handle == NULL))
    4.14 +    if ((ulrc != NO_ERROR) || (handle == NULLHANDLE))
    4.15          SDL_SetError("Failed loading %s: %s", sofile, buf);
    4.16  
    4.17      return((void *) handle);
    4.18 @@ -49,8 +49,9 @@
    4.19  void *SDL_LoadFunction(void *handle, const char *name)
    4.20  {
    4.21      const char *loaderror = "Unknown error";
    4.22 -    void *symbol = NULL;
    4.23 +    PFN symbol = NULL;
    4.24      APIRET ulrc = DosQueryProcAddr((HMODULE)handle, 0, (char *)name, &symbol);
    4.25 +
    4.26      if (ulrc == ERROR_INVALID_HANDLE)
    4.27          loaderror = "Invalid module handle";
    4.28      else if (ulrc == ERROR_INVALID_NAME)
    4.29 @@ -59,7 +60,7 @@
    4.30      if (symbol == NULL)
    4.31          SDL_SetError("Failed loading %s: %s", name, loaderror);
    4.32  
    4.33 -    return(symbol);
    4.34 +    return((void *) symbol);
    4.35  }
    4.36  
    4.37  void SDL_UnloadObject(void *handle)
     5.1 --- a/src/video/os2fslib/SDL_os2fslib.c	Sat Mar 24 22:21:15 2018 +0300
     5.2 +++ b/src/video/os2fslib/SDL_os2fslib.c	Sat Mar 24 22:25:33 2018 +0300
     5.3 @@ -48,8 +48,8 @@
     5.4  
     5.5  static int bMouseCaptured   = 0;
     5.6  static int bMouseCapturable = 0;
     5.7 -static HPOINTER hptrGlobalPointer = NULL;
     5.8 -static HPOINTER hptrCurrentIcon = NULL;
     5.9 +static HPOINTER hptrGlobalPointer = NULLHANDLE;
    5.10 +static HPOINTER hptrCurrentIcon = NULLHANDLE;
    5.11  static int iWindowSizeX = 320;
    5.12  static int iWindowSizeY = 200;
    5.13  static int bWindowResized = 0;
    5.14 @@ -180,7 +180,7 @@
    5.15    int rc;
    5.16    UconvObject ucoTemp;
    5.17    char     achFrom[2];
    5.18 -  char     *pchFrom;
    5.19 +  void     *pchFrom;
    5.20    size_t   iFromCount;
    5.21    UniChar  aucTo[10];
    5.22    UniChar  *pucTo;
    5.23 @@ -636,7 +636,7 @@
    5.24          bWindowResized = 1;
    5.25  
    5.26          // Make sure the window will be redrawn
    5.27 -        WinInvalidateRegion(hwnd, NULL, TRUE);
    5.28 +        WinInvalidateRegion(hwnd, NULLHANDLE, TRUE);
    5.29        }
    5.30        break;
    5.31  
    5.32 @@ -725,7 +725,7 @@
    5.33            if ((pVideo->hidden->iMouseVisible) && (!bMouseCaptured))
    5.34              WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE));
    5.35            else
    5.36 -            WinSetPointer(HWND_DESKTOP, NULL);
    5.37 +            WinSetPointer(HWND_DESKTOP, NULLHANDLE);
    5.38  
    5.39            if (bMouseCapturable)
    5.40            {
    5.41 @@ -782,7 +782,7 @@
    5.42            if (!bMouseCaptured)
    5.43            {
    5.44              WinSetCapture(HWND_DESKTOP, hwnd);
    5.45 -            WinSetPointer(HWND_DESKTOP, NULL);
    5.46 +            WinSetPointer(HWND_DESKTOP, NULLHANDLE);
    5.47              bMouseCaptured = 1;
    5.48              {
    5.49                SWP swpClient;
    5.50 @@ -826,7 +826,7 @@
    5.51            if (!bMouseCaptured)
    5.52            {
    5.53              WinSetCapture(HWND_DESKTOP, hwnd);
    5.54 -            WinSetPointer(HWND_DESKTOP, NULL);
    5.55 +            WinSetPointer(HWND_DESKTOP, NULLHANDLE);
    5.56              bMouseCaptured = 1;
    5.57              {
    5.58                SWP swpClient;
    5.59 @@ -871,7 +871,7 @@
    5.60            if (!bMouseCaptured)
    5.61            {
    5.62              WinSetCapture(HWND_DESKTOP, hwnd);
    5.63 -            WinSetPointer(HWND_DESKTOP, NULL);
    5.64 +            WinSetPointer(HWND_DESKTOP, NULLHANDLE);
    5.65              bMouseCaptured = 1;
    5.66              {
    5.67                SWP swpClient;
    5.68 @@ -957,7 +957,7 @@
    5.69          }
    5.70          else
    5.71          {
    5.72 -          WinSetPointer(HWND_DESKTOP, NULL);
    5.73 +          WinSetPointer(HWND_DESKTOP, NULLHANDLE);
    5.74          }
    5.75        }
    5.76  #ifdef DEBUG_BUILD
    5.77 @@ -1257,7 +1257,7 @@
    5.78          bMouseCaptured = 0;
    5.79        }
    5.80        // Destroy our window
    5.81 -      WinDestroyWindow(pVideo->hidden->hwndFrame); pVideo->hidden->hwndFrame=NULL;
    5.82 +      WinDestroyWindow(pVideo->hidden->hwndFrame); pVideo->hidden->hwndFrame=NULLHANDLE;
    5.83        // Show pointer to make sure it will not be left hidden.
    5.84        WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE));
    5.85        WinShowPointer(HWND_DESKTOP, TRUE);
    5.86 @@ -1475,7 +1475,7 @@
    5.87    else
    5.88    {
    5.89      WinSetPointer(HWND_DESKTOP, FALSE);
    5.90 -    hptrGlobalPointer = NULL;
    5.91 +    hptrGlobalPointer = NULLHANDLE;
    5.92      _this->hidden->iMouseVisible = 0;
    5.93    }
    5.94  
    5.95 @@ -1610,7 +1610,7 @@
    5.96    if (hptrCurrentIcon)
    5.97    {
    5.98      WinDestroyPointer(hptrCurrentIcon);
    5.99 -    hptrCurrentIcon = NULL;
   5.100 +    hptrCurrentIcon = NULLHANDLE;
   5.101  
   5.102      WinSendMsg(hwndFrame,
   5.103                 WM_SETICON,
   5.104 @@ -2256,7 +2256,7 @@
   5.105          printf("[os2fslib_VideoQuit] : Destroying PM window!\n"); fflush(stdout);
   5.106  #endif
   5.107  
   5.108 -        WinDestroyWindow(_this->hidden->hwndFrame); _this->hidden->hwndFrame=NULL;
   5.109 +        WinDestroyWindow(_this->hidden->hwndFrame); _this->hidden->hwndFrame=NULLHANDLE;
   5.110        }
   5.111      }
   5.112  
   5.113 @@ -2280,7 +2280,7 @@
   5.114    if (hptrCurrentIcon)
   5.115    {
   5.116      WinDestroyPointer(hptrCurrentIcon);
   5.117 -    hptrCurrentIcon = NULL;
   5.118 +    hptrCurrentIcon = NULLHANDLE;
   5.119    }
   5.120  }
   5.121  
   5.122 @@ -2564,7 +2564,7 @@
   5.123    }
   5.124  
   5.125    // Redraw window
   5.126 -  WinInvalidateRegion(_this->hidden->hwndClient, NULL, TRUE);
   5.127 +  WinInvalidateRegion(_this->hidden->hwndClient, NULLHANDLE, TRUE);
   5.128  
   5.129    // Now destroy the message queue, if we've created it!
   5.130    if (ERRORIDERROR(hmqerror)==0)