Enable more compiler warnings in the Xcode projects (based on Xcode 8's suggestion), made some integer downcasts explicit.

This commit is contained in:
Alex Szpakowski
2016-09-13 19:51:10 -03:00
parent 00791f3a87
commit 86708c3cd8
5 changed files with 84 additions and 16 deletions

View File

@@ -112,7 +112,7 @@
_markedRange = NSMakeRange(0, [aString length]);
SDL_SendEditingText([aString UTF8String],
selectedRange.location, selectedRange.length);
(int) selectedRange.location, (int) selectedRange.length);
DEBUG_IME(@"setMarkedText: %@, (%d, %d)", _markedText,
selRange.location, selRange.length);

View File

@@ -103,10 +103,10 @@ static SDL_bool
GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_DisplayMode *mode)
{
SDL_DisplayModeData *data;
long width = 0;
long height = 0;
long bpp = 0;
long refreshRate = 0;
int width = 0;
int height = 0;
int bpp = 0;
int refreshRate = 0;
CFStringRef fmt;
data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data));
@@ -116,9 +116,9 @@ GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_Displ
data->moderef = vidmode;
fmt = CGDisplayModeCopyPixelEncoding(vidmode);
width = (long) CGDisplayModeGetWidth(vidmode);
height = (long) CGDisplayModeGetHeight(vidmode);
refreshRate = (long) (CGDisplayModeGetRefreshRate(vidmode) + 0.5);
width = (int) CGDisplayModeGetWidth(vidmode);
height = (int) CGDisplayModeGetHeight(vidmode);
refreshRate = (int) (CGDisplayModeGetRefreshRate(vidmode) + 0.5);
if (CFStringCompare(fmt, CFSTR(IO32BitDirectPixels),
kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
@@ -139,7 +139,7 @@ GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_Displ
if (refreshRate == 0 && link != NULL) {
CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
if ((time.flags & kCVTimeIsIndefinite) == 0 && time.timeValue != 0) {
refreshRate = (long) ((time.timeScale / (double) time.timeValue) + 0.5);
refreshRate = (int) ((time.timeScale / (double) time.timeValue) + 0.5);
}
}
@@ -320,8 +320,8 @@ Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdp
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
CGSize displaySize = CGDisplayScreenSize(data->display);
size_t pixelWidth = CGDisplayPixelsWide(data->display);
size_t pixelHeight = CGDisplayPixelsHigh(data->display);
int pixelWidth = (int) CGDisplayPixelsWide(data->display);
int pixelHeight = (int) CGDisplayPixelsHigh(data->display);
if (ddpi) {
*ddpi = SDL_ComputeDiagonalDPI(pixelWidth, pixelHeight, displaySize.width / MM_IN_INCH, displaySize.height / MM_IN_INCH);

View File

@@ -855,7 +855,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
button = SDL_BUTTON_MIDDLE;
break;
default:
button = [theEvent buttonNumber] + 1;
button = (int) [theEvent buttonNumber] + 1;
break;
}
SDL_SendMouseButton(_data->window, 0, SDL_PRESSED, button);
@@ -896,7 +896,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
button = SDL_BUTTON_MIDDLE;
break;
default:
button = [theEvent buttonNumber] + 1;
button = (int) [theEvent buttonNumber] + 1;
break;
}
SDL_SendMouseButton(_data->window, 0, SDL_RELEASED, button);
@@ -1209,7 +1209,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
NSRect rect;
SDL_Rect bounds;
unsigned int style;
NSUInteger style;
NSArray *screens = [NSScreen screens];
Cocoa_GetDisplayBounds(_this, display, &bounds);