@@ -51,18 +51,10 @@ @end @interface OFURIQueryKeyValueAllowedCharacterSet: OFURIAllowedCharacterSetBase @end -@interface OFURIPathAllowedCharacterSetWithoutExclamationMark: - OFURIPathAllowedCharacterSet -{ - OFCharacterSet *_characterSet; - bool (*_characterIsMember)(id, SEL, OFUnichar); -} -@end - OF_DIRECT_MEMBERS @interface OFInvertedCharacterSetWithoutPercent: OFCharacterSet { OFCharacterSet *_characterSet; bool (*_characterIsMember)(id, SEL, OFUnichar); @@ -74,11 +66,10 @@ static OFCharacterSet *URIAllowedCharacterSet = nil; static OFCharacterSet *URISchemeAllowedCharacterSet = nil; static OFCharacterSet *URIPathAllowedCharacterSet = nil; static OFCharacterSet *URIQueryOrFragmentAllowedCharacterSet = nil; static OFCharacterSet *URIQueryKeyValueAllowedCharacterSet = nil; -static OFCharacterSet *URIPathAllowedCharacterSetWithoutExclamationMark = nil; static OFOnceControl URIAllowedCharacterSetOnce = OFOnceControlInitValue; static OFOnceControl URIQueryOrFragmentAllowedCharacterSetOnce = OFOnceControlInitValue; @@ -114,17 +105,10 @@ { URIQueryKeyValueAllowedCharacterSet = [[OFURIQueryKeyValueAllowedCharacterSet alloc] init]; } -static void -initURIPathAllowedCharacterSetWithoutExclamationMark(void) -{ - URIPathAllowedCharacterSetWithoutExclamationMark = - [[OFURIPathAllowedCharacterSetWithoutExclamationMark alloc] init]; -} - bool OFURIIsIPv6Host(OFString *host) { const char *UTF8String = host.UTF8String; bool hasColon = false; @@ -142,38 +126,10 @@ } return hasColon; } -OFURI * -OFURIForFileInArchive(OFString *scheme, OFString *path, OFURI *archive) -{ - static OFOnceControl onceControl = OFOnceControlInitValue; - OFMutableURI *URI = [OFMutableURI URI]; - void *pool = objc_autoreleasePoolPush(); - OFString *archiveURI; - - OFOnce(&onceControl, - initURIPathAllowedCharacterSetWithoutExclamationMark); - - path = [path stringByAddingPercentEncodingWithAllowedCharacters: - URIPathAllowedCharacterSetWithoutExclamationMark]; - archiveURI = [archive.string - stringByAddingPercentEncodingWithAllowedCharacters: - URIPathAllowedCharacterSetWithoutExclamationMark]; - - URI.scheme = scheme; - URI.percentEncodedPath = [OFString stringWithFormat: @"%@!%@", - archiveURI, path]; - - [URI makeImmutable]; - - objc_autoreleasePoolPop(pool); - - return URI; -} - @implementation OFURIAllowedCharacterSetBase - (instancetype)autorelease { return self; } @@ -331,43 +287,10 @@ return true; default: return false; } } -@end - -@implementation OFURIPathAllowedCharacterSetWithoutExclamationMark -- (instancetype)init -{ - self = [super init]; - - @try { - _characterSet = [[OFCharacterSet URIPathAllowedCharacterSet] - retain]; - _characterIsMember = (bool (*)(id, SEL, OFUnichar)) - [_characterSet methodForSelector: - @selector(characterIsMember:)]; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)dealloc -{ - [_characterSet release]; - - [super dealloc]; -} - -- (bool)characterIsMember: (OFUnichar)character -{ - return (character != '!' && _characterIsMember(_characterSet, - @selector(characterIsMember:), character)); -} @end @implementation OFInvertedCharacterSetWithoutPercent - (instancetype)initWithCharacterSet: (OFCharacterSet *)characterSet {