Skip to content

Commit

Permalink
Fixed compiler warnings on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 7, 2014
1 parent 017c5dc commit 7187b74
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/events/SDL_mouse.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)?
Expand Down
2 changes: 1 addition & 1 deletion src/render/opengles2/SDL_render_gles2.c
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions src/timer/unix/SDL_systimer.c
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/video/uikit/SDL_uikitmessagebox.m
Expand Up @@ -55,7 +55,7 @@ - (id)initWithButtonIndex:(int *)buttonIndex

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;
{
*clickedButtonIndex = buttonIndex;
*clickedButtonIndex = (int)buttonIndex;
}

@end /* UIKit_UIAlertViewDelegate */
Expand Down
8 changes: 4 additions & 4 deletions src/video/uikit/SDL_uikitview.m
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 7187b74

Please sign in to comment.