WinRT: merged with latest, official, SDL 2.x sources
authorDavid Ludwig <dludwig@pobox.com>
Sun, 21 Apr 2013 12:38:44 -0400
changeset 8464 a2a909304cfe
parent 8463 98dbf81ed5e9 (current diff)
parent 7082 e9d6004d2978 (diff)
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
--- a/android-project/src/org/libsdl/app/SDLActivity.java	Tue Apr 16 23:40:03 2013 -0400
+++ b/android-project/src/org/libsdl/app/SDLActivity.java	Sun Apr 21 12:38:44 2013 -0400
@@ -32,7 +32,7 @@
 public class SDLActivity extends Activity {
 
     // Keep track of the paused state
-    public static boolean mIsPaused;
+    public static boolean mIsPaused = false;
 
     // Main components
     private static SDLActivity mSingleton;
@@ -71,9 +71,6 @@
         // So we can call stuff from static callbacks
         mSingleton = this;
 
-        // Keep track of the paused state
-        mIsPaused = false;
-
         // Set up the surface
         mSurface = new SDLSurface(getApplication());
 
--- a/cmake/sdlchecks.cmake	Tue Apr 16 23:40:03 2013 -0400
+++ b/cmake/sdlchecks.cmake	Sun Apr 21 12:38:44 2013 -0400
@@ -551,7 +551,7 @@
   if(PTHREADS)
     if(LINUX)
       set(PTHREAD_CFLAGS "-D_REENTRANT")
-      set(PTHREAD_LDFLAGS "-lpthread")
+      set(PTHREAD_LDFLAGS "-pthread")
     elseif(BSDI)
       set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
       set(PTHREAD_LDFLAGS "")
@@ -607,6 +607,7 @@
         int main(int argc, char **argv) {
           pthread_mutexattr_t attr;
           pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+          return 0;
         }" HAVE_RECURSIVE_MUTEXES)
       if(HAVE_RECURSIVE_MUTEXES)
         set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
@@ -616,6 +617,7 @@
             int main(int argc, char **argv) {
               pthread_mutexattr_t attr;
               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+              return 0;
             }" HAVE_RECURSIVE_MUTEXES_NP)
         if(HAVE_RECURSIVE_MUTEXES_NP)
           set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1)
