WinRT: merged with latest, official, SDL 2.x sources
authorDavid Ludwig <dludwig@pobox.com>
Sun, 21 Apr 2013 12:38:44 -0400
changeset 8464a2a909304cfe
parent 8463 98dbf81ed5e9
parent 7082 e9d6004d2978
child 8465 be2dce468a8c
WinRT: merged with latest, official, SDL 2.x sources
include/SDL_stdinc.h
src/events/SDL_events.c
src/file/SDL_rwops.c
src/render/SDL_render.c
     1.1 --- a/android-project/src/org/libsdl/app/SDLActivity.java	Tue Apr 16 23:40:03 2013 -0400
     1.2 +++ b/android-project/src/org/libsdl/app/SDLActivity.java	Sun Apr 21 12:38:44 2013 -0400
     1.3 @@ -32,7 +32,7 @@
     1.4  public class SDLActivity extends Activity {
     1.5  
     1.6      // Keep track of the paused state
     1.7 -    public static boolean mIsPaused;
     1.8 +    public static boolean mIsPaused = false;
     1.9  
    1.10      // Main components
    1.11      private static SDLActivity mSingleton;
    1.12 @@ -71,9 +71,6 @@
    1.13          // So we can call stuff from static callbacks
    1.14          mSingleton = this;
    1.15  
    1.16 -        // Keep track of the paused state
    1.17 -        mIsPaused = false;
    1.18 -
    1.19          // Set up the surface
    1.20          mSurface = new SDLSurface(getApplication());
    1.21  
     2.1 --- a/cmake/sdlchecks.cmake	Tue Apr 16 23:40:03 2013 -0400
     2.2 +++ b/cmake/sdlchecks.cmake	Sun Apr 21 12:38:44 2013 -0400
     2.3 @@ -551,7 +551,7 @@
     2.4    if(PTHREADS)
     2.5      if(LINUX)
     2.6        set(PTHREAD_CFLAGS "-D_REENTRANT")
     2.7 -      set(PTHREAD_LDFLAGS "-lpthread")
     2.8 +      set(PTHREAD_LDFLAGS "-pthread")
     2.9      elseif(BSDI)
    2.10        set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
    2.11        set(PTHREAD_LDFLAGS "")
    2.12 @@ -607,6 +607,7 @@
    2.13          int main(int argc, char **argv) {
    2.14            pthread_mutexattr_t attr;
    2.15            pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
    2.16 +          return 0;
    2.17          }" HAVE_RECURSIVE_MUTEXES)
    2.18        if(HAVE_RECURSIVE_MUTEXES)
    2.19          set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
    2.20 @@ -616,6 +617,7 @@
    2.21              int main(int argc, char **argv) {
    2.22                pthread_mutexattr_t attr;
    2.23                pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
    2.24 +              return 0;
    2.25              }" HAVE_RECURSIVE_MUTEXES_NP)
    2.26          if(HAVE_RECURSIVE_MUTEXES_NP)
    2.27            set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1)
    2.28 @@ -624,7 +626,8 @@
    2.29  
    2.30        if(PTHREADS_SEM)
    2.31          check_c_source_compiles("#include <pthread.h>
    2.32 -                                 #include <semaphore.h>" HAVE_PTHREADS_SEM)
    2.33 +                                 #include <semaphore.h>
    2.34 +                                 int main(int argc, char **argv) { return 0; }" HAVE_PTHREADS_SEM)
    2.35          if(HAVE_PTHREADS_SEM)
    2.36            check_c_source_compiles("
    2.37                #include <pthread.h>
     3.1 --- a/include/SDL_events.h	Tue Apr 16 23:40:03 2013 -0400
     3.2 +++ b/include/SDL_events.h	Sun Apr 21 12:38:44 2013 -0400
     3.3 @@ -124,11 +124,11 @@
     3.4  /**
     3.5   *  \brief Fields shared by every event
     3.6   */
     3.7 -typedef struct SDL_GenericEvent
     3.8 +typedef struct SDL_CommonEvent
     3.9  {
    3.10      Uint32 type;
    3.11      Uint32 timestamp;
    3.12 -} SDL_GenericEvent;
    3.13 +} SDL_CommonEvent;
    3.14      
    3.15  /**
    3.16   *  \brief Window state change event data (event.window.*)
    3.17 @@ -464,7 +464,7 @@
    3.18  typedef union SDL_Event
    3.19  {
    3.20      Uint32 type;                    /**< Event type, shared with all events */
    3.21 -    SDL_GenericEvent generic;       /**< Generic event data */
    3.22 +    SDL_CommonEvent common;         /**< Common event data */
    3.23      SDL_WindowEvent window;         /**< Window event data */
    3.24      SDL_KeyboardEvent key;          /**< Keyboard event data */
    3.25      SDL_TextEditingEvent edit;      /**< Text editing event data */
     4.1 --- a/include/SDL_mouse.h	Tue Apr 16 23:40:03 2013 -0400
     4.2 +++ b/include/SDL_mouse.h	Sun Apr 21 12:38:44 2013 -0400
     4.3 @@ -47,18 +47,18 @@
     4.4   */
     4.5  typedef enum
     4.6  {
     4.7 -    SDL_SYSTEM_CURSOR_ARROW,     // Arrow
     4.8 -    SDL_SYSTEM_CURSOR_IBEAM,     // I-beam
     4.9 -    SDL_SYSTEM_CURSOR_WAIT,      // Wait
    4.10 -    SDL_SYSTEM_CURSOR_CROSSHAIR, // Crosshair
    4.11 -    SDL_SYSTEM_CURSOR_WAITARROW, // Small wait cursor (or Wait if not available)
    4.12 -    SDL_SYSTEM_CURSOR_SIZENWSE,  // Double arrow pointing northwest and southeast
    4.13 -    SDL_SYSTEM_CURSOR_SIZENESW,  // Double arrow pointing northeast and southwest
    4.14 -    SDL_SYSTEM_CURSOR_SIZEWE,    // Double arrow pointing west and east
    4.15 -    SDL_SYSTEM_CURSOR_SIZENS,    // Double arrow pointing north and south
    4.16 -    SDL_SYSTEM_CURSOR_SIZEALL,   // Four pointed arrow pointing north, south, east, and west
    4.17 -    SDL_SYSTEM_CURSOR_NO,        // Slashed circle or crossbones
    4.18 -    SDL_SYSTEM_CURSOR_HAND,      // Hand
    4.19 +    SDL_SYSTEM_CURSOR_ARROW,     /**< Arrow */
    4.20 +    SDL_SYSTEM_CURSOR_IBEAM,     /**< I-beam */
    4.21 +    SDL_SYSTEM_CURSOR_WAIT,      /**< Wait */
    4.22 +    SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
    4.23 +    SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
    4.24 +    SDL_SYSTEM_CURSOR_SIZENWSE,  /**< Double arrow pointing northwest and southeast */
    4.25 +    SDL_SYSTEM_CURSOR_SIZENESW,  /**< Double arrow pointing northeast and southwest */
    4.26 +    SDL_SYSTEM_CURSOR_SIZEWE,    /**< Double arrow pointing west and east */
    4.27 +    SDL_SYSTEM_CURSOR_SIZENS,    /**< Double arrow pointing north and south */
    4.28 +    SDL_SYSTEM_CURSOR_SIZEALL,   /**< Four pointed arrow pointing north, south, east, and west */
    4.29 +    SDL_SYSTEM_CURSOR_NO,        /**< Slashed circle or crossbones */
    4.30 +    SDL_SYSTEM_CURSOR_HAND,      /**< Hand */
    4.31      SDL_NUM_SYSTEM_CURSORS
    4.32  } SDL_SystemCursor;
    4.33  
     5.1 --- a/include/SDL_rwops.h	Tue Apr 16 23:40:03 2013 -0400
     5.2 +++ b/include/SDL_rwops.h	Sun Apr 21 12:38:44 2013 -0400
     5.3 @@ -138,7 +138,7 @@
     5.4          struct
     5.5          {
     5.6              void *data1;
     5.7 -            int data2;
     5.8 +            void *data2;
     5.9          } unknown;
    5.10      } hidden;
    5.11  
     6.1 --- a/include/SDL_stdinc.h	Tue Apr 16 23:40:03 2013 -0400
     6.2 +++ b/include/SDL_stdinc.h	Sun Apr 21 12:38:44 2013 -0400
     6.3 @@ -100,9 +100,11 @@
     6.4  #ifdef __cplusplus
     6.5  #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
     6.6  #define SDL_static_cast(type, expression) static_cast<type>(expression)
     6.7 +#define SDL_const_cast(type, expression) const_cast<type>(expression)
     6.8  #else
     6.9  #define SDL_reinterpret_cast(type, expression) ((type)(expression))
    6.10  #define SDL_static_cast(type, expression) ((type)(expression))
    6.11 +#define SDL_const_cast(type, expression) ((type)(expression))
    6.12  #endif
    6.13  /*@}*//*Cast operators*/
    6.14  
    6.15 @@ -509,49 +511,25 @@
    6.16  
    6.17  extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
    6.18  #ifdef HAVE_STRCHR
    6.19 -SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) {
    6.20 -#ifdef __cplusplus
    6.21 -return const_cast<char*>(strchr(str, c));
    6.22 -#else
    6.23 -return (char*)strchr(str, c);
    6.24 -#endif
    6.25 -}
    6.26 +SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,strchr(str, c)); }
    6.27  #define SDL_strchr SDL_strchr_inline
    6.28  #elif defined(HAVE_INDEX)  /* !!! FIXME: is there anywhere that has this but not strchr? */
    6.29 -SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); }
    6.30 +SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,index(str, c)); }
    6.31  #define SDL_strchr SDL_strchr_inline
    6.32  #endif
    6.33  
    6.34  extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
    6.35  #ifdef HAVE_STRRCHR
    6.36 -SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
    6.37 -#ifdef __cplusplus
    6.38 -return const_cast<char*>(strrchr(str, c));
    6.39 -#else
    6.40 -return (char*)strrchr(str, c);
    6.41 -#endif
    6.42 -}
    6.43 +SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,strrchr(str, c)); }
    6.44  #define SDL_strrchr SDL_strrchr_inline
    6.45  #elif defined(HAVE_RINDEX)  /* !!! FIXME: is there anywhere that has this but not strrchr? */
    6.46 -SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
    6.47 -#ifdef __cplusplus
    6.48 -return const_cast<char*>(rindex(str, c));
    6.49 -#else
    6.50 -return (char*)rindex(str, c);
    6.51 -#endif
    6.52 -}
    6.53 +SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,rindex(str, c)); }
    6.54  #define SDL_strrchr SDL_strrchr_inline
    6.55  #endif
    6.56  
    6.57  extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
    6.58  #ifdef HAVE_STRSTR
    6.59 -SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) {
    6.60 -#ifdef __cplusplus
    6.61 -return const_cast<char*>(strstr(haystack, needle));
    6.62 -#else
    6.63 -return (char*)strstr(haystack, needle);
    6.64 -#endif
    6.65 -}
    6.66 +SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) { return SDL_const_cast(char*,strstr(haystack, needle)); }
    6.67  #define SDL_strstr SDL_strstr_inline
    6.68  #endif
    6.69  
     7.1 --- a/src/events/SDL_events.c	Tue Apr 16 23:40:03 2013 -0400
     7.2 +++ b/src/events/SDL_events.c	Sun Apr 21 12:38:44 2013 -0400
     7.3 @@ -132,12 +132,6 @@
     7.4         FIXME: Does this introduce any other bugs with events at startup?
     7.5       */
     7.6  
     7.7 -    /* No filter to start with, process most event types */
     7.8 -    SDL_EventOK = NULL;
     7.9 -    SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
    7.10 -    SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
    7.11 -    SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
    7.12 -
    7.13      /* Create the lock and set ourselves active */
    7.14  #if !SDL_THREADS_DISABLED
    7.15      if (!SDL_EventQ.lock) {
    7.16 @@ -147,6 +141,13 @@
    7.17          return (-1);
    7.18      }
    7.19  #endif /* !SDL_THREADS_DISABLED */
    7.20 +
    7.21 +    /* No filter to start with, process most event types */
    7.22 +    SDL_EventOK = NULL;
    7.23 +    SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
    7.24 +    SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
    7.25 +    SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
    7.26 +
    7.27      SDL_EventQ.active = 1;
    7.28  
    7.29      return (0);
    7.30 @@ -373,7 +374,7 @@
    7.31  SDL_PushEvent(SDL_Event * event)
    7.32  {
    7.33      SDL_EventWatcher *curr;
    7.34 -    event->generic.timestamp = SDL_GetTicks();
    7.35 +    event->common.timestamp = SDL_GetTicks();
    7.36      if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) {
    7.37          return 0;
    7.38      }
     8.1 --- a/src/file/SDL_rwops.c	Tue Apr 16 23:40:03 2013 -0400
     8.2 +++ b/src/file/SDL_rwops.c	Sun Apr 21 12:38:44 2013 -0400
     8.3 @@ -635,8 +635,9 @@
     8.4      area = (SDL_RWops *) SDL_malloc(sizeof *area);
     8.5      if (area == NULL) {
     8.6          SDL_OutOfMemory();
     8.7 +    } else {
     8.8 +        area->type = SDL_RWOPS_UNKNOWN;
     8.9      }
    8.10 -    area->type = SDL_RWOPS_UNKNOWN;
    8.11      return (area);
    8.12  }
    8.13  
     9.1 --- a/src/joystick/SDL_gamecontroller.c	Tue Apr 16 23:40:03 2013 -0400
     9.2 +++ b/src/joystick/SDL_gamecontroller.c	Sun Apr 21 12:38:44 2013 -0400
     9.3 @@ -157,7 +157,18 @@
     9.4  				{
     9.5  					if ( controllerlist->mapping.raxes[event->jaxis.axis] >= 0 ) // simple axis to axis, send it through
     9.6  					{
     9.7 -						SDL_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.raxes[event->jaxis.axis], event->jaxis.value );
     9.8 +						SDL_GameControllerAxis axis = controllerlist->mapping.raxes[event->jaxis.axis];
     9.9 +                        Sint16 value = event->jaxis.value;
    9.10 +						switch (axis)
    9.11 +						{
    9.12 +							case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
    9.13 +							case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
    9.14 +								/* Shift it to be 0 - 32767. */
    9.15 +								value = value / 2 + 16384;
    9.16 +							default:
    9.17 +								break;
    9.18 +						}
    9.19 +						SDL_PrivateGameControllerAxis( controllerlist, axis, value );
    9.20  					}
    9.21  					else if ( controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0 ) // simlate an axis as a button
    9.22  					{
    9.23 @@ -187,7 +198,7 @@
    9.24  					}
    9.25  					else if ( controllerlist->mapping.rbuttonasaxis[event->jbutton.button] >= 0 ) // an button pretending to be an axis
    9.26  					{
    9.27 -						SDL_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32768 : 0 );
    9.28 +						SDL_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32767 : 0 );
    9.29  					}
    9.30  					break;
    9.31  				}
    10.1 --- a/src/render/SDL_render.c	Tue Apr 16 23:40:03 2013 -0400
    10.2 +++ b/src/render/SDL_render.c	Sun Apr 21 12:38:44 2013 -0400
    10.3 @@ -1304,10 +1304,10 @@
    10.4              frect->h = renderer->scale.y;
    10.5          } else {
    10.6              /* FIXME: We can't use a rect for this line... */
    10.7 -            frects[0].x = points[i].x * renderer->scale.x;
    10.8 -            frects[0].y = points[i].y * renderer->scale.y;
    10.9 -            frects[1].x = points[i+1].x * renderer->scale.x;
   10.10 -            frects[1].y = points[i+1].y * renderer->scale.y;
   10.11 +            fpoints[0].x = points[i].x * renderer->scale.x;
   10.12 +            fpoints[0].y = points[i].y * renderer->scale.y;
   10.13 +            fpoints[1].x = points[i+1].x * renderer->scale.x;
   10.14 +            fpoints[1].y = points[i+1].y * renderer->scale.y;
   10.15              status += renderer->RenderDrawLines(renderer, fpoints, 2);
   10.16          }
   10.17      }
    11.1 --- a/src/render/opengles2/SDL_render_gles2.c	Tue Apr 16 23:40:03 2013 -0400
    11.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Sun Apr 21 12:38:44 2013 -0400
    11.3 @@ -1564,8 +1564,7 @@
    11.4      GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata;
    11.5      GLES2_ActivateRenderer(renderer);
    11.6  
    11.7 -    data->glActiveTexture(GL_TEXTURE0);
    11.8 -    data->glDisable(texturedata->texture_type);
    11.9 +    data->glBindTexture(texturedata->texture_type, 0);
   11.10  
   11.11      return 0;
   11.12  }
    12.1 --- a/src/video/SDL_bmp.c	Tue Apr 16 23:40:03 2013 -0400
    12.2 +++ b/src/video/SDL_bmp.c	Sun Apr 21 12:38:44 2013 -0400
    12.3 @@ -260,6 +260,12 @@
    12.4                  SDL_RWread(src, &palette->colors[i].g, 1, 1);
    12.5                  SDL_RWread(src, &palette->colors[i].r, 1, 1);
    12.6                  SDL_RWread(src, &palette->colors[i].a, 1, 1);
    12.7 +
    12.8 +                /* According to Microsoft documentation, the fourth element
    12.9 +                   is reserved and must be zero, so we shouldn't treat it as
   12.10 +                   alpha.
   12.11 +                */
   12.12 +                palette->colors[i].a = SDL_ALPHA_OPAQUE;
   12.13              }
   12.14          }
   12.15      }
    13.1 --- a/src/video/SDL_rect.c	Tue Apr 16 23:40:03 2013 -0400
    13.2 +++ b/src/video/SDL_rect.c	Sun Apr 21 12:38:44 2013 -0400
    13.3 @@ -29,8 +29,13 @@
    13.4  {
    13.5      int Amin, Amax, Bmin, Bmax;
    13.6  
    13.7 -    if (!A || !B) {
    13.8 -        // TODO error message
    13.9 +    if (!A) {
   13.10 +        SDL_InvalidParamError("A");
   13.11 +        return SDL_FALSE;
   13.12 +    }
   13.13 +
   13.14 +    if (!B) {
   13.15 +        SDL_InvalidParamError("B");
   13.16          return SDL_FALSE;
   13.17      }
   13.18  
   13.19 @@ -71,13 +76,25 @@
   13.20  {
   13.21      int Amin, Amax, Bmin, Bmax;
   13.22  
   13.23 -    if (!A || !B || !result) {
   13.24 -        // TODO error message
   13.25 +    if (!A) {
   13.26 +        SDL_InvalidParamError("A");
   13.27 +        return SDL_FALSE;
   13.28 +    }
   13.29 +
   13.30 +    if (!B) {
   13.31 +        SDL_InvalidParamError("B");
   13.32 +        return SDL_FALSE;
   13.33 +    }
   13.34 +    
   13.35 +    if (!result) {
   13.36 +        SDL_InvalidParamError("result");
   13.37          return SDL_FALSE;
   13.38      }
   13.39  
   13.40      /* Special cases for empty rects */
   13.41      if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) {
   13.42 +        result->w = 0;
   13.43 +        result->h = 0;
   13.44          return SDL_FALSE;
   13.45      }
   13.46      
   13.47 @@ -113,7 +130,18 @@
   13.48  {
   13.49      int Amin, Amax, Bmin, Bmax;
   13.50  
   13.51 -    if (!A || !B || !result) {
   13.52 +    if (!A) {
   13.53 +        SDL_InvalidParamError("A");
   13.54 +        return;
   13.55 +    }
   13.56 +
   13.57 +    if (!B) {
   13.58 +        SDL_InvalidParamError("B");
   13.59 +        return;
   13.60 +    }
   13.61 +    
   13.62 +    if (!result) {
   13.63 +        SDL_InvalidParamError("result");
   13.64          return;
   13.65      }
   13.66  
   13.67 @@ -171,12 +199,12 @@
   13.68      int x, y, i;
   13.69  
   13.70      if (!points) {
   13.71 -        /* TODO error message */
   13.72 +        SDL_InvalidParamError("points");
   13.73          return SDL_FALSE;
   13.74      }
   13.75  
   13.76      if (count < 1) {
   13.77 -        /* TODO error message */
   13.78 +        SDL_InvalidParamError("count");
   13.79          return SDL_FALSE;
   13.80      }
   13.81  
   13.82 @@ -298,8 +326,28 @@
   13.83      int recty2;
   13.84      int outcode1, outcode2;
   13.85  
   13.86 -    if (!rect || !X1 || !Y1 || !X2 || !Y2) {
   13.87 -        // TODO error message
   13.88 +    if (!rect) {
   13.89 +        SDL_InvalidParamError("rect");
   13.90 +        return SDL_FALSE;
   13.91 +    }
   13.92 +    
   13.93 +    if (!X1) {
   13.94 +        SDL_InvalidParamError("X1");
   13.95 +        return SDL_FALSE;
   13.96 +    }
   13.97 +    
   13.98 +    if (!Y1) {
   13.99 +        SDL_InvalidParamError("Y1");
  13.100 +        return SDL_FALSE;
  13.101 +    }
  13.102 +    
  13.103 +    if (!X2) {
  13.104 +        SDL_InvalidParamError("X2");
  13.105 +        return SDL_FALSE;
  13.106 +    }
  13.107 +    
  13.108 +    if (!Y2) {
  13.109 +        SDL_InvalidParamError("Y2");
  13.110          return SDL_FALSE;
  13.111      }
  13.112  
  13.113 @@ -418,18 +466,28 @@
  13.114      int span_y1, span_y2;
  13.115      int rect_y1, rect_y2;
  13.116  
  13.117 -    if (width < 1 || height < 1) {
  13.118 -        // TODO error message
  13.119 +    if (width < 1) {
  13.120 +        SDL_InvalidParamError("width");
  13.121          return SDL_FALSE;
  13.122      }
  13.123  
  13.124 -    if (!rects || !span) {
  13.125 -        // TODO error message
  13.126 +    if (height < 1) {
  13.127 +        SDL_InvalidParamError("height");
  13.128 +        return SDL_FALSE;
  13.129 +    }
  13.130 +
  13.131 +    if (!rects) {
  13.132 +        SDL_InvalidParamError("rects");
  13.133 +        return SDL_FALSE;
  13.134 +    }
  13.135 +
  13.136 +    if (!span) {
  13.137 +        SDL_InvalidParamError("span");
  13.138          return SDL_FALSE;
  13.139      }
  13.140  
  13.141      if (numrects < 1) {
  13.142 -        // TODO error message
  13.143 +        SDL_InvalidParamError("numrects");
  13.144          return SDL_FALSE;
  13.145      }
  13.146  
    14.1 --- a/src/video/x11/SDL_x11mouse.c	Tue Apr 16 23:40:03 2013 -0400
    14.2 +++ b/src/video/x11/SDL_x11mouse.c	Sun Apr 21 12:38:44 2013 -0400
    14.3 @@ -129,8 +129,14 @@
    14.4      unsigned int width_bytes = ((surface->w + 7) & ~7) / 8;
    14.5  
    14.6      data_bits = SDL_calloc(1, surface->h * width_bytes);
    14.7 +    if (!data_bits) {
    14.8 +        SDL_OutOfMemory();
    14.9 +        return None;
   14.10 +    }
   14.11 +
   14.12      mask_bits = SDL_calloc(1, surface->h * width_bytes);
   14.13 -    if (!data_bits || !mask_bits) {
   14.14 +    if (!mask_bits) {
   14.15 +        SDL_free(data_bits);
   14.16          SDL_OutOfMemory();
   14.17          return None;
   14.18      }
    15.1 --- a/src/video/x11/edid-parse.c	Tue Apr 16 23:40:03 2013 -0400
    15.2 +++ b/src/video/x11/edid-parse.c	Sun Apr 21 12:38:44 2013 -0400
    15.3 @@ -524,29 +524,17 @@
    15.4  
    15.5      decode_check_sum (edid, info);
    15.6      
    15.7 -    if (!decode_header (edid))
    15.8 +    if (!decode_header (edid) ||
    15.9 +        !decode_vendor_and_product_identification (edid, info) ||
   15.10 +        !decode_edid_version (edid, info) ||
   15.11 +        !decode_display_parameters (edid, info) ||
   15.12 +        !decode_color_characteristics (edid, info) ||
   15.13 +        !decode_established_timings (edid, info) ||
   15.14 +        !decode_standard_timings (edid, info) ||
   15.15 +        !decode_descriptors (edid, info)) {
   15.16 +        free(info);
   15.17  	return NULL;
   15.18 -
   15.19 -    if (!decode_vendor_and_product_identification (edid, info))
   15.20 -	return NULL;
   15.21 -
   15.22 -    if (!decode_edid_version (edid, info))
   15.23 -	return NULL;
   15.24 -
   15.25 -    if (!decode_display_parameters (edid, info))
   15.26 -	return NULL;
   15.27 -
   15.28 -    if (!decode_color_characteristics (edid, info))
   15.29 -	return NULL;
   15.30 -
   15.31 -    if (!decode_established_timings (edid, info))
   15.32 -	return NULL;
   15.33 -
   15.34 -    if (!decode_standard_timings (edid, info))
   15.35 -	return NULL;
   15.36 -    
   15.37 -    if (!decode_descriptors (edid, info))
   15.38 -	return NULL;
   15.39 +    }
   15.40      
   15.41      return info;
   15.42  }
    16.1 --- a/test/testautomation_rect.c	Tue Apr 16 23:40:03 2013 -0400
    16.2 +++ b/test/testautomation_rect.c	Sun Apr 21 12:38:44 2013 -0400
    16.3 @@ -614,8 +614,11 @@
    16.4      SDL_Rect rectB;
    16.5      SDL_Rect result;
    16.6      SDL_bool intersection;
    16.7 +    SDL_bool empty;
    16.8  
    16.9      // Rect A empty
   16.10 +    result.w = SDLTest_RandomIntegerInRange(1, 100);
   16.11 +    result.h = SDLTest_RandomIntegerInRange(1, 100);
   16.12      refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
   16.13      refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
   16.14      refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
   16.15 @@ -627,8 +630,12 @@
   16.16      rectB = refRectB;
   16.17      intersection = SDL_IntersectRect(&rectA, &rectB, &result);
   16.18      _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
   16.19 -
   16.20 +    empty = (SDL_bool)SDL_RectEmpty(&result);
   16.21 +    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
   16.22 +    
   16.23      // Rect B empty
   16.24 +    result.w = SDLTest_RandomIntegerInRange(1, 100);
   16.25 +    result.h = SDLTest_RandomIntegerInRange(1, 100);
   16.26      refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
   16.27      refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
   16.28      refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
   16.29 @@ -640,8 +647,12 @@
   16.30      rectB = refRectB;
   16.31      intersection = SDL_IntersectRect(&rectA, &rectB, &result);
   16.32      _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
   16.33 +    empty = (SDL_bool)SDL_RectEmpty(&result);
   16.34 +    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
   16.35  
   16.36      // Rect A and B empty
   16.37 +    result.w = SDLTest_RandomIntegerInRange(1, 100);
   16.38 +    result.h = SDLTest_RandomIntegerInRange(1, 100);
   16.39      refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
   16.40      refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
   16.41      refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
   16.42 @@ -655,8 +666,10 @@
   16.43      rectB = refRectB;
   16.44      intersection = SDL_IntersectRect(&rectA, &rectB, &result);
   16.45      _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
   16.46 +    empty = (SDL_bool)SDL_RectEmpty(&result);
   16.47 +    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
   16.48  
   16.49 -	return TEST_COMPLETED;
   16.50 +    return TEST_COMPLETED;
   16.51  }
   16.52  
   16.53  /*!
    17.1 --- a/test/testautomation_video.c	Tue Apr 16 23:40:03 2013 -0400
    17.2 +++ b/test/testautomation_video.c	Sun Apr 21 12:38:44 2013 -0400
    17.3 @@ -3,6 +3,7 @@
    17.4   */
    17.5  
    17.6  #include <stdio.h>
    17.7 +#include <string.h>
    17.8  
    17.9  /* Visual Studio 2008 doesn't have stdint.h */
   17.10  #if defined(_MSC_VER) && _MSC_VER <= 1500
   17.11 @@ -1522,7 +1523,7 @@
   17.12    	returnValue = TEST_ABORTED; 
   17.13    	goto cleanup; 
   17.14    }
   17.15 -  userdata = (char *)strdup(referenceUserdata);
   17.16 +  userdata = SDL_strdup(referenceUserdata);
   17.17    if (userdata == NULL) {
   17.18    	returnValue = TEST_ABORTED; 
   17.19    	goto cleanup;