@@ -24,12 +24,10 @@ #import "OFNumber.h" #import "OFString.h" #import "OFInvalidFormatException.h" -extern void of_url_verify_escaped(OFString *, OFCharacterSet *); - @implementation OFMutableURL @dynamic scheme, URLEncodedScheme, host, URLEncodedHost, port, user; @dynamic URLEncodedUser, password, URLEncodedPassword, path, URLEncodedPath; @dynamic pathComponents, query, URLEncodedQuery, queryDictionary, fragment; @dynamic URLEncodedFragment; @@ -55,11 +53,11 @@ - (void)setURLEncodedScheme: (OFString *)URLEncodedScheme { OFString *old; if (URLEncodedScheme != nil) - of_url_verify_escaped(URLEncodedScheme, + OFURLVerifyIsEscaped(URLEncodedScheme, [OFCharacterSet URLSchemeAllowedCharacterSet]); old = _URLEncodedScheme; _URLEncodedScheme = [URLEncodedScheme copy]; [old release]; @@ -68,11 +66,11 @@ - (void)setHost: (OFString *)host { void *pool = objc_autoreleasePoolPush(); OFString *old = _URLEncodedHost; - if (of_url_is_ipv6_host(host)) + if (OFURLIsIPv6Host(host)) _URLEncodedHost = [[OFString alloc] initWithFormat: @"[%@]", host]; else _URLEncodedHost = [[host stringByURLEncodingWithAllowedCharacters: @@ -87,15 +85,15 @@ { OFString *old; if ([URLEncodedHost hasPrefix: @"["] && [URLEncodedHost hasSuffix: @"]"]) { - if (!of_url_is_ipv6_host([URLEncodedHost substringWithRange: - of_range(1, URLEncodedHost.length - 2)])) + if (!OFURLIsIPv6Host([URLEncodedHost substringWithRange: + OFRangeMake(1, URLEncodedHost.length - 2)])) @throw [OFInvalidFormatException exception]; } else if (URLEncodedHost != nil) - of_url_verify_escaped(URLEncodedHost, + OFURLVerifyIsEscaped(URLEncodedHost, [OFCharacterSet URLHostAllowedCharacterSet]); old = _URLEncodedHost; _URLEncodedHost = [URLEncodedHost copy]; [old release]; @@ -124,11 +122,11 @@ - (void)setURLEncodedUser: (OFString *)URLEncodedUser { OFString *old; if (URLEncodedUser != nil) - of_url_verify_escaped(URLEncodedUser, + OFURLVerifyIsEscaped(URLEncodedUser, [OFCharacterSet URLUserAllowedCharacterSet]); old = _URLEncodedUser; _URLEncodedUser = [URLEncodedUser copy]; [old release]; @@ -151,11 +149,11 @@ - (void)setURLEncodedPassword: (OFString *)URLEncodedPassword { OFString *old; if (URLEncodedPassword != nil) - of_url_verify_escaped(URLEncodedPassword, + OFURLVerifyIsEscaped(URLEncodedPassword, [OFCharacterSet URLPasswordAllowedCharacterSet]); old = _URLEncodedPassword; _URLEncodedPassword = [URLEncodedPassword copy]; [old release]; @@ -177,11 +175,11 @@ - (void)setURLEncodedPath: (OFString *)URLEncodedPath { OFString *old; if (URLEncodedPath != nil) - of_url_verify_escaped(URLEncodedPath, + OFURLVerifyIsEscaped(URLEncodedPath, [OFCharacterSet URLPathAllowedCharacterSet]); old = _URLEncodedPath; _URLEncodedPath = [URLEncodedPath copy]; [old release]; @@ -223,11 +221,11 @@ - (void)setURLEncodedQuery: (OFString *)URLEncodedQuery { OFString *old; if (URLEncodedQuery != nil) - of_url_verify_escaped(URLEncodedQuery, + OFURLVerifyIsEscaped(URLEncodedQuery, [OFCharacterSet URLQueryAllowedCharacterSet]); old = _URLEncodedQuery; _URLEncodedQuery = [URLEncodedQuery copy]; [old release]; @@ -291,11 +289,11 @@ - (void)setURLEncodedFragment: (OFString *)URLEncodedFragment { OFString *old; if (URLEncodedFragment != nil) - of_url_verify_escaped(URLEncodedFragment, + OFURLVerifyIsEscaped(URLEncodedFragment, [OFCharacterSet URLFragmentAllowedCharacterSet]); old = _URLEncodedFragment; _URLEncodedFragment = [URLEncodedFragment copy]; [old release]; @@ -310,12 +308,11 @@ return copy; } - (void)appendPathComponent: (OFString *)component { - [self appendPathComponent: component - isDirectory: false]; + [self appendPathComponent: component isDirectory: false]; #ifdef OF_HAVE_FILES if ([_URLEncodedScheme isEqual: @"file"] && ![_URLEncodedPath hasSuffix: @"/"] && [[OFFileManager defaultManager] directoryExistsAtURL: self]) { @@ -403,20 +400,19 @@ } if ([current isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: - of_range(i - 1, 2)]; + OFRangeMake(i - 1, 2)]; done = false; break; } } } - [array insertObject: @"" - atIndex: 0]; + [array insertObject: @"" atIndex: 0]; if (endsWithEmpty) [array addObject: @""]; path = [array componentsJoinedByString: @"/"]; if (path.length == 0)