@@ -624,7 +626,8 @@
 
       if(PTHREADS_SEM)
         check_c_source_compiles("#include <pthread.h>
-                                 #include <semaphore.h>" HAVE_PTHREADS_SEM)
+                                 #include <semaphore.h>
+                                 int main(int argc, char **argv) { return 0; }" HAVE_PTHREADS_SEM)
         if(HAVE_PTHREADS_SEM)
           check_c_source_compiles("
               #include <pthread.h>
--- a/include/SDL_events.h	Tue Apr 16 23:40:03 2013 -0400
+++ b/include/SDL_events.h	Sun Apr 21 12:38:44 2013 -0400
@@ -124,11 +124,11 @@
 /**
  *  \brief Fields shared by every event
  */
-typedef struct SDL_GenericEvent
+typedef struct SDL_CommonEvent
 {
     Uint32 type;
     Uint32 timestamp;
-} SDL_GenericEvent;
+} SDL_CommonEvent;
     
 /**
  *  \brief Window state change event data (event.window.*)
@@ -464,7 +464,7 @@
 typedef union SDL_Event
 {
     Uint32 type;                    /**< Event type, shared with all events */
-    SDL_GenericEvent generic;       /**< Generic event data */
+    SDL_CommonEvent common;         /**< Common event data */
     SDL_WindowEvent window;         /**< Window event data */
     SDL_KeyboardEvent key;          /**< Keyboard event data */
     SDL_TextEditingEvent edit;      /**< Text editing event data */
--- a/include/SDL_mouse.h	Tue Apr 16 23:40:03 2013 -0400
+++ b/include/SDL_mouse.h	Sun Apr 21 12:38:44 2013 -0400
@@ -47,18 +47,18 @@
  */
 typedef enum
 {
-    SDL_SYSTEM_CURSOR_ARROW,     // Arrow
-    SDL_SYSTEM_CURSOR_IBEAM,     // I-beam
-    SDL_SYSTEM_CURSOR_WAIT,      // Wait
-    SDL_SYSTEM_CURSOR_CROSSHAIR, // Crosshair
-    SDL_SYSTEM_CURSOR_WAITARROW, // Small wait cursor (or Wait if not available)
-    SDL_SYSTEM_CURSOR_SIZENWSE,  // Double arrow pointing northwest and southeast
-    SDL_SYSTEM_CURSOR_SIZENESW,  // Double arrow pointing northeast and southwest
-    SDL_SYSTEM_CURSOR_SIZEWE,    // Double arrow pointing west and east
-    SDL_SYSTEM_CURSOR_SIZENS,    // Double arrow pointing north and south
-    SDL_SYSTEM_CURSOR_SIZEALL,   // Four pointed arrow pointing north, south, east, and west
-    SDL_SYSTEM_CURSOR_NO,        // Slashed circle or crossbones
-    SDL_SYSTEM_CURSOR_HAND,      // Hand
+    SDL_SYSTEM_CURSOR_ARROW,     /**< Arrow */
+    SDL_SYSTEM_CURSOR_IBEAM,     /**< I-beam */
+    SDL_SYSTEM_CURSOR_WAIT,      /**< Wait */
+    SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */
+    SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */
+    SDL_SYSTEM_CURSOR_SIZENWSE,  /**< Double arrow pointing northwest and southeast */
+    SDL_SYSTEM_CURSOR_SIZENESW,  /**< Double arrow pointing northeast and southwest */
+    SDL_SYSTEM_CURSOR_SIZEWE,    /**< Double arrow pointing west and east */
+    SDL_SYSTEM_CURSOR_SIZENS,    /**< Double arrow pointing north and south */
+    SDL_SYSTEM_CURSOR_SIZEALL,   /**< Four pointed arrow pointing north, south, east, and west */
+    SDL_SYSTEM_CURSOR_NO,        /**< Slashed circle or crossbones */
+    SDL_SYSTEM_CURSOR_HAND,      /**< Hand */
     SDL_NUM_SYSTEM_CURSORS
 } SDL_SystemCursor;
 
--- a/include/SDL_rwops.h	Tue Apr 16 23:40:03 2013 -0400
+++ b/include/SDL_rwops.h	Sun Apr 21 12:38:44 2013 -0400
@@ -138,7 +138,7 @@
         struct
         {
             void *data1;
-            int data2;
+            void *data2;
         } unknown;
     } hidden;
 
--- a/include/SDL_stdinc.h	Tue Apr 16 23:40:03 2013 -0400
+++ b/include/SDL_stdinc.h	Sun Apr 21 12:38:44 2013 -0400
@@ -100,9 +100,11 @@
 #ifdef __cplusplus
 #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
 #define SDL_static_cast(type, expression) static_cast<type>(expression)
+#define SDL_const_cast(type, expression) const_cast<type>(expression)
 #else
 #define SDL_reinterpret_cast(type, expression) ((type)(expression))
 #define SDL_static_cast(type, expression) ((type)(expression))
+#define SDL_const_cast(type, expression) ((type)(expression))
 #endif
 /*@}*//*Cast operators*/
 
@@ -509,49 +511,25 @@
 
 extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
 #ifdef HAVE_STRCHR
-SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) {
-#ifdef __cplusplus
-return const_cast<char*>(strchr(str, c));
-#else
-return (char*)strchr(str, c);
-#endif
-}
+SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,strchr(str, c)); }
 #define SDL_strchr SDL_strchr_inline
 #elif defined(HAVE_INDEX)  /* !!! FIXME: is there anywhere that has this but not strchr? */
-SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); }
+SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,index(str, c)); }
 #define SDL_strchr SDL_strchr_inline
 #endif
 
 extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
 #ifdef HAVE_STRRCHR
-SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
-#ifdef __cplusplus
-return const_cast<char*>(strrchr(str, c));
-#else
-return (char*)strrchr(str, c);
-#endif
-}
+SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,strrchr(str, c)); }
 #define SDL_strrchr SDL_strrchr_inline
 #elif defined(HAVE_RINDEX)  /* !!! FIXME: is there anywhere that has this but not strrchr? */
-SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
-#ifdef __cplusplus
-return const_cast<char*>(rindex(str, c));
-#else
-return (char*)rindex(str, c);
-#endif
-}
+SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,rindex(str, c)); }
 #define SDL_strrchr SDL_strrchr_inline
 #endif
 
 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
 #ifdef HAVE_STRSTR
-SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) {
-#ifdef __cplusplus
-return const_cast<char*>(strstr(haystack, needle));
-#else
-return (char*)strstr(haystack, needle);
-#endif
-}
+SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) { return SDL_const_cast(char*,strstr(haystack, needle)); }
 #define SDL_strstr SDL_strstr_inline
 #endif
 
--- a/src/events/SDL_events.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/events/SDL_events.c	Sun Apr 21 12:38:44 2013 -0400
@@ -132,12 +132,6 @@
        FIXME: Does this introduce any other bugs with events at startup?
      */
 
-    /* No filter to start with, process most event types */
-    SDL_EventOK = NULL;
-    SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
-    SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
-    SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
-
     /* Create the lock and set ourselves active */
 #if !SDL_THREADS_DISABLED
     if (!SDL_EventQ.lock) {
@@ -147,6 +141,13 @@
         return (-1);
     }
 #endif /* !SDL_THREADS_DISABLED */
+
+    /* No filter to start with, process most event types */
+    SDL_EventOK = NULL;
+    SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
+    SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE);
+    SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
+
     SDL_EventQ.active = 1;
 
     return (0);
@@ -373,7 +374,7 @@
 SDL_PushEvent(SDL_Event * event)
 {
     SDL_EventWatcher *curr;
-    event->generic.timestamp = SDL_GetTicks();
+    event->common.timestamp = SDL_GetTicks();
     if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) {
         return 0;
     }
--- a/src/file/SDL_rwops.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/file/SDL_rwops.c	Sun Apr 21 12:38:44 2013 -0400
@@ -635,8 +635,9 @@
     area = (SDL_RWops *) SDL_malloc(sizeof *area);
     if (area == NULL) {
         SDL_OutOfMemory();
+    } else {
+        area->type = SDL_RWOPS_UNKNOWN;
     }
-    area->type = SDL_RWOPS_UNKNOWN;
     return (area);
 }
 
--- a/src/joystick/SDL_gamecontroller.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/joystick/SDL_gamecontroller.c	Sun Apr 21 12:38:44 2013 -0400
@@ -157,7 +157,18 @@
 				{
 					if ( controllerlist->mapping.raxes[event->jaxis.axis] >= 0 ) // simple axis to axis, send it through
 					{
-						SDL_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.raxes[event->jaxis.axis], event->jaxis.value );
+						SDL_GameControllerAxis axis = controllerlist->mapping.raxes[event->jaxis.axis];
+                        Sint16 value = event->jaxis.value;
+						switch (axis)
+						{
+							case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
+							case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
+								/* Shift it to be 0 - 32767. */
+								value = value / 2 + 16384;
+							default:
+								break;
+						}
+						SDL_PrivateGameControllerAxis( controllerlist, axis, value );
 					}
 					else if ( controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0 ) // simlate an axis as a button
 					{
@@ -187,7 +198,7 @@
 					}
 					else if ( controllerlist->mapping.rbuttonasaxis[event->jbutton.button] >= 0 ) // an button pretending to be an axis
 					{
-						SDL_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32768 : 0 );
+						SDL_PrivateGameControllerAxis( controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32767 : 0 );
 					}
 					break;
 				}
--- a/src/render/SDL_render.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/render/SDL_render.c	Sun Apr 21 12:38:44 2013 -0400
@@ -1304,10 +1304,10 @@
             frect->h = renderer->scale.y;
         } else {
             /* FIXME: We can't use a rect for this line... */
-            frects[0].x = points[i].x * renderer->scale.x;
-            frects[0].y = points[i].y * renderer->scale.y;
-            frects[1].x = points[i+1].x * renderer->scale.x;
-            frects[1].y = points[i+1].y * renderer->scale.y;
+            fpoints[0].x = points[i].x * renderer->scale.x;
+            fpoints[0].y = points[i].y * renderer->scale.y;
+            fpoints[1].x = points[i+1].x * renderer->scale.x;
+            fpoints[1].y = points[i+1].y * renderer->scale.y;
             status += renderer->RenderDrawLines(renderer, fpoints, 2);
         }
     }
--- a/src/render/opengles2/SDL_render_gles2.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/render/opengles2/SDL_render_gles2.c	Sun Apr 21 12:38:44 2013 -0400
@@ -1564,8 +1564,7 @@
     GLES2_TextureData *texturedata = (GLES2_TextureData *)texture->driverdata;
     GLES2_ActivateRenderer(renderer);
 
