Browse Source

Minor tidying up in OSX URL code.

tags/2021-05-28
jules 13 years ago
parent
commit
4302cd78ec
1 changed files with 9 additions and 20 deletions
  1. +9
    -20
      modules/juce_core/native/juce_mac_Network.mm

+ 9
- 20
modules/juce_core/native/juce_mac_Network.mm View File

@@ -220,20 +220,12 @@ public:
void run()
{
NSUInteger oldRetainCount = [delegate retainCount];
connection = [[NSURLConnection alloc] initWithRequest: request
delegate: delegate];
if (oldRetainCount == [delegate retainCount])
[delegate retain]; // newer SDK should already retain this, but there were problems in older versions..
if (connection != nil)
while (! threadShouldExit())
{
while (! threadShouldExit())
{
JUCE_AUTORELEASEPOOL
[[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.01]];
}
JUCE_AUTORELEASEPOOL
[[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.01]];
}
}
@@ -304,17 +296,14 @@ public:
JUCE_AUTORELEASEPOOL
createConnection (progressCallback, progressCallbackContext);
if (responseHeaders != nullptr && connection != nullptr)
if (responseHeaders != nullptr && connection != nullptr && connection->headers != nil)
{
if (connection->headers != nil)
{
NSEnumerator* enumerator = [connection->headers keyEnumerator];
NSString* key;
NSEnumerator* enumerator = [connection->headers keyEnumerator];
NSString* key;
while ((key = [enumerator nextObject]) != nil)
responseHeaders->set (nsStringToJuce (key),
nsStringToJuce ((NSString*) [connection->headers objectForKey: key]));
}
while ((key = [enumerator nextObject]) != nil)
responseHeaders->set (nsStringToJuce (key),
nsStringToJuce ((NSString*) [connection->headers objectForKey: key]));
}
}


Loading…
Cancel
Save