Fixed compiler warnings on iOS
authorSam Lantinga <slouken@libsdl.org>
Mon, 07 Jul 2014 11:00:25 -0700
changeset 8983 21f5923cfd15
parent 8982 a41a6b334028
child 8984 bbc802ae0ada
Fixed compiler warnings on iOS
src/events/SDL_mouse.c
src/render/opengles2/SDL_render_gles2.c
src/timer/unix/SDL_systimer.c
src/video/uikit/SDL_uikitmessagebox.m
src/video/uikit/SDL_uikitview.m
--- a/src/events/SDL_mouse.c	Mon Jul 07 10:42:19 2014 -0700
+++ b/src/events/SDL_mouse.c	Mon Jul 07 11:00:25 2014 -0700
@@ -142,7 +142,7 @@
     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 @@
 
     /* 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)?
--- a/src/render/opengles2/SDL_render_gles2.c	Mon Jul 07 10:42:19 2014 -0700
+++ b/src/render/opengles2/SDL_render_gles2.c	Mon Jul 07 11:00:25 2014 -0700
@@ -80,7 +80,7 @@
     GLenum pixel_format;
     GLenum pixel_type;
     void *pixel_data;
-    size_t pitch;
+    int pitch;
     /* YV12 texture support */
     SDL_bool yuv;
     GLenum texture_v;
--- a/src/timer/unix/SDL_systimer.c	Mon Jul 07 10:42:19 2014 -0700
+++ b/src/timer/unix/SDL_systimer.c	Mon Jul 07 11:00:25 2014 -0700
@@ -106,7 +106,7 @@
                                                  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 @@
         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);
 }
--- a/src/video/uikit/SDL_uikitmessagebox.m	Mon Jul 07 10:42:19 2014 -0700
+++ b/src/video/uikit/SDL_uikitmessagebox.m	Mon Jul 07 11:00:25 2014 -0700
@@ -55,7 +55,7 @@
 
 - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;
 {
-    *clickedButtonIndex = buttonIndex;
+    *clickedButtonIndex = (int)buttonIndex;
 }
 
 @end /* UIKit_UIAlertViewDelegate */
--- a/src/video/uikit/SDL_uikitview.m	Mon Jul 07 10:42:19 2014 -0700
+++ b/src/video/uikit/SDL_uikitview.m	Mon Jul 07 11:00:25 2014 -0700
@@ -91,10 +91,10 @@
             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 @@
     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 @@
             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];