Commit 7187b74cf4e6a3b7c605754762a3b5e529b39aac

Sam Lantinga 2014-07-07T11:00:25

Fixed compiler warnings on iOS

diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index f313e7f..8ee262f 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -142,7 +142,7 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate)
     SDL_Mouse *mouse = SDL_GetMouse();
     SDL_bool inWindow = SDL_TRUE;
 
-    if (window != NULL && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
+    if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
         int w, h;
         SDL_GetWindowSize(window, &w, &h);
         if (x < 0 || y < 0 || x >= w || y >= h) {
@@ -247,7 +247,7 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
 
     /* make sure that the pointers find themselves inside the windows,
        unless we have the mouse captured. */
-    if (window != NULL && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
+    if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
         int x_max = 0, y_max = 0;
 
         // !!! FIXME: shouldn't this be (window) instead of (mouse->focus)?
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index b30e35c..604b93f 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -80,7 +80,7 @@ typedef struct GLES2_TextureData
     GLenum pixel_format;
     GLenum pixel_type;
     void *pixel_data;
-    size_t pitch;
+    int pitch;
     /* YV12 texture support */
     SDL_bool yuv;
     GLenum texture_v;
diff --git a/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c
index be899e2..cace866 100644
--- a/src/timer/unix/SDL_systimer.c
+++ b/src/timer/unix/SDL_systimer.c
@@ -106,7 +106,7 @@ SDL_GetTicks(void)
                                                  start_ts.tv_nsec) / 1000000;
 #elif defined(__APPLE__)
         uint64_t now = mach_absolute_time();
-        ticks = (((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000;
+        ticks = (Uint32)((((now - start_mach) * mach_base_info.numer) / mach_base_info.denom) / 1000000);
 #else
         SDL_assert(SDL_FALSE);
         ticks = 0;
@@ -115,9 +115,7 @@ SDL_GetTicks(void)
         struct timeval now;
 
         gettimeofday(&now, NULL);
-        ticks =
-            (now.tv_sec - start_tv.tv_sec) * 1000 + (now.tv_usec -
-                                                  start_tv.tv_usec) / 1000;
+        ticks = (Uint32)((now.tv_sec - start_tv.tv_sec) * 1000 + (now.tv_usec - start_tv.tv_usec) / 1000);
     }
     return (ticks);
 }
diff --git a/src/video/uikit/SDL_uikitmessagebox.m b/src/video/uikit/SDL_uikitmessagebox.m
index 8fa8bc9..c24f3ff 100644
--- a/src/video/uikit/SDL_uikitmessagebox.m
+++ b/src/video/uikit/SDL_uikitmessagebox.m
@@ -55,7 +55,7 @@ static SDL_bool s_showingMessageBox = SDL_FALSE;
 
 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;
 {
-    *clickedButtonIndex = buttonIndex;
+    *clickedButtonIndex = (int)buttonIndex;
 }
 
 @end /* UIKit_UIAlertViewDelegate */
diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m
index bee5a58..c51a3ba 100644
--- a/src/video/uikit/SDL_uikitview.m
+++ b/src/video/uikit/SDL_uikitview.m
@@ -91,10 +91,10 @@ void _uikit_keyboard_init() ;
             CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
 
             /* send moved event */
-            SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
+            SDL_SendMouseMotion(self->viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
 
             /* send mouse down event */
-            SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
+            SDL_SendMouseButton(self->viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
 
             leftFingerDown = touch;
         }
@@ -130,7 +130,7 @@ void _uikit_keyboard_init() ;
     while(touch) {
         if (touch == leftFingerDown) {
             /* send mouse up */
-            SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
+            SDL_SendMouseButton(self->viewcontroller.window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
             leftFingerDown = nil;
         }
 
@@ -173,7 +173,7 @@ void _uikit_keyboard_init() ;
             CGPoint locationInView = [self touchLocation:touch shouldNormalize:NO];
 
             /* send moved event */
-            SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
+            SDL_SendMouseMotion(self->viewcontroller.window, SDL_TOUCH_MOUSEID, 0, locationInView.x, locationInView.y);
         }
 
         CGPoint locationInView = [self touchLocation:touch shouldNormalize:YES];