From 0e45b112463fc70f27cba27bdca8c0603c6dfa2d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 19 Apr 2014 20:16:29 +0200 Subject: [PATCH] (Apple) Style nits --- apple/common/RAGameView.m | 34 +++++++------- apple/common/apple_gamecontroller.h | 4 +- apple/common/apple_gamecontroller.m | 10 ++--- apple/common/main.m | 8 ++-- apple/common/utility.m | 6 +-- apple/iOS/browser.m | 2 +- apple/iOS/menu.m | 70 +++++++++++++++-------------- apple/iOS/platform.m | 31 ++++++------- performance.c | 2 +- 9 files changed, 86 insertions(+), 81 deletions(-) diff --git a/apple/common/RAGameView.m b/apple/common/RAGameView.m index 7631e5c64f..d6d8ebb006 100644 --- a/apple/common/RAGameView.m +++ b/apple/common/RAGameView.m @@ -243,7 +243,7 @@ void event_process_camera_frame(void* pixelBufferPtr) { CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)pixelBufferPtr; - int width, height; + size_t width, height; CVReturn ret; width = CVPixelBufferGetWidth(pixelBuffer); @@ -257,7 +257,7 @@ void event_process_camera_frame(void* pixelBufferPtr) // textureCache will be what you previously made with CVOpenGLESTextureCacheCreate ret = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault, textureCache, pixelBuffer, NULL, GL_TEXTURE_2D, - GL_RGBA, width, height, GL_BGRA, GL_UNSIGNED_BYTE, 0, &renderTexture); + GL_RGBA, (GLsizei)width, (GLsizei)height, GL_BGRA, GL_UNSIGNED_BYTE, 0, &renderTexture); if (!renderTexture || ret) { RARCH_ERR("ioscamera: CVOpenGLESTextureCacheCreateTextureFromImage failed.\n"); @@ -289,7 +289,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection { // TODO: Don't post if event queue is full - CVPixelBufferRef pixelBuffer = CVPixelBufferRetain(CMSampleBufferGetImageBuffer(sampleBuffer)); + CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CVPixelBufferRetain(CMSampleBufferGetImageBuffer(sampleBuffer)); event_process_camera_frame(pixelBuffer); } @@ -320,13 +320,13 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer [_session setSessionPreset:_sessionPreset]; //-- Creata a video device and input from that Device. Add the input to the capture session. - AVCaptureDevice * videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; + AVCaptureDevice * videoDevice = (AVCaptureDevice*)[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; if(videoDevice == nil) assert(0); //-- Add the device to the session. NSError *error; - AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error]; + AVCaptureDeviceInput *input = (AVCaptureDeviceInput*)[AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error]; if(error) { RARCH_ERR("video device input %s\n", error.localizedDescription.UTF8String); @@ -336,7 +336,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer [_session addInput:input]; //-- Create the output for the capture session. - AVCaptureVideoDataOutput * dataOutput = [[AVCaptureVideoDataOutput alloc] init]; + AVCaptureVideoDataOutput * dataOutput = (AVCaptureVideoDataOutput*)[[AVCaptureVideoDataOutput alloc] init]; [dataOutput setAlwaysDiscardsLateVideoFrames:NO]; // Probably want to set this to NO when recording [dataOutput setVideoSettings:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey]]; @@ -391,7 +391,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { locationChanged = true; - CLLocation *location = [locations objectAtIndex:([locations count] - 1)]; + CLLocation *location = (CLLocation*)[locations objectAtIndex:([locations count] - 1)]; currentLatitude = [location coordinate].latitude; currentLongitude = [location coordinate].longitude; currentHorizontalAccuracy = [location horizontalAccuracy]; @@ -441,7 +441,7 @@ static RAScreen* get_chosen_screen(void) } #endif - NSArray *screens = [RAScreen screens]; + NSArray *screens = (NSArray*)RAScreen.screens; return (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index]; } @@ -551,24 +551,24 @@ bool apple_gfx_ctx_set_video_mode(void *data, unsigned width, unsigned height, b void apple_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height) { (void)data; - RAScreen* screen = get_chosen_screen(); + RAScreen* screen = (RAScreen*)get_chosen_screen(); CGRect size; if (g_initialized) { #if defined(OSX) - CGRect cgrect = NSRectToCGRect([g_view frame]); + CGRect cgrect = (CGRect)NSRectToCGRect([g_view frame]); size = CGRectMake(0, 0, CGRectGetWidth(cgrect), CGRectGetHeight(cgrect)); #else - size = [g_view bounds]; + size = g_view.bounds; #endif } else - size = [screen bounds]; + size = screen.bounds; - *width = CGRectGetWidth(size) * [screen scale]; - *height = CGRectGetHeight(size) * [screen scale]; + *width = CGRectGetWidth(size) * screen.scale; + *height = CGRectGetHeight(size) * screen.scale; } void apple_gfx_ctx_update_window_title(void *data) @@ -767,10 +767,10 @@ static bool apple_location_get_position(void *data, double *lat, double *lon, do if (!ret) goto fail; - *lat = currentLatitude; - *lon = currentLongitude; + *lat = currentLatitude; + *lon = currentLongitude; *horiz_accuracy = currentHorizontalAccuracy; - *vert_accuracy = currentVerticalAccuracy; + *vert_accuracy = currentVerticalAccuracy; return true; fail: diff --git a/apple/common/apple_gamecontroller.h b/apple/common/apple_gamecontroller.h index 54d0f27390..3509297709 100644 --- a/apple/common/apple_gamecontroller.h +++ b/apple/common/apple_gamecontroller.h @@ -16,7 +16,7 @@ #ifndef __APPLE_RARCH_GAMECONTROLLER_H__ #define __APPLE_RARCH_GAMECONTROLLER_H__ -void apple_gamecontroller_init(); -void apple_gamecontroller_poll_all(); +void apple_gamecontroller_init(void); +void apple_gamecontroller_poll_all(void); #endif diff --git a/apple/common/apple_gamecontroller.m b/apple/common/apple_gamecontroller.m index a6608f4374..faf6cd683f 100644 --- a/apple/common/apple_gamecontroller.m +++ b/apple/common/apple_gamecontroller.m @@ -41,7 +41,7 @@ static void apple_gamecontroller_poll(GCController* controller) if (controller.extendedGamepad) { - GCExtendedGamepad* gp = controller.extendedGamepad; + GCExtendedGamepad* gp = (GCExtendedGamepad*)controller.extendedGamepad; g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.up) ? 1 : 0; g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.down) ? 2 : 0; g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.left) ? 4 : 0; @@ -62,7 +62,7 @@ static void apple_gamecontroller_poll(GCController* controller) } else if (controller.gamepad) { - GCGamepad* gp = controller.gamepad; + GCGamepad* gp = (GCGamepad*)controller.gamepad; g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.up) ? 1 : 0; g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.down) ? 2 : 0; g_current_input_data.pad_buttons[slot] |= IS_PRESSED(gp.dpad.left) ? 4 : 0; @@ -82,9 +82,9 @@ void apple_gamecontroller_poll_all(void) if (IOS_IS_VERSION_6_OR_LOWER()) return; #endif - NSArray* controllers = [GCController controllers]; + NSArray* controllers = (NSArray*)GCController.controllers; - for (int i = 0; i != [controllers count]; i ++) + for (int i = 0; i < controllers.count; i ++) apple_gamecontroller_poll([controllers objectAtIndex:i]); } @@ -118,7 +118,7 @@ void apple_gamecontroller_disconnect(GCController* controller) if (controller.playerIndex == GCControllerPlayerIndexUnset) return; - apple_joypad_disconnect((uint32_t)(controller.playerIndex)); + apple_joypad_disconnect((uint32_t)controller.playerIndex); } void apple_gamecontroller_init(void) diff --git a/apple/common/main.m b/apple/common/main.m index 40df9d55d3..40fd40bb36 100644 --- a/apple/common/main.m +++ b/apple/common/main.m @@ -33,9 +33,9 @@ NSString* apple_core; static CFRunLoopObserverRef iterate_observer; -static void apple_rarch_exited() +static void apple_rarch_exited(void) { - NSString* used_core = apple_core; + NSString* used_core = (NSString*)apple_core; apple_core = 0; if (apple_is_running) @@ -68,7 +68,7 @@ static void do_iteration() CFRunLoopWakeUp(CFRunLoopGetMain()); } -void apple_start_iteration() +void apple_start_iteration(void) { if (iterate_observer) return; @@ -77,7 +77,7 @@ void apple_start_iteration() CFRunLoopAddObserver(CFRunLoopGetMain(), iterate_observer, kCFRunLoopCommonModes); } -void apple_stop_iteration() +void apple_stop_iteration(void) { if (!iterate_observer) return; diff --git a/apple/common/utility.m b/apple/common/utility.m index a3b6d246b4..4d336d59a3 100644 --- a/apple/common/utility.m +++ b/apple/common/utility.m @@ -49,7 +49,7 @@ NSString* objc_get_value_from_config(config_file_t* config, NSString* name, NSSt { char* data = 0; if (config) - config_get_string(config, [name UTF8String], &data); + config_get_string(config, name.UTF8String, &data); NSString* result = data ? BOXSTRING(data) : defaultValue; free(data); @@ -65,7 +65,7 @@ NSString *apple_get_core_id(const core_info_t *core) NSString *apple_get_core_display_name(NSString *core_id) { - const core_info_t *core = apple_core_info_list_get_by_id([core_id UTF8String]); + const core_info_t *core = (const core_info_t*)apple_core_info_list_get_by_id(core_id.UTF8String); return core ? BOXSTRING(core->display_name) : core_id; } @@ -110,7 +110,7 @@ NSString *apple_get_core_display_name(NSString *core_id) #ifdef IOS - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { - NSString* text = [[textField text] stringByReplacingCharactersInRange:range withString:string]; + NSString* text = (NSString*)[[textField text] stringByReplacingCharactersInRange:range withString:string]; return [self isPartialStringValid:text newEditingString:nil errorDescription:nil]; } #endif diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index 42d3471b84..4a03a2540c 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -385,7 +385,7 @@ static void file_action(enum file_action action, NSString* source, NSString* tar NSString* text = [alertView textFieldAtIndex:0].text; if (text.length) - file_action(alertView.tag, self.selectedItem.path, [_path stringByAppendingPathComponent:text]); + file_action((enum file_action)alertView.tag, self.selectedItem.path, [_path stringByAppendingPathComponent:text]); } [self browseTo:_path]; diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index 6b91268fe8..25f33f0ff8 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -191,10 +191,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, U { switch (setting->type) { - case ST_BOOL: return [[RAMenuItemBooleanSetting alloc] initWithSetting:setting]; - case ST_PATH: return [[RAMenuItemPathSetting alloc] initWithSetting:setting]; - case ST_BIND: return [[RAMenuItemBindSetting alloc] initWithSetting:setting]; - default: break; + case ST_BOOL: + return [[RAMenuItemBooleanSetting alloc] initWithSetting:setting]; + case ST_PATH: + return [[RAMenuItemPathSetting alloc] initWithSetting:setting]; + case ST_BIND: + return [[RAMenuItemBindSetting alloc] initWithSetting:setting]; + default: + break; } if (setting->type == ST_STRING && setting->values) @@ -260,7 +264,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - NSString* text = [alertView textFieldAtIndex:0].text; + NSString* text = (NSString*)[alertView textFieldAtIndex:0].text; if (buttonIndex == alertView.firstOtherButtonIndex && text.length) { @@ -283,7 +287,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U { RAMenuItemGeneralSetting __weak* weakSelf = self; - struct string_list* items = string_split("OK", "|"); + struct string_list* items = (struct string_list*)string_split("OK", "|"); RunActionSheet("Really Reset Value?", items, self.parentTable, ^(UIActionSheet* actionSheet, NSInteger buttonIndex) { @@ -316,7 +320,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U { static NSString* const cell_id = @"boolean_setting"; - UITableViewCell* result = [tableView dequeueReusableCellWithIdentifier:cell_id]; + UITableViewCell* result = (UITableViewCell*)[tableView dequeueReusableCellWithIdentifier:cell_id]; if (!result) { result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cell_id]; @@ -423,11 +427,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (void)wasSelectedOnTableView:(UITableView *)tableView ofController:(UIViewController *)controller { - self.alert = [[UIAlertView alloc] initWithTitle:@"RetroArch" + self.alert = [[UIAlertView alloc] initWithTitle:BOXSTRING("RetroArch") message:BOXSTRING(self.setting->short_description) delegate:self - cancelButtonTitle:@"Cancel" - otherButtonTitles:@"Clear Keyboard", @"Clear Joystick", @"Clear Axis", nil]; + cancelButtonTitle:BOXSTRING("Cancel") + otherButtonTitles:BOXSTRING("Clear Keyboard"), BOXSTRING("Clear Joystick"), BOXSTRING("Clear Axis"), nil]; [self.alert show]; @@ -493,7 +497,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (id)init { if ((self = [super initWithStyle:UITableViewStylePlain])) - self.title = @"RetroArch"; + self.title = BOXSTRING("RetroArch"); return self; } @@ -563,7 +567,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U action: ^(NSString* core) { if (path) - apple_run_core(core, [path UTF8String]); + apple_run_core(core, path.UTF8String); else { weakSelf.core = core; @@ -587,7 +591,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U if (item && !item.isDirectory) { if (weakSelf.core) - apple_run_core(weakSelf.core, [item.path UTF8String]); + apple_run_core(weakSelf.core, item.path.UTF8String); else [weakSelf chooseCoreWithPath:item.path]; } @@ -712,24 +716,24 @@ static void RunActionSheet(const char* title, const struct string_list* items, U if ((self = [super initWithStyle:UITableViewStyleGrouped])) { - _isCustom = apple_core_info_has_custom_config([core UTF8String]); + _isCustom = apple_core_info_has_custom_config(core.UTF8String); if (_isCustom) { self.title = apple_get_core_display_name(core); - _pathToSave = BOXSTRING(apple_core_info_get_custom_config([core UTF8String], buffer, sizeof(buffer))); + _pathToSave = BOXSTRING(apple_core_info_get_custom_config(core.UTF8String, buffer, sizeof(buffer))); self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(deleteCustom)]; } else { - self.title = @"Global Core Config"; + self.title = BOXSTRING("Global Core Config"); _pathToSave = apple_platform.globalConfigFile; } - const rarch_setting_t* setting_data = setting_data_get_list(); + const rarch_setting_t* setting_data = (const rarch_setting_t*)setting_data_get_list(); setting_data_reset(setting_data); - setting_data_load_config_path(setting_data, [_pathToSave UTF8String]); + setting_data_load_config_path(setting_data, _pathToSave.UTF8String); // HACK: Load the key mapping table apple_input_find_any_key(); @@ -770,7 +774,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U { if (self.pathToSave) { - config_file_t* config = config_file_new([self.pathToSave UTF8String]); + config_file_t* config = (config_file_t*)config_file_new(self.pathToSave.UTF8String); if (!config) config = config_file_new(0); @@ -779,7 +783,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U config_set_string(config, "system_directory", [[RetroArch_iOS get].systemDirectory UTF8String]); config_set_string(config, "savefile_directory", [[RetroArch_iOS get].systemDirectory UTF8String]); config_set_string(config, "savestate_directory", [[RetroArch_iOS get].systemDirectory UTF8String]); - config_file_write(config, [self.pathToSave UTF8String]); + config_file_write(config, self.pathToSave.UTF8String); config_file_free(config); apple_refresh_config(); @@ -819,7 +823,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U { RAFrontendSettingsMenu* __weak weakSelf = self; - self.title = @"Frontend Settings"; + self.title = BOXSTRING("Frontend Settings"); RAMenuItemBasic* diagnostic_item = [RAMenuItemBasic itemWithDescription:@"Diagnostic Log" action:^{ [weakSelf.navigationController pushViewController:[[RALogMenu alloc] initWithFile:[[RetroArch_iOS get].logPath UTF8String]] animated:YES]; }]; @@ -840,7 +844,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (void)willReloadData { RAFrontendSettingsMenu* __weak weakSelf = self; - NSMutableArray* cores = self.coreConfigOptions; + NSMutableArray* cores = (NSMutableArray*)self.coreConfigOptions; [cores removeAllObjects]; @@ -854,8 +858,8 @@ static void RunActionSheet(const char* title, const struct string_list* items, U const core_info_list_t* core_list = apple_core_info_list_get(); for (int i = 0; i < core_list->count; i ++) { - NSString* core_id = apple_get_core_id(&core_list->list[i]); - if (apple_core_info_has_custom_config([core_id UTF8String])) + NSString* core_id = (NSString*)apple_get_core_id(&core_list->list[i]); + if (apple_core_info_has_custom_config(core_id.UTF8String)) { [cores addObject:[RAMenuItemBasic itemWithDescription:BOXSTRING(core_list->list[i].display_name) association:core_id @@ -882,10 +886,10 @@ static void RunActionSheet(const char* title, const struct string_list* items, U RAMenuCoreList* list = [[RAMenuCoreList alloc] initWithPath:nil allowAutoDetect:false action:^(NSString* core) { - if (!apple_core_info_has_custom_config([core UTF8String])) + if (!apple_core_info_has_custom_config(core.UTF8String)) { char path[PATH_MAX]; - apple_core_info_get_custom_config([core UTF8String], path, sizeof(path)); + apple_core_info_get_custom_config(core.UTF8String, path, sizeof(path)); if (![[NSFileManager defaultManager] copyItemAtPath:apple_platform.globalConfigFile toPath:BOXSTRING(path) error:nil]) RARCH_WARN("Could not create custom config at %s", path); @@ -914,9 +918,9 @@ static void RunActionSheet(const char* title, const struct string_list* items, U if ((self = [super initWithStyle:UITableViewStyleGrouped])) { RACoreOptionsMenu* __weak weakSelf = self; - core_option_manager_t* options = g_extern.system.core_options; + core_option_manager_t* options = (core_option_manager_t*)g_extern.system.core_options; - NSMutableArray* section = [NSMutableArray arrayWithObject:@""]; + NSMutableArray* section = (NSMutableArray*)[NSMutableArray arrayWithObject:@""]; [self.sections addObject:section]; if (options) @@ -1011,7 +1015,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U { if ((self = [super initWithStyle:UITableViewStyleGrouped])) { - self.title = @"Choose Core"; + self.title = BOXSTRING("Choose Core"); _action = action; _path = path; @@ -1022,7 +1026,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U action: ^{ if(weakSelf.action) weakSelf.action(nil); }]]]; } - NSMutableArray* core_section = [NSMutableArray arrayWithObject:@"Cores"]; + NSMutableArray* core_section = (NSMutableArray*)[NSMutableArray arrayWithObject:@"Cores"]; [self.sections addObject:core_section]; core_info_list_t* core_list = apple_core_info_list_get(); @@ -1037,11 +1041,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, U if (core_count == 1 && _action) [self runAction:apple_get_core_id(&core_support[0])]; else if (core_count > 1) - [self load:core_count coresFromList:core_support toSection:core_section]; + [self load:(uint32_t)core_count coresFromList:core_support toSection:core_section]; } if (!_path || [core_section count] == 1) - [self load:core_list->count coresFromList:core_list->list toSection:core_section]; + [self load:(uint32_t)core_list->count coresFromList:core_list->list toSection:core_section]; } } @@ -1130,7 +1134,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U + (void)changed:(UISegmentedControl*)sender { - g_extern.state_slot = sender.selectedSegmentIndex; + g_extern.state_slot = (int)sender.selectedSegmentIndex; } - (void)wasSelectedOnTableView:(UITableView *)tableView ofController:(UIViewController *)controller diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m index 1f04da40b4..eae25ae3db 100644 --- a/apple/iOS/platform.m +++ b/apple/iOS/platform.m @@ -114,7 +114,7 @@ void ios_set_logging_state(const char *log_path, bool on) // Input helpers: This is kept here because it needs objective-c static void handle_touch_event(NSArray* touches) { - const int numTouches = [touches count]; + unsigned long numTouches = touches.count; const float scale = [[UIScreen mainScreen] scale]; g_current_input_data.touch_count = 0; @@ -123,12 +123,12 @@ static void handle_touch_event(NSArray* touches) { UITouch* touch = [touches objectAtIndex:i]; - if ([touch view] != [RAGameView get].view) + if (touch.view != [RAGameView get].view) continue; const CGPoint coord = [touch locationInView:[touch view]]; - if ([touch phase] != UITouchPhaseEnded && [touch phase] != UITouchPhaseCancelled) + if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled) { g_current_input_data.touches[g_current_input_data.touch_count ].screen_x = coord.x * scale; g_current_input_data.touches[g_current_input_data.touch_count ++].screen_y = coord.y * scale; @@ -161,23 +161,23 @@ static void handle_touch_event(NSArray* touches) // but is bad for business with events. static double last_time_stamp; - if (last_time_stamp == [event timestamp]) + if (last_time_stamp == event.timestamp) return [super _keyCommandForEvent:event]; - last_time_stamp = [event timestamp]; + last_time_stamp = event.timestamp; // If the _hidEvent is null, [event _keyCode] will crash. (This happens with the on screen keyboard.) - if ([event _hidEvent]) + if (event._hidEvent) { - NSString* ch = [event _privateInput]; + NSString* ch = (NSString*)event._privateInput; if (!ch || [ch length] == 0) - apple_input_keyboard_event([event _isKeyDown], [event _keyCode], 0, [event _modifierFlags]); + apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, 0, (uint32_t)event._modifierFlags); else { - apple_input_keyboard_event([event _isKeyDown], [event _keyCode], [ch characterAtIndex:0], [event _modifierFlags]); + apple_input_keyboard_event(event._isKeyDown, (uint32_t)event._keyCode, [ch characterAtIndex:0], (uint32_t)event._modifierFlags); for (unsigned i = 1; i != [ch length]; i ++) - apple_input_keyboard_event([event _isKeyDown], 0, [ch characterAtIndex:i], [event _modifierFlags]); + apple_input_keyboard_event(event._isKeyDown, 0, [ch characterAtIndex:i], (uint32_t)event._modifierFlags); } } @@ -188,8 +188,8 @@ static void handle_touch_event(NSArray* touches) { [super sendEvent:event]; - if ([[event allTouches] count]) - handle_touch_event([[event allTouches] allObjects]); + if (event.allTouches.count) + handle_touch_event(event.allTouches.allObjects); if (!(IOS_IS_VERSION_7_OR_HIGHER()) && [event respondsToSelector:@selector(_gsEvent)]) { @@ -252,7 +252,8 @@ static void handle_touch_event(NSArray* touches) // Warn if there are no cores present apple_core_info_set_core_path([self.coreDirectory UTF8String]); apple_core_info_set_config_path([self.configDirectory UTF8String]); - const core_info_list_t* core_list = apple_core_info_list_get(); + + const core_info_list_t* core_list = (const core_info_list_t*)apple_core_info_list_get(); if (!core_list || core_list->count == 0) apple_display_alert(@"No libretro cores were found. You will not be able to run any content.", 0); @@ -260,7 +261,7 @@ static void handle_touch_event(NSArray* touches) apple_gamecontroller_init(); // Load system config - const rarch_setting_t* frontend_settings = apple_get_frontend_settings(); + const rarch_setting_t* frontend_settings = (const rarch_setting_t*)apple_get_frontend_settings(); setting_data_reset(frontend_settings); setting_data_load_config_path(frontend_settings, [self.systemConfigPath UTF8String]); } @@ -277,7 +278,7 @@ static void handle_touch_event(NSArray* touches) -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { - NSString* filename = [[url path] lastPathComponent]; + NSString* filename = (NSString*)url.path.lastPathComponent; NSError* error = nil; [[NSFileManager defaultManager] moveItemAtPath:[url path] toPath:[self.documentsDirectory stringByAppendingPathComponent:filename] error:&error]; diff --git a/performance.c b/performance.c index 0f5bdf3fbb..8471441d10 100644 --- a/performance.c +++ b/performance.c @@ -306,7 +306,7 @@ unsigned rarch_get_cpu_cores(void) #elif defined(_SC_NPROCESSORS_ONLN) // Linux, most unix-likes. long ret = sysconf(_SC_NPROCESSORS_ONLN); if (ret <= 0) - return 1; + return (unsigned)1; return ret; #elif defined(BSD) || defined(__APPLE__) // BSD // Copypasta from stackoverflow, dunno if it works.