From 223448d943044947112fb7ed3f1fa04a3c1591a1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 9 Nov 2013 01:37:34 +0100 Subject: [PATCH] (Apple) Build fix for platforms where we have ARC enabled - can't use NSAutoreleasePool directly it seems --- apple/common/RAGameView.m | 14 ++++++++++++++ gfx/gl.c | 2 ++ 2 files changed, 16 insertions(+) diff --git a/apple/common/RAGameView.m b/apple/common/RAGameView.m index 2e0b832cb3..710026a583 100644 --- a/apple/common/RAGameView.m +++ b/apple/common/RAGameView.m @@ -242,6 +242,19 @@ static bool g_is_syncing = true; static RAScreen* get_chosen_screen() { +#if __has_feature(objc_arc) + @autoreleasepool { + if (g_settings.video.monitor_index >= RAScreen.screens.count) + { + RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n"); + return RAScreen.mainScreen; + } + + NSArray *screens = [RAScreen screens]; + RAScreen *s = (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index]; + return s; + } +#else NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; if (g_settings.video.monitor_index >= RAScreen.screens.count) @@ -255,6 +268,7 @@ static RAScreen* get_chosen_screen() RAScreen *s = (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index]; [pool drain]; return s; +#endif } bool apple_gfx_ctx_init() diff --git a/gfx/gl.c b/gfx/gl.c index 524d75f966..8a7cb9d9ad 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1199,6 +1199,7 @@ static void gl_init_textures(void *data, const video_info_t *video) static inline void gl_copy_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch) { unsigned h; + (void)h; gl_t *gl = (gl_t*)data; #if defined(HAVE_OPENGLES2) #if defined(HAVE_EGL) @@ -2335,6 +2336,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer) { unsigned i; gl_t *gl = (gl_t*)data; + (void)i; RARCH_PERFORMANCE_INIT(read_viewport); RARCH_PERFORMANCE_START(read_viewport);