Skip to content

Commit 4c0095e

Browse files
committed
Simplify port handling code
1 parent 293aad5 commit 4c0095e

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

Source/GSHTTPURLHandle.m

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,8 +1607,8 @@ - (void) setURL: (NSURL*)newUrl
16071607
- (void) _tryLoadInBackground: (NSURL*)fromURL
16081608
{
16091609
NSNotificationCenter *nc;
1610-
NSString *host = nil;
1611-
NSString *port = nil;
1610+
NSString *host;
1611+
NSString *port;
16121612
NSString *s;
16131613

16141614
/*
@@ -1645,20 +1645,15 @@ - (void) _tryLoadInBackground: (NSURL*)fromURL
16451645
}
16461646

16471647
host = [u host];
1648-
port = (id)[u port];
1649-
if (port != nil)
1648+
if ([u port])
16501649
{
1651-
port = [NSString stringWithFormat: @"%u", [port intValue]];
1650+
port = [NSString stringWithFormat: @"%u", (unsigned)[[u port] intValue]];
16521651
}
1653-
else
1654-
{
1655-
port = [u scheme];
1656-
}
1657-
if ([port isEqualToString: @"https"])
1652+
else if ([[u scheme] isEqualToString: @"https"])
16581653
{
16591654
port = @"443";
16601655
}
1661-
else if ([port isEqualToString: @"http"])
1656+
else
16621657
{
16631658
port = @"80";
16641659
}

0 commit comments

Comments
 (0)