From 013e60204dd49e899eb7b9418771d586aa7f8967 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 13 Mar 2016 23:40:23 -0400 Subject: [PATCH] Don't use subscripting where it may potentially be risky on 10.7 --- Sparkle/Autoupdate/Autoupdate.m | 12 ++++++------ Sparkle/SUAppcast.m | 4 ++-- Sparkle/SUHost.m | 2 +- Sparkle/SUSystemProfiler.m | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Sparkle/Autoupdate/Autoupdate.m b/Sparkle/Autoupdate/Autoupdate.m index ddc60f6c..51b9619a 100644 --- a/Sparkle/Autoupdate/Autoupdate.m +++ b/Sparkle/Autoupdate/Autoupdate.m @@ -247,16 +247,16 @@ int main(int __unused argc, const char __unused *argv[]) NSApplication *application = [NSApplication sharedApplication]; - BOOL shouldShowUI = (args.count > 6) ? [args[6] boolValue] : YES; + BOOL shouldShowUI = (args.count > 6) ? [[args objectAtIndex:6] boolValue] : YES; if (shouldShowUI) { [application activateIgnoringOtherApps:YES]; } - AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostPath:args[1] - relaunchPath:args[2] - parentProcessId:[args[3] intValue] - updateFolderPath:args[4] - shouldRelaunch:(args.count > 5) ? [args[5] boolValue] : YES + AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostPath:[args objectAtIndex:1] + relaunchPath:[args objectAtIndex:2] + parentProcessId:[[args objectAtIndex:3] intValue] + updateFolderPath:[args objectAtIndex:4] + shouldRelaunch:(args.count > 5) ? [[args objectAtIndex:5] boolValue] : YES shouldShowUI:shouldShowUI]; [application setDelegate:appInstaller]; [application run]; diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 54b1d2b7..05cba1cd 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -248,9 +248,9 @@ NSUnderlyingErrorKey: error, }]; - NSURL *failingUrl = error.userInfo[NSURLErrorFailingURLErrorKey]; + NSURL *failingUrl = [error.userInfo objectForKey:NSURLErrorFailingURLErrorKey]; if (failingUrl) { - userInfo[NSURLErrorFailingURLErrorKey] = failingUrl; + [userInfo setObject:failingUrl forKey:NSURLErrorFailingURLErrorKey]; } self.completionBlock([NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastError userInfo:userInfo]); diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index c49ba368..00ba50d1 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -79,7 +79,7 @@ NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *cachePath = nil; if ([cachePaths count]) { - cachePath = cachePaths[0]; + cachePath = [cachePaths objectAtIndex:0]; } if (!cachePath) { SULog(@"Failed to find user's cache directory! Using system default"); diff --git a/Sparkle/SUSystemProfiler.m b/Sparkle/SUSystemProfiler.m index 230c808f..4071da6b 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -115,7 +115,7 @@ static NSString *const SUSystemProfilerPreferredLanguageKey = @"lang"; error = sysctlbyname("hw.model", cpuModel, &length, NULL, 0); if (error == 0) { NSString *rawModelName = @(cpuModel); - NSString *visibleModelName = modelTranslation[rawModelName]; + NSString *visibleModelName = [modelTranslation objectForKey:rawModelName]; if (visibleModelName == nil) { visibleModelName = rawModelName; } @@ -135,7 +135,7 @@ static NSString *const SUSystemProfilerPreferredLanguageKey = @"lang"; NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; NSArray *languages = [defs objectForKey:@"AppleLanguages"]; if ([languages count] > 0) { - [profileArray addObject:[NSDictionary dictionaryWithObjects:@[SUSystemProfilerPreferredLanguageKey, @"Preferred Language", languages[0], languages[0]] forKeys:profileDictKeys]]; + [profileArray addObject:[NSDictionary dictionaryWithObjects:@[SUSystemProfilerPreferredLanguageKey, @"Preferred Language", [languages objectAtIndex:0], [languages objectAtIndex:0]] forKeys:profileDictKeys]]; } // Application sending the request