From 7187b74cf4e6a3b7c605754762a3b5e529b39aac Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 7 Jul 2014 11:00:25 -0700 Subject: [PATCH] Fixed compiler warnings on iOS --- src/events/SDL_mouse.c | 4 ++-- src/render/opengles2/SDL_render_gles2.c | 2 +- src/timer/unix/SDL_systimer.c | 6 ++---- src/video/uikit/SDL_uikitmessagebox.m | 2 +- src/video/uikit/SDL_uikitview.m | 8 ++++---- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index f313e7f6785eb..8ee262f105ce8 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 b30e35c06eb2d..604b93fc7ace8 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 be899e2a4425c..cace866195f3b 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 8fa8bc97b3219..c24f3ff8b375c 100644 --- a/src/video/uikit/SDL_uikitmessagebox.m +++ b/src/video/uikit/SDL_uikitmessagebox.m @@ -55,7 +55,7 @@ - (id)initWithButtonIndex:(int *)buttonIndex - (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 bee5a586e5a1c..c51a3ba7123b0 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -91,10 +91,10 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 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)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 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)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 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];