-    data->glActiveTexture(GL_TEXTURE0);
-    data->glDisable(texturedata->texture_type);
+    data->glBindTexture(texturedata->texture_type, 0);
 
     return 0;
 }
--- a/src/video/SDL_bmp.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/video/SDL_bmp.c	Sun Apr 21 12:38:44 2013 -0400
@@ -260,6 +260,12 @@
                 SDL_RWread(src, &palette->colors[i].g, 1, 1);
                 SDL_RWread(src, &palette->colors[i].r, 1, 1);
                 SDL_RWread(src, &palette->colors[i].a, 1, 1);
+
+                /* According to Microsoft documentation, the fourth element
+                   is reserved and must be zero, so we shouldn't treat it as
+                   alpha.
+                */
+                palette->colors[i].a = SDL_ALPHA_OPAQUE;
             }
         }
     }
--- a/src/video/SDL_rect.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/video/SDL_rect.c	Sun Apr 21 12:38:44 2013 -0400
@@ -29,8 +29,13 @@
 {
     int Amin, Amax, Bmin, Bmax;
 
-    if (!A || !B) {
-        // TODO error message
+    if (!A) {
+        SDL_InvalidParamError("A");
+        return SDL_FALSE;
+    }
+
+    if (!B) {
+        SDL_InvalidParamError("B");
         return SDL_FALSE;
     }
 
@@ -71,13 +76,25 @@
 {
     int Amin, Amax, Bmin, Bmax;
 
-    if (!A || !B || !result) {
-        // TODO error message
+    if (!A) {
+        SDL_InvalidParamError("A");
+        return SDL_FALSE;
+    }
+
+    if (!B) {
+        SDL_InvalidParamError("B");
+        return SDL_FALSE;
+    }
+    
+    if (!result) {
+        SDL_InvalidParamError("result");
         return SDL_FALSE;
     }
 
     /* Special cases for empty rects */
     if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) {
+        result->w = 0;
+        result->h = 0;
         return SDL_FALSE;
     }
     
@@ -113,7 +130,18 @@
 {
     int Amin, Amax, Bmin, Bmax;
 
-    if (!A || !B || !result) {
+    if (!A) {
+        SDL_InvalidParamError("A");
+        return;
+    }
+
+    if (!B) {
+        SDL_InvalidParamError("B");
+        return;
+    }
+    
+    if (!result) {
+        SDL_InvalidParamError("result");
         return;
     }
 
@@ -171,12 +199,12 @@
     int x, y, i;
 
     if (!points) {
-        /* TODO error message */
+        SDL_InvalidParamError("points");
         return SDL_FALSE;
     }
 
     if (count < 1) {
-        /* TODO error message */
+        SDL_InvalidParamError("count");
         return SDL_FALSE;
     }
 
@@ -298,8 +326,28 @@
     int recty2;
     int outcode1, outcode2;
 
-    if (!rect || !X1 || !Y1 || !X2 || !Y2) {
-        // TODO error message
+    if (!rect) {
+        SDL_InvalidParamError("rect");
+        return SDL_FALSE;
+    }
+    
+    if (!X1) {
+        SDL_InvalidParamError("X1");
+        return SDL_FALSE;
+    }
+    
+    if (!Y1) {
+        SDL_InvalidParamError("Y1");
+        return SDL_FALSE;
+    }
+    
+    if (!X2) {
+        SDL_InvalidParamError("X2");
+        return SDL_FALSE;
+    }
+    
+    if (!Y2) {
+        SDL_InvalidParamError("Y2");
         return SDL_FALSE;
     }
 
@@ -418,18 +466,28 @@
     int span_y1, span_y2;
     int rect_y1, rect_y2;
 
-    if (width < 1 || height < 1) {
-        // TODO error message
+    if (width < 1) {
+        SDL_InvalidParamError("width");
         return SDL_FALSE;
     }
 
-    if (!rects || !span) {
-        // TODO error message
+    if (height < 1) {
+        SDL_InvalidParamError("height");
+        return SDL_FALSE;
+    }
+
+    if (!rects) {
+        SDL_InvalidParamError("rects");
+        return SDL_FALSE;
+    }
+
+    if (!span) {
+        SDL_InvalidParamError("span");
         return SDL_FALSE;
     }
 
     if (numrects < 1) {
-        // TODO error message
+        SDL_InvalidParamError("numrects");
         return SDL_FALSE;
     }
 
--- a/src/video/x11/SDL_x11mouse.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/video/x11/SDL_x11mouse.c	Sun Apr 21 12:38:44 2013 -0400
@@ -129,8 +129,14 @@
     unsigned int width_bytes = ((surface->w + 7) & ~7) / 8;
 
     data_bits = SDL_calloc(1, surface->h * width_bytes);
+    if (!data_bits) {
+        SDL_OutOfMemory();
+        return None;
+    }
+
     mask_bits = SDL_calloc(1, surface->h * width_bytes);
-    if (!data_bits || !mask_bits) {
+    if (!mask_bits) {
+        SDL_free(data_bits);
         SDL_OutOfMemory();
         return None;
     }
--- a/src/video/x11/edid-parse.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/src/video/x11/edid-parse.c	Sun Apr 21 12:38:44 2013 -0400
@@ -524,29 +524,17 @@
 
     decode_check_sum (edid, info);
     
-    if (!decode_header (edid))
-	return NULL;
-
-    if (!decode_vendor_and_product_identification (edid, info))
-	return NULL;
-
-    if (!decode_edid_version (edid, info))
-	return NULL;
-
-    if (!decode_display_parameters (edid, info))
+    if (!decode_header (edid) ||
+        !decode_vendor_and_product_identification (edid, info) ||
+        !decode_edid_version (edid, info) ||
+        !decode_display_parameters (edid, info) ||
+        !decode_color_characteristics (edid, info) ||
+        !decode_established_timings (edid, info) ||
+        !decode_standard_timings (edid, info) ||
+        !decode_descriptors (edid, info)) {
+        free(info);
 	return NULL;
-
-    if (!decode_color_characteristics (edid, info))
-	return NULL;
-
-    if (!decode_established_timings (edid, info))
-	return NULL;
-
-    if (!decode_standard_timings (edid, info))
-	return NULL;
-    
-    if (!decode_descriptors (edid, info))
-	return NULL;
+    }
     
     return info;
 }
--- a/test/testautomation_rect.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/test/testautomation_rect.c	Sun Apr 21 12:38:44 2013 -0400
@@ -614,8 +614,11 @@
     SDL_Rect rectB;
     SDL_Rect result;
     SDL_bool intersection;
+    SDL_bool empty;
 
     // Rect A empty
+    result.w = SDLTest_RandomIntegerInRange(1, 100);
+    result.h = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
@@ -627,8 +630,12 @@
     rectB = refRectB;
     intersection = SDL_IntersectRect(&rectA, &rectB, &result);
     _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
-
+    empty = (SDL_bool)SDL_RectEmpty(&result);
+    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
+    
     // Rect B empty
+    result.w = SDLTest_RandomIntegerInRange(1, 100);
+    result.h = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
@@ -640,8 +647,12 @@
     rectB = refRectB;
     intersection = SDL_IntersectRect(&rectA, &rectB, &result);
     _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+    empty = (SDL_bool)SDL_RectEmpty(&result);
+    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
 
     // Rect A and B empty
+    result.w = SDLTest_RandomIntegerInRange(1, 100);
+    result.h = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
     refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
@@ -655,8 +666,10 @@
     rectB = refRectB;
     intersection = SDL_IntersectRect(&rectA, &rectB, &result);
     _validateIntersectRectResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB, (SDL_Rect *)NULL, (SDL_Rect *)NULL);
+    empty = (SDL_bool)SDL_RectEmpty(&result);
+    SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
 
-	return TEST_COMPLETED;
+    return TEST_COMPLETED;
 }
 
 /*!
--- a/test/testautomation_video.c	Tue Apr 16 23:40:03 2013 -0400
+++ b/test/testautomation_video.c	Sun Apr 21 12:38:44 2013 -0400
@@ -3,6 +3,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 
 /* Visual Studio 2008 doesn't have stdint.h */
 #if defined(_MSC_VER) && _MSC_VER <= 1500
@@ -1522,7 +1523,7 @@
   	returnValue = TEST_ABORTED; 
   	goto cleanup; 
   }
-  userdata = (char *)strdup(referenceUserdata);
+  userdata = SDL_strdup(referenceUserdata);
   if (userdata == NULL) {
   	returnValue = TEST_ABORTED; 
   	goto cleanup;