Make files closer to gnustep coding style (automated fixups using uncrustify)

This commit is contained in:
rfm 2024-10-28 11:21:47 +00:00
parent 1cb846e607
commit 316537d67a
5 changed files with 1313 additions and 1181 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,32 +1,32 @@
/**
NSURLSessionConfiguration.m
Copyright (C) 2017-2024 Free Software Foundation, Inc.
Written by: Hugo Melder <hugo@algoriddim.com>
Date: May 2024
Author: Hugo Melder <hugo@algoriddim.com>
This file is part of GNUStep-base
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
If you are interested in a warranty or support for this source code,
contact Scott Christley <scottc@net-community.com> for more information.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
* NSURLSessionConfiguration.m
*
* Copyright (C) 2017-2024 Free Software Foundation, Inc.
*
* Written by: Hugo Melder <hugo@algoriddim.com>
* Date: May 2024
* Author: Hugo Melder <hugo@algoriddim.com>
*
* This file is part of GNUStep-base
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* If you are interested in a warranty or support for this source code,
* contact Scott Christley <scottc@net-community.com> for more information.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110 USA.
*/
#import "Foundation/NSURLSession.h"
#import "Foundation/NSHTTPCookie.h"
@ -35,9 +35,9 @@
@implementation NSURLSessionConfiguration
static NSURLSessionConfiguration *def = nil;
static NSURLSessionConfiguration * def = nil;
+ (void)initialize
+ (void) initialize
{
if (nil == def)
{
@ -45,26 +45,27 @@ static NSURLSessionConfiguration *def = nil;
}
}
+ (NSURLSessionConfiguration *)defaultSessionConfiguration
+ (NSURLSessionConfiguration *) defaultSessionConfiguration
{
return AUTORELEASE([def copy]);
}
+ (NSURLSessionConfiguration *)ephemeralSessionConfiguration
+ (NSURLSessionConfiguration *) ephemeralSessionConfiguration
{
// return default session since we don't store any data on disk anyway
return AUTORELEASE([def copy]);
}
+ (NSURLSessionConfiguration *)backgroundSessionConfigurationWithIdentifier:
+ (NSURLSessionConfiguration *) backgroundSessionConfigurationWithIdentifier:
(NSString *)identifier
{
NSURLSessionConfiguration *configuration = [def copy];
NSURLSessionConfiguration * configuration = [def copy];
configuration->_identifier = [identifier copy];
return AUTORELEASE(configuration);
}
- (instancetype)init
- (instancetype) init
{
if (nil != (self = [super init]))
{
@ -83,7 +84,7 @@ static NSURLSessionConfiguration *def = nil;
return self;
}
- (void)dealloc
- (void) dealloc
{
DESTROY(_identifier);
DESTROY(_HTTPAdditionalHeaders);
@ -94,190 +95,191 @@ static NSURLSessionConfiguration *def = nil;
[super dealloc];
}
- (NSString *)identifier
- (NSString *) identifier
{
return _identifier;
}
- (NSURLCache *)URLCache
- (NSURLCache *) URLCache
{
return _URLCache;
}
- (void)setURLCache:(NSURLCache *)cache
- (void) setURLCache: (NSURLCache *)cache
{
ASSIGN(_URLCache, cache);
}
- (void)setURLCredentialStorage:(NSURLCredentialStorage *)storage
- (void) setURLCredentialStorage: (NSURLCredentialStorage *)storage
{
ASSIGN(_URLCredentialStorage, storage);
}
- (NSURLRequestCachePolicy)requestCachePolicy
- (NSURLRequestCachePolicy) requestCachePolicy
{
return _requestCachePolicy;
}
- (void)setRequestCachePolicy:(NSURLRequestCachePolicy)policy
- (void) setRequestCachePolicy: (NSURLRequestCachePolicy)policy
{
_requestCachePolicy = policy;
}
- (NSArray *)protocolClasses
- (NSArray *) protocolClasses
{
return _protocolClasses;
}
- (NSTimeInterval)timeoutIntervalForRequest
- (NSTimeInterval) timeoutIntervalForRequest
{
return _timeoutIntervalForRequest;
}
- (void)setTimeoutIntervalForRequest:(NSTimeInterval)interval
- (void) setTimeoutIntervalForRequest: (NSTimeInterval)interval
{
_timeoutIntervalForRequest = interval;
}
- (NSTimeInterval)timeoutIntervalForResource
- (NSTimeInterval) timeoutIntervalForResource
{
return _timeoutIntervalForResource;
}
- (void)setTimeoutIntervalForResource:(NSTimeInterval)interval
- (void) setTimeoutIntervalForResource: (NSTimeInterval)interval
{
_timeoutIntervalForResource = interval;
}
- (NSInteger)HTTPMaximumConnectionsPerHost
- (NSInteger) HTTPMaximumConnectionsPerHost
{
return _HTTPMaximumConnectionsPerHost;
}
- (void)setHTTPMaximumConnectionsPerHost:(NSInteger)n
- (void) setHTTPMaximumConnectionsPerHost: (NSInteger)n
{
_HTTPMaximumConnectionsPerHost = n;
}
- (NSInteger)HTTPMaximumConnectionLifetime
- (NSInteger) HTTPMaximumConnectionLifetime
{
return _HTTPMaximumConnectionLifetime;
}
- (void)setHTTPMaximumConnectionLifetime:(NSInteger)n
- (void) setHTTPMaximumConnectionLifetime: (NSInteger)n
{
_HTTPMaximumConnectionLifetime = n;
}
- (BOOL)HTTPShouldUsePipelining
- (BOOL) HTTPShouldUsePipelining
{
return _HTTPShouldUsePipelining;
}
- (void)setHTTPShouldUsePipelining:(BOOL)flag
- (void) setHTTPShouldUsePipelining: (BOOL)flag
{
_HTTPShouldUsePipelining = flag;
}
- (NSHTTPCookieAcceptPolicy)HTTPCookieAcceptPolicy
- (NSHTTPCookieAcceptPolicy) HTTPCookieAcceptPolicy
{
return _HTTPCookieAcceptPolicy;
}
- (void)setHTTPCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
- (void) setHTTPCookieAcceptPolicy: (NSHTTPCookieAcceptPolicy)policy
{
_HTTPCookieAcceptPolicy = policy;
}
- (NSHTTPCookieStorage *)HTTPCookieStorage
- (NSHTTPCookieStorage *) HTTPCookieStorage
{
return _HTTPCookieStorage;
}
- (void)setHTTPCookieStorage:(NSHTTPCookieStorage *)storage
- (void) setHTTPCookieStorage: (NSHTTPCookieStorage *)storage
{
ASSIGN(_HTTPCookieStorage, storage);
}
- (BOOL)HTTPShouldSetCookies
- (BOOL) HTTPShouldSetCookies
{
return _HTTPShouldSetCookies;
}
- (void)setHTTPShouldSetCookies:(BOOL)flag
- (void) setHTTPShouldSetCookies: (BOOL)flag
{
_HTTPShouldSetCookies = flag;
}
- (NSDictionary *)HTTPAdditionalHeaders
- (NSDictionary *) HTTPAdditionalHeaders
{
return _HTTPAdditionalHeaders;
}
- (void)setHTTPAdditionalHeaders:(NSDictionary *)headers
- (void) setHTTPAdditionalHeaders: (NSDictionary *)headers
{
ASSIGN(_HTTPAdditionalHeaders, headers);
}
- (NSURLRequest *)configureRequest:(NSURLRequest *)request
- (NSURLRequest *) configureRequest: (NSURLRequest *)request
{
return [self setCookiesOnRequest:request];
return [self setCookiesOnRequest: request];
}
- (NSURLRequest *)setCookiesOnRequest:(NSURLRequest *)request
- (NSURLRequest *) setCookiesOnRequest: (NSURLRequest *)request
{
NSMutableURLRequest *r = AUTORELEASE([request mutableCopy]);
NSMutableURLRequest * r = AUTORELEASE([request mutableCopy]);
if (_HTTPShouldSetCookies)
{
if (nil != _HTTPCookieStorage && nil != [request URL])
{
NSArray *cookies = [_HTTPCookieStorage cookiesForURL:[request URL]];
NSArray * cookies = [_HTTPCookieStorage cookiesForURL: [request URL]];
if (nil != cookies && [cookies count] > 0)
{
NSDictionary *cookiesHeaderFields;
NSString *cookieValue;
NSDictionary * cookiesHeaderFields;
NSString * cookieValue;
cookiesHeaderFields =
[NSHTTPCookie requestHeaderFieldsWithCookies:cookies];
cookieValue = [cookiesHeaderFields objectForKey:@"Cookie"];
[NSHTTPCookie requestHeaderFieldsWithCookies: cookies];
cookieValue = [cookiesHeaderFields objectForKey: @"Cookie"];
if (nil != cookieValue && [cookieValue length] > 0)
{
[r setValue:cookieValue forHTTPHeaderField:@"Cookie"];
[r setValue: cookieValue forHTTPHeaderField: @"Cookie"];
}
}
}
}
return AUTORELEASE([r copy]);
}
} /* setCookiesOnRequest */
- (NSURLCredentialStorage *)URLCredentialStorage
- (NSURLCredentialStorage *) URLCredentialStorage
{
return _URLCredentialStorage;
}
- (id)copyWithZone:(NSZone *)zone
- (id) copyWithZone: (NSZone *)zone
{
NSURLSessionConfiguration *copy = [[[self class] alloc] init];
NSURLSessionConfiguration * copy = [[[self class] alloc] init];
if (copy)
{
copy->_identifier = [_identifier copy];
copy->_URLCache = [_URLCache copy];
copy->_URLCredentialStorage = [_URLCredentialStorage copy];
copy->_protocolClasses = [_protocolClasses copyWithZone:zone];
copy->_protocolClasses = [_protocolClasses copyWithZone: zone];
copy->_HTTPMaximumConnectionsPerHost = _HTTPMaximumConnectionsPerHost;
copy->_HTTPShouldUsePipelining = _HTTPShouldUsePipelining;
copy->_HTTPCookieAcceptPolicy = _HTTPCookieAcceptPolicy;
copy->_HTTPCookieStorage = [_HTTPCookieStorage retain];
copy->_HTTPShouldSetCookies = _HTTPShouldSetCookies;
copy->_HTTPAdditionalHeaders = [_HTTPAdditionalHeaders copyWithZone:zone];
copy->_HTTPAdditionalHeaders =
[_HTTPAdditionalHeaders copyWithZone: zone];
copy->_timeoutIntervalForRequest = _timeoutIntervalForRequest;
copy->_timeoutIntervalForResource = _timeoutIntervalForResource;
}
return copy;
}
} /* copyWithZone */
@end

View file

@ -1,32 +1,32 @@
/**
NSURLSessionPrivate.h
Copyright (C) 2017-2024 Free Software Foundation, Inc.
Written by: Hugo Melder <hugo@algoriddim.com>
Date: May 2024
Author: Hugo Melder <hugo@algoriddim.com>
This file is part of GNUStep-base
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
If you are interested in a warranty or support for this source code,
contact Scott Christley <scottc@net-community.com> for more information.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
* NSURLSessionPrivate.h
*
* Copyright (C) 2017-2024 Free Software Foundation, Inc.
*
* Written by: Hugo Melder <hugo@algoriddim.com>
* Date: May 2024
* Author: Hugo Melder <hugo@algoriddim.com>
*
* This file is part of GNUStep-base
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* If you are interested in a warranty or support for this source code,
* contact Scott Christley <scottc@net-community.com> for more information.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110 USA.
*/
#import "common.h"
@ -35,7 +35,7 @@
#import <curl/curl.h>
#import <dispatch/dispatch.h>
extern NSString *GS_NSURLSESSION_DEBUG_KEY;
extern NSString * GS_NSURLSESSION_DEBUG_KEY;
/* libcurl may request a full-duplex socket configuration with
* CURL_POLL_INOUT, but libdispatch distinguishes between a read and write
@ -50,7 +50,8 @@ struct SourceInfo
dispatch_source_t writeSocket;
};
typedef NS_ENUM(NSInteger, GSURLSessionProperties) {
typedef NS_ENUM(NSInteger, GSURLSessionProperties)
{
GSURLSessionStoresDataInMemory = (1 << 0),
GSURLSessionWritesDataToFile = (1 << 1),
GSURLSessionUpdatesDelegate = (1 << 2),
@ -59,32 +60,32 @@ typedef NS_ENUM(NSInteger, GSURLSessionProperties) {
};
@interface
NSURLSession (Private)
NSURLSession(Private)
- (dispatch_queue_t)_workQueue;
- (NSData *)_certificateBlob;
- (NSString *)_certificatePath;
-(NSData *)_certificateBlob;
-(NSString *)_certificatePath;
/* Adds the internal easy handle to the multi handle.
* Modifications are performed on the workQueue.
*/
- (void)_resumeTask:(NSURLSessionTask *)task;
-(void)_resumeTask: (NSURLSessionTask *)task;
/* The following methods must only be called from within callbacks dispatched on
* the workQueue.*/
- (void)_setTimer:(NSInteger)timeout;
- (void)_suspendTimer;
-(void)_setTimer: (NSInteger)timeout;
-(void)_suspendTimer;
/* Required for manual redirects.
*/
- (void)_addHandle:(CURL *)easy;
- (void)_removeHandle:(CURL *)easy;
-(void)_addHandle: (CURL *)easy;
-(void)_removeHandle: (CURL *)easy;
- (void)_removeSocket:(struct SourceInfo *)sources;
- (int)_addSocket:(curl_socket_t)socket easyHandle:(CURL *)easy what:(int)what;
- (int)_setSocket:(curl_socket_t)socket
sources:(struct SourceInfo *)sources
what:(int)what;
-(void)_removeSocket: (struct SourceInfo *)sources;
-(int)_addSocket: (curl_socket_t)socket easyHandle: (CURL *)easy what: (int)what;
-(int)_setSocket: (curl_socket_t)socket
sources: (struct SourceInfo *)sources
what: (int)what;
@end

File diff suppressed because it is too large Load diff

View file

@ -1,32 +1,32 @@
/**
NSURLSessionTaskPrivate.h
Copyright (C) 2017-2024 Free Software Foundation, Inc.
Written by: Hugo Melder <hugo@algoriddim.com>
Date: May 2024
Author: Hugo Melder <hugo@algoriddim.com>
This file is part of GNUStep-base
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
If you are interested in a warranty or support for this source code,
contact Scott Christley <scottc@net-community.com> for more information.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
* NSURLSessionTaskPrivate.h
*
* Copyright (C) 2017-2024 Free Software Foundation, Inc.
*
* Written by: Hugo Melder <hugo@algoriddim.com>
* Date: May 2024
* Author: Hugo Melder <hugo@algoriddim.com>
*
* This file is part of GNUStep-base
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* If you are interested in a warranty or support for this source code,
* contact Scott Christley <scottc@net-community.com> for more information.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110 USA.
*/
#import "Foundation/NSDictionary.h"
#import "Foundation/NSFileHandle.h"
@ -34,23 +34,23 @@
#import <curl/curl.h>
@interface
NSURLSessionTask (Private)
NSURLSessionTask(Private)
- (instancetype)initWithSession:(NSURLSession *)session
request:(NSURLRequest *)request
taskIdentifier:(NSUInteger)identifier;
- (instancetype)initWithSession: (NSURLSession *)session
request: (NSURLRequest *)request
taskIdentifier: (NSUInteger)identifier;
- (CURL *)_easyHandle;
-(CURL *)_easyHandle;
/* Enable or disable libcurl verbose output. Disabled by default. */
- (void)_setVerbose:(BOOL)flag;
-(void)_setVerbose: (BOOL)flag;
/* This method is called by -[NSURLSession _checkForCompletion]
*
* We release the session (previously retained in -[NSURLSessionTask resume])
* here and inform the delegate about the transfer state.
*/
- (void)_transferFinishedWithCode:(CURLcode)code;
-(void)_transferFinishedWithCode: (CURLcode)code;
/* Explicitly enable data upload with an optional estimated size. Set to 0 if
* not available.
@ -58,66 +58,66 @@ NSURLSessionTask (Private)
* This may be used when a body stream is passed at a later stage
* (see URLSession:task:needNewBodyStream:).
*/
- (void)_enableUploadWithSize:(NSInteger)size;
- (void)_setBodyStream:(NSInputStream *)stream;
-(void)_enableUploadWithSize: (NSInteger)size;
-(void)_setBodyStream: (NSInputStream *)stream;
- (void)_enableUploadWithData:(NSData *)data;
- (void)_enableAutomaticRedirects:(BOOL)flag;
-(void)_enableUploadWithData: (NSData *)data;
-(void)_enableAutomaticRedirects: (BOOL)flag;
/* Assign with copying */
- (void)_setOriginalRequest:(NSURLRequest *)request;
- (void)_setCurrentRequest:(NSURLRequest *)request;
-(void)_setOriginalRequest: (NSURLRequest *)request;
-(void)_setCurrentRequest: (NSURLRequest *)request;
- (void)_setResponse:(NSURLResponse *)response;
- (void)_setCookiesFromHeaders:(NSDictionary *)headers;
-(void)_setResponse: (NSURLResponse *)response;
-(void)_setCookiesFromHeaders: (NSDictionary *)headers;
- (void)_setCountOfBytesSent:(int64_t)count;
- (void)_setCountOfBytesReceived:(int64_t)count;
- (void)_setCountOfBytesExpectedToSend:(int64_t)count;
- (void)_setCountOfBytesExpectedToReceive:(int64_t)count;
-(void)_setCountOfBytesSent: (int64_t)count;
-(void)_setCountOfBytesReceived: (int64_t)count;
-(void)_setCountOfBytesExpectedToSend: (int64_t)count;
-(void)_setCountOfBytesExpectedToReceive: (int64_t)count;
- (NSMutableDictionary *)_taskData;
-(NSMutableDictionary *)_taskData;
- (NSURLSession *)_session;
-(NSURLSession *)_session;
/* Task specific properties.
*
* See GSURLSessionProperties in NSURLSessionPrivate.h.
*/
- (NSInteger)_properties;
- (void)_setProperties:(NSInteger)properties;
-(NSInteger)_properties;
-(void)_setProperties: (NSInteger)properties;
/* This value is periodically checked in progress_callback.
* We then abort the transfer in the progress_callback if this flag is set.
*/
- (BOOL)_shouldStopTransfer;
- (void)_setShouldStopTransfer:(BOOL)flag;
-(BOOL)_shouldStopTransfer;
-(void)_setShouldStopTransfer: (BOOL)flag;
- (NSInteger)_numberOfRedirects;
- (void)_setNumberOfRedirects:(NSInteger)redirects;
-(NSInteger)_numberOfRedirects;
-(void)_setNumberOfRedirects: (NSInteger)redirects;
- (NSInteger)_headerCallbackCount;
- (void)_setHeaderCallbackCount:(NSInteger)count;
-(NSInteger)_headerCallbackCount;
-(void)_setHeaderCallbackCount: (NSInteger)count;
- (NSFileHandle *)_createTemporaryFileHandleWithError:(NSError **)error;
-(NSFileHandle *)_createTemporaryFileHandleWithError: (NSError **)error;
@end
@interface
NSURLSessionDataTask (Private)
NSURLSessionDataTask(Private)
- (GSNSURLSessionDataCompletionHandler)_completionHandler;
- (void)_setCompletionHandler:(GSNSURLSessionDataCompletionHandler)handler;
-(void)_setCompletionHandler: (GSNSURLSessionDataCompletionHandler)handler;
@end
@interface
NSURLSessionDownloadTask (Private)
NSURLSessionDownloadTask(Private)
- (GSNSURLSessionDownloadCompletionHandler)_completionHandler;
- (int64_t)_countOfBytesWritten;
- (void)_updateCountOfBytesWritten:(int64_t)count;
- (void)_setCompletionHandler:(GSNSURLSessionDownloadCompletionHandler)handler;
-(int64_t)_countOfBytesWritten;
-(void)_updateCountOfBytesWritten: (int64_t)count;
-(void)_setCompletionHandler: (GSNSURLSessionDownloadCompletionHandler)handler;
@end