@@ -22,10 +22,11 @@ #import "OFCharacterSet.h" #import "OFDate.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFLocale.h" +#import "OFSocket+Private.h" #import "OFString.h" #ifdef OF_WINDOWS # import "OFWindowsRegistryKey.h" #endif @@ -51,12 +52,10 @@ # include # include # include #endif -#import "socket_helpers.h" - #if defined(OF_HAIKU) # define HOSTS_PATH @"/system/settings/network/hosts" # define RESOLV_CONF_PATH @"/system/settings/network/resolv.conf" #elif defined(OF_AMIGAOS4) # define HOSTS_PATH @"DEVS:Internet/hosts" @@ -74,11 +73,11 @@ { if (hostname == nil) return nil; @try { - of_socket_address_parse_ip(hostname, 0); + OFSocketAddressParseIP(hostname, 0); /* * If we are still here, the host name is a valid IP address. * We can't use that as local domain. */ @@ -85,11 +84,11 @@ return nil; } @catch (OFInvalidFormatException *e) { /* Not an IP address -> we can use it if it contains a dot. */ size_t pos = [hostname rangeOfString: @"."].location; - if (pos == OF_NOT_FOUND) + if (pos == OFNotFound) return nil; return [hostname substringFromIndex: pos + 1]; } } @@ -173,11 +172,11 @@ parseNetStackArray(OFString *string) { if (![string hasPrefix: @"["] || ![string hasSuffix: @"]"]) return nil; - string = [string substringWithRange: of_range(1, string.length - 2)]; + string = [string substringWithRange: OFRangeMake(1, string.length - 2)]; return [string componentsSeparatedByString: @"|"]; } #endif @@ -265,23 +264,23 @@ OFArray *components, *hosts; size_t pos; OFString *address; pos = [line rangeOfString: @"#"].location; - if (pos != OF_NOT_FOUND) + if (pos != OFNotFound) line = [line substringToIndex: pos]; components = [line componentsSeparatedByCharactersInSet: whitespaceCharacterSet - options: OF_STRING_SKIP_EMPTY]; + options: OFStringSkipEmptyComponents]; if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: - of_range(1, components.count - 1)]; + OFRangeMake(1, components.count - 1)]; for (OFString *host in hosts) { OFMutableArray *addresses = [staticHosts objectForKey: host]; @@ -366,25 +365,25 @@ size_t pos; OFArray *components, *arguments; OFString *option; pos = [line indexOfCharacterFromSet: commentCharacters]; - if (pos != OF_NOT_FOUND) + if (pos != OFNotFound) line = [line substringToIndex: pos]; components = [line componentsSeparatedByCharactersInSet: whitespaceCharacterSet - options: OF_STRING_SKIP_EMPTY]; + options: OFStringSkipEmptyComponents]; if (components.count < 2) { objc_autoreleasePoolPop(pool2); continue; } option = components.firstObject; arguments = [components objectsInRange: - of_range(1, components.count - 1)]; + OFRangeMake(1, components.count - 1)]; if ([option isEqual: @"nameserver"]) { if (arguments.count != 1) { objc_autoreleasePoolPop(pool2); continue; @@ -420,11 +419,11 @@ #endif #ifdef OF_WINDOWS - (void)obtainWindowsSystemConfig { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; OFMutableArray *nameServers; /* * We need more space than FIXED_INFO in case we have more than one * name server, but we also want it to be properly aligned, meaning we * can't just get a buffer of bytes. Thus, we just get space for 8. @@ -479,11 +478,11 @@ if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: - of_range(1, components.count - 1)]; + OFRangeMake(1, components.count - 1)]; for (OFString *host in hosts) { OFMutableArray *addresses = [staticHosts objectForKey: host]; @@ -507,11 +506,11 @@ #ifdef OF_AMIGAOS4 - (void)obtainAmigaOS4SystemConfig { OFMutableArray *nameServers = [OFMutableArray array]; - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; struct List *nameServerList = ObtainDomainNameServerList(); char buffer[MAXHOSTNAMELEN]; if (nameServerList == NULL) @throw [OFOutOfMemoryException exception]; @@ -572,11 +571,11 @@ */ if (optLen < sizeof(buffer.entries)) return; for (uint_fast8_t i = 0; i < 2; i++) { - uint32_t ip = OF_BSWAP32_IF_LE(buffer.entries[i].ip.s_addr); + uint32_t ip = OFFromBigEndian32(buffer.entries[i].ip.s_addr); if (ip == 0) continue; [nameServers addObject: [OFString stringWithFormat: