Merge pull request #1150 from lioncash/osx

Fix some warnings on OSX.
This commit is contained in:
Twinaphex 2014-10-14 17:04:33 +02:00
commit c20b5357c6
3 changed files with 31 additions and 41 deletions

View File

@ -32,13 +32,10 @@ static void* const associated_core_key = (void*)&associated_core_key;
- (void)sendEvent:(NSEvent *)event
{
int i;
NSEventType event_type;
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
[super sendEvent:event];
event_type = event.type;
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
NSEventType event_type = event.type;
switch ((NSInteger)event_type)
{
@ -53,7 +50,7 @@ static void* const associated_core_key = (void*)&associated_core_key;
{
apple_input_keyboard_event(event_type == NSKeyDown, event.keyCode, [ch characterAtIndex:0], event.modifierFlags);
for (i = 1; i < ch.length; i ++)
for (NSUInteger i = 1; i < ch.length; i ++)
apple_input_keyboard_event(event_type == NSKeyDown, 0, [ch characterAtIndex:i], event.modifierFlags);
}
}
@ -133,14 +130,9 @@ static char** waiting_argv;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSComboBox* cb;
const core_info_list_t* core_list;
int i;
const char *paths;
apple_platform = self;
paths = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject] UTF8String];
const char* paths = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject] UTF8String];
fill_pathname_join(g_defaults.core_dir, NSBundle.mainBundle.bundlePath.UTF8String, "Contents/Resources/modules", sizeof(g_defaults.core_dir));
fill_pathname_join(g_defaults.menu_config_dir, paths, "RetroArch", sizeof(g_defaults.menu_config_dir));
@ -162,12 +154,12 @@ static char** waiting_argv;
// Warn if there are no cores present
core_info_set_core_path();
core_list = (const core_info_list_t*)core_info_list_get();
const core_info_list_t* core_list = (const core_info_list_t*)core_info_list_get();
// Create core select list
cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
NSComboBox* cb = (NSComboBox*)[[self.coreSelectSheet contentView] viewWithTag:1];
for (i = 0; core_list && i < core_list->count; i ++)
for (size_t i = 0; core_list && i < core_list->count; i ++)
{
NSString* desc = (NSString*)BOXSTRING(core_list->list[i].display_name);
#if defined(MAC_OS_X_VERSION_10_6)

View File

@ -60,14 +60,14 @@ static void* const associated_name_tag = (void*)&associated_name_tag;
- (void)checkBind:(NSTimer*)send
{
int32_t value = 0;
int32_t index = _setting->index ? _setting->index - 1 : 0;
int32_t index = self.setting->index ? self.setting->index - 1 : 0;
if ((value = apple_input_find_any_key()))
BINDFOR(*_setting).key = input_translate_keysym_to_rk(value);
BINDFOR(*[self setting]).key = input_translate_keysym_to_rk(value);
else if ((value = apple_input_find_any_button(index)) >= 0)
BINDFOR(*_setting).joykey = value;
BINDFOR(*[self setting]).joykey = value;
else if ((value = apple_input_find_any_axis(index)))
BINDFOR(*_setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1);
BINDFOR(*[self setting]).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1);
else
return;
@ -123,14 +123,13 @@ NSWindowDelegate>
- (void)awakeFromNib
{
int i;
const rarch_setting_t *setting_data;
NSMutableArray* thisGroup = nil;
NSMutableArray* thisSubGroup = nil;
self.settings = [NSMutableArray array];
setting_data = (const rarch_setting_t *)driver.menu->list_settings;
for (i = 0; setting_data[i].type; i ++)
for (int i = 0; setting_data[i].type; i ++)
{
switch (setting_data[i].type)
{
@ -139,7 +138,7 @@ NSWindowDelegate>
thisGroup = [NSMutableArray array];
#if defined(MAC_OS_X_VERSION_10_6)
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
objc_setAssociatedObject(thisGroup, associated_name_tag, [NSString stringWithFormat:BOXSTRING("%s"), setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject(thisGroup, associated_name_tag, BOXSTRING(setting_data[i].name), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
#endif
break;
}
@ -157,7 +156,7 @@ NSWindowDelegate>
thisSubGroup = [NSMutableArray array];
#if defined(MAC_OS_X_VERSION_10_6)
/* FIXME - Rewrite this so that this is no longer an associated object - requires ObjC 2.0 runtime */
objc_setAssociatedObject(thisSubGroup, associated_name_tag, [NSString stringWithFormat:BOXSTRING("%s"), setting_data[i].name], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject(thisSubGroup, associated_name_tag, BOXSTRING(setting_data[i].name), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
#endif
break;
}

View File

@ -64,11 +64,10 @@ void apple_display_alert(const char *message, const char *title)
- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
{
NSUInteger i;
bool hasDot = false;
if (partialString.length)
for (i = 0; i < partialString.length; i ++)
for (NSUInteger i = 0; i < partialString.length; i ++)
{
unichar ch = [partialString characterAtIndex:i];