From 4ad26db45b46d8267fcb5203571b81bc8949b853 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Dec 2014 03:01:19 +0100 Subject: Reformatting code for modern ObjC Replaced all [NSNumber numberWithBool:YES/NO] with the @YES/@NO literals. Also replaced some TRUE/FALSE with their YES/NO counterparts. --- Source/SPWindowManagement.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Source/SPWindowManagement.m') diff --git a/Source/SPWindowManagement.m b/Source/SPWindowManagement.m index 000bbe3f..022ad7fa 100644 --- a/Source/SPWindowManagement.m +++ b/Source/SPWindowManagement.m @@ -117,17 +117,17 @@ // Get the state of the previously-frontmost document NSDictionary *allStateDetails = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:YES], @"connection", - [NSNumber numberWithBool:YES], @"history", - [NSNumber numberWithBool:YES], @"session", - [NSNumber numberWithBool:YES], @"query", - [NSNumber numberWithBool:YES], @"password", + @YES, @"connection", + @YES, @"history", + @YES, @"session", + @YES, @"query", + @YES, @"password", nil]; NSMutableDictionary *frontState = [NSMutableDictionary dictionaryWithDictionary:[theFrontDocument stateIncludingDetails:allStateDetails]]; // Ensure it's set to autoconnect - [frontState setObject:[NSNumber numberWithBool:YES] forKey:@"auto_connect"]; + [frontState setObject:@YES forKey:@"auto_connect"]; // Set the connection on the new tab [[self frontDocument] setState:frontState]; -- cgit v1.2.3 From 3b251b8e3d4dc9a694ef76562b388ab07da54785 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Dec 2014 19:48:41 +0100 Subject: Replace some NSDictionaries with literals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [NSDictionary dictionary] → @{} * [NSDictionary dictionaryWithObject:forKey:] can safely be replaced. object==nil would have already thrown a NPE in the past. * Also replaced some (hopefully safe) NSArray initializers (ie. their objects should always exist). --- Source/SPWindowManagement.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Source/SPWindowManagement.m') diff --git a/Source/SPWindowManagement.m b/Source/SPWindowManagement.m index 022ad7fa..c30a2826 100644 --- a/Source/SPWindowManagement.m +++ b/Source/SPWindowManagement.m @@ -116,13 +116,13 @@ [[[self frontDocumentWindow] windowController] addNewConnection:self]; // Get the state of the previously-frontmost document - NSDictionary *allStateDetails = [NSDictionary dictionaryWithObjectsAndKeys: - @YES, @"connection", - @YES, @"history", - @YES, @"session", - @YES, @"query", - @YES, @"password", - nil]; + NSDictionary *allStateDetails = @{ + @"connection" : @YES, + @"history" : @YES, + @"session" : @YES, + @"query" : @YES, + @"password" : @YES + }; NSMutableDictionary *frontState = [NSMutableDictionary dictionaryWithDictionary:[theFrontDocument stateIncludingDetails:allStateDetails]]; -- cgit v1.2.3