Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -293,15 +293,15 @@ [self finishInitialization]; return [self UTF8String]; } -- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding +- (const char*)cStringUsingEncoding: (of_string_encoding_t)encoding { [self finishInitialization]; - return [self cStringWithEncoding: encoding]; + return [self cStringUsingEncoding: encoding]; } - (size_t)length { [self finishInitialization]; @@ -314,15 +314,15 @@ [self finishInitialization]; return [self UTF8StringLength]; } -- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding +- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding { [self finishInitialization]; - return [self cStringLengthWithEncoding: encoding]; + return [self lengthOfBytesUsingEncoding: encoding]; } - (of_comparison_result_t)caseInsensitiveCompare: (OFString*)otherString { [self finishInitialization]; Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -177,18 +177,20 @@ @try { const char *cString; size_t i; itemSize = 1; - count = [string UTF8StringLength]; + count = [string + lengthOfBytesUsingEncoding: OF_STRING_ENCODING_ASCII]; if (count & 1) @throw [OFInvalidFormatException exceptionWithClass: [self class]]; count >>= 1; - cString = [string UTF8String]; + cString = [string + cStringUsingEncoding: OF_STRING_ENCODING_ASCII]; items = [self allocMemoryWithSize: count]; for (i = 0; i < count; i++) { uint8_t c1 = cString[2 * i]; uint8_t c2 = cString[2 * i + 1]; @@ -229,13 +231,13 @@ self = [super init]; @try { itemSize = 1; - if (!of_base64_decode(self, [string cStringWithEncoding: + if (!of_base64_decode(self, [string cStringUsingEncoding: OF_STRING_ENCODING_ASCII], [string - cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) { + lengthOfBytesUsingEncoding: OF_STRING_ENCODING_ASCII])) { Class c = [self class]; [self release]; @throw [OFInvalidFormatException exceptionWithClass: c]; } } @catch (id e) { @@ -262,13 +264,13 @@ exceptionWithClass: [self class] selector: _cmd]; stringValue = [element stringValue]; - if (!of_base64_decode(self, - [stringValue cStringWithEncoding: OF_STRING_ENCODING_ASCII], - [stringValue cStringLengthWithEncoding: + if (!of_base64_decode(self, [stringValue + cStringUsingEncoding: OF_STRING_ENCODING_ASCII], + [stringValue lengthOfBytesUsingEncoding: OF_STRING_ENCODING_ASCII])) @throw [OFInvalidFormatException exceptionWithClass: [self class]]; objc_autoreleasePoolPop(pool); Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -203,11 +203,11 @@ + (BOOL)fileExistsAtPath: (OFString*)path { struct stat s; - if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) return NO; if (S_ISREG(s.st_mode)) return YES; @@ -217,11 +217,11 @@ + (BOOL)directoryExistsAtPath: (OFString*)path { struct stat s; - if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) return NO; if (S_ISDIR(s.st_mode)) return YES; @@ -230,14 +230,14 @@ } + (void)createDirectoryAtPath: (OFString*)path { #ifndef _WIN32 - if (mkdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (mkdir([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], DIR_MODE)) #else - if (mkdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) + if (mkdir([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) #endif @throw [OFCreateDirectoryFailedException exceptionWithClass: self path: path]; } @@ -288,11 +288,11 @@ #ifndef _WIN32 DIR *dir; struct dirent *dirent; - if ((dir = opendir([path cStringWithEncoding: + if ((dir = opendir([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFOpenFileFailedException exceptionWithClass: self path: path mode: @"r"]; @@ -320,11 +320,11 @@ HANDLE handle; WIN32_FIND_DATA fd; path = [path stringByAppendingString: @"\\*"]; - if ((handle = FindFirstFile([path cStringWithEncoding: + if ((handle = FindFirstFile([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], &fd)) == INVALID_HANDLE_VALUE) @throw [OFOpenFileFailedException exceptionWithClass: self path: path mode: @"r"]; @@ -356,11 +356,11 @@ return files; } + (void)changeToDirectoryAtPath: (OFString*)path { - if (chdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) + if (chdir([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) @throw [OFChangeDirectoryFailedException exceptionWithClass: self path: path]; } @@ -367,18 +367,18 @@ #ifndef _PSP + (void)changeModeOfFileAtPath: (OFString*)path mode: (mode_t)mode { # ifndef _WIN32 - if (chmod([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], mode)) + if (chmod([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], mode)) @throw [OFChangeFileModeFailedException exceptionWithClass: self path: path mode: mode]; # else DWORD attributes = GetFileAttributes( - [path cStringWithEncoding: OF_STRING_ENCODING_NATIVE]); + [path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]); if (attributes == INVALID_FILE_ATTRIBUTES) @throw [OFChangeFileModeFailedException exceptionWithClass: self path: path @@ -387,11 +387,11 @@ if ((mode / 100) & 2) attributes &= ~FILE_ATTRIBUTE_READONLY; else attributes |= FILE_ATTRIBUTE_READONLY; - if (!SetFileAttributes([path cStringWithEncoding: + if (!SetFileAttributes([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], attributes)) @throw [OFChangeFileModeFailedException exceptionWithClass: self path: path mode: mode]; @@ -401,11 +401,11 @@ + (off_t)sizeOfFileAtPath: (OFString*)path { struct stat s; - if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) /* FIXME: Maybe use another exception? */ @throw [OFOpenFileFailedException exceptionWithClass: self path: path mode: @"r"]; @@ -415,11 +415,11 @@ + (OFDate*)modificationDateOfFileAtPath: (OFString*)path { struct stat s; - if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) /* FIXME: Maybe use another exception? */ @throw [OFOpenFileFailedException exceptionWithClass: self path: path mode: @"r"]; @@ -447,11 +447,11 @@ @try { # endif if (owner != nil) { struct passwd *passwd; - if ((passwd = getpwnam([owner cStringWithEncoding: + if ((passwd = getpwnam([owner cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFChangeFileOwnerFailedException exceptionWithClass: self path: path owner: owner @@ -461,11 +461,11 @@ } if (group != nil) { struct group *group_; - if ((group_ = getgrnam([group cStringWithEncoding: + if ((group_ = getgrnam([group cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFChangeFileOwnerFailedException exceptionWithClass: self path: path owner: owner @@ -479,11 +479,11 @@ @throw [OFUnlockFailedException exceptionWithClass: self]; } # endif - if (chown([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (chown([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], uid, gid)) @throw [OFChangeFileOwnerFailedException exceptionWithClass: self path: path owner: owner @@ -556,15 +556,15 @@ destination = [OFString stringWithPath: destination, filename, nil]; } #ifndef _WIN32 - if (rename([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], - [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) + if (rename([source cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + [destination cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) #else - if (!MoveFile([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], - [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) + if (!MoveFile([source cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + [destination cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) #endif @throw [OFRenameFileFailedException exceptionWithClass: self sourcePath: source destinationPath: destination]; @@ -573,21 +573,21 @@ } + (void)deleteFileAtPath: (OFString*)path { #ifndef _WIN32 - if (unlink([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) + if (unlink([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) #else - if (!DeleteFile([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) + if (!DeleteFile([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) #endif @throw [OFDeleteFileFailedException exceptionWithClass: self path: path]; } + (void)deleteDirectoryAtPath: (OFString*)path { - if (rmdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) + if (rmdir([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) @throw [OFDeleteDirectoryFailedException exceptionWithClass: self path: path]; } @@ -601,12 +601,12 @@ OFString *filename = [source lastPathComponent]; destination = [OFString stringWithPath: destination, filename, nil]; } - if (link([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], - [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]) != 0) + if (link([source cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + [destination cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]) != 0) @throw [OFLinkFailedException exceptionWithClass: self sourcePath: source destinationPath: destination]; objc_autoreleasePoolPop(pool); @@ -623,12 +623,12 @@ OFString *filename = [source lastPathComponent]; destination = [OFString stringWithPath: destination, filename, nil]; } - if (symlink([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], - [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]) != 0) + if (symlink([source cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + [destination cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]) != 0) @throw [OFSymlinkFailedException exceptionWithClass: self sourcePath: source destinationPath: destination]; @@ -650,17 +650,17 @@ self = [super init]; @try { int flags; - if ((flags = parse_mode([mode cStringWithEncoding: + if ((flags = parse_mode([mode cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) == -1) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; - if ((fd = open([path cStringWithEncoding: + if ((fd = open([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], flags, DEFAULT_MODE)) == -1) @throw [OFOpenFileFailedException exceptionWithClass: [self class] path: path mode: mode]; Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -231,11 +231,11 @@ const char* _NSPrintForDebugger(id object) { return [[object description] - cStringWithEncoding: OF_STRING_ENCODING_NATIVE]; + cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]; } /* References for static linking */ void _references_to_categories_of_OFObject(void) { Index: src/OFPlugin.m ================================================================== --- src/OFPlugin.m +++ src/OFPlugin.m @@ -47,11 +47,11 @@ OFPlugin *plugin; file = [OFMutableString stringWithString: path]; [file appendString: @PLUGIN_SUFFIX]; - if ((handle = dlopen([file cStringWithEncoding: + if ((handle = dlopen([file cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], RTLD_LAZY)) == NULL) @throw [OFInitializationFailedException exceptionWithClass: self]; objc_autoreleasePoolPop(pool); Index: src/OFProcess.m ================================================================== --- src/OFProcess.m +++ src/OFProcess.m @@ -94,25 +94,25 @@ char **argv; argv = [self allocMemoryWithSize: sizeof(char*) count: count + 2]; - argv[0] = (char*)[programName cStringWithEncoding: + argv[0] = (char*)[programName cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]; for (i = 0; i < count; i++) argv[i + 1] = (char*)[objects[i] - cStringWithEncoding: + cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]; argv[i + 1] = NULL; close(readPipe[0]); close(writePipe[1]); dup2(writePipe[0], 0); dup2(readPipe[1], 1); - execvp([program cStringWithEncoding: + execvp([program cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], argv); @throw [OFInitializationFailedException exceptionWithClass: [self class]]; case -1: @@ -197,13 +197,13 @@ if (containsSpaces) [argumentsString appendString: @"\""]; } argumentsCString = strdup([argumentsString - cStringWithEncoding: OF_STRING_ENCODING_NATIVE]); + cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]); @try { - if (!CreateProcess([program cStringWithEncoding: + if (!CreateProcess([program cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], argumentsCString, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; } @finally { Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -544,10 +544,23 @@ * @return An initialized OFString */ - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding; +/*! + * @brief Returns the OFString as a C string in the specified encoding. + * + * The result is valid until the autorelease pool is released. If you want to + * use the result outside the scope of the current autorelease pool, you have to + * copy it. + * + * @param encoding The encoding for the C string + * @return The OFString as a C string in the specified encoding + */ +- (const char*)cStringUsingEncoding: (of_string_encoding_t)encoding + OF_RETURNS_INNER_POINTER; + /*! * @brief Returns the OFString as a UTF-8 encoded C string. * * The result is valid until the autorelease pool is released. If you want to * use the result outside the scope of the current autorelease pool, you have to @@ -555,45 +568,32 @@ * * @return The OFString as a UTF-8 encoded C string */ - (const char*)UTF8String OF_RETURNS_INNER_POINTER; -/*! - * @brief Returns the OFString as a C string in the specified encoding. - * - * The result is valid until the autorelease pool is released. If you want to - * use the result outside the scope of the current autorelease pool, you have to - * copy it. - * - * @param encoding The encoding for the C string - * @return The OFString as a C string in the specified encoding - */ -- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding - OF_RETURNS_INNER_POINTER; - /*! * @brief Returns the length of the string in Unicode characters. * * @return The length of the string in Unicode characters */ - (size_t)length; -/*! - * @brief Returns the number of bytes the string needs in UTF-8 encoding. - * - * @return The number of bytes the string needs in UTF-8 encoding. - */ -- (size_t)UTF8StringLength; - /*! * @brief Returns the number of bytes the string needs in the specified * encoding. * * @param encoding The encoding for the string * @return The number of bytes the string needs in the specified encoding. */ -- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding; +- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding; + +/*! + * @brief Returns the number of bytes the string needs in UTF-8 encoding. + * + * @return The number of bytes the string needs in UTF-8 encoding. + */ +- (size_t)UTF8StringLength; /*! * @brief Compares the OFString to another OFString without caring about the * case. * Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -688,11 +688,11 @@ struct stat st; @try { OFFile *file; - if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], &st) == -1) @throw [OFOpenFileFailedException exceptionWithClass: [self class] path: path mode: @"rb"]; @@ -822,20 +822,28 @@ } return self; } -- (const char*)UTF8String +- (const char*)cStringUsingEncoding: (of_string_encoding_t)encoding { const of_unichar_t *unicodeString = [self unicodeString]; char *UTF8String; - size_t i, j = 0, length = [self length]; - size_t UTF8StringLength = length; + size_t i, j = 0, length, UTF8StringLength; OFObject *object; + if (encoding != OF_STRING_ENCODING_UTF_8) + /* TODO: Implement! */ + @throw [OFNotImplementedException + exceptionWithClass: [self class] + selector: _cmd]; + + unicodeString = [self unicodeString]; + length = [self length]; object = [[[OFObject alloc] init] autorelease]; UTF8String = [object allocMemoryWithSize: (length * 4) + 1]; + UTF8StringLength = length; for (i = 0; i < length; i++) { char buffer[4]; size_t len = of_string_utf8_encode(unicodeString[i], buffer); @@ -880,31 +888,34 @@ } return UTF8String; } -- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding -{ - if (encoding == OF_STRING_ENCODING_UTF_8) - return [self UTF8String]; - - /* TODO: Implement! */ - @throw [OFNotImplementedException exceptionWithClass: [self class] - selector: _cmd]; +- (const char*)UTF8String +{ + return [self cStringUsingEncoding: OF_STRING_ENCODING_UTF_8]; } - (size_t)length { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } -- (size_t)UTF8StringLength +- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding { - const of_unichar_t *unicodeString = [self unicodeString]; - size_t length = [self length]; - size_t i, UTF8StringLength = 0; + const of_unichar_t *unicodeString; + size_t i, length, UTF8StringLength = 0; + + if (encoding != OF_STRING_ENCODING_UTF_8) + /* TODO: Implement! */ + @throw [OFNotImplementedException + exceptionWithClass: [self class] + selector: _cmd]; + + unicodeString = [self unicodeString]; + length = [self length]; for (i = 0; i < length; i++) { char buffer[4]; size_t len = of_string_utf8_encode(unicodeString[i], buffer); @@ -916,18 +927,13 @@ } return UTF8StringLength; } -- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding -{ - if (encoding == OF_STRING_ENCODING_UTF_8) - return [self UTF8StringLength]; - - /* TODO: Implement! */ - @throw [OFNotImplementedException exceptionWithClass: [self class] - selector: _cmd]; +- (size_t)UTF8StringLength +{ + return [self lengthOfBytesUsingEncoding: OF_STRING_ENCODING_UTF_8]; } - (of_unichar_t)characterAtIndex: (size_t)index { @throw [OFNotImplementedException exceptionWithClass: [self class] Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -777,16 +777,11 @@ free(s->freeWhenDone); [super dealloc]; } -- (const char*)UTF8String -{ - return s->cString; -} - -- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding +- (const char*)cStringUsingEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cString; case OF_STRING_ENCODING_ASCII: @@ -794,27 +789,25 @@ @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; return s->cString; default: - @throw [OFNotImplementedException - exceptionWithClass: [self class] - selector: _cmd]; + return [super cStringUsingEncoding: encoding]; } } + +- (const char*)UTF8String +{ + return s->cString; +} - (size_t)length { return s->length; } -- (size_t)UTF8StringLength -{ - return s->cStringLength; -} - -- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding +- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cStringLength; case OF_STRING_ENCODING_ASCII: @@ -822,15 +815,18 @@ @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; return s->cStringLength; default: - @throw [OFNotImplementedException - exceptionWithClass: [self class] - selector: _cmd]; + return [super lengthOfBytesUsingEncoding: encoding]; } } + +- (size_t)UTF8StringLength +{ + return s->cStringLength; +} - (BOOL)isEqual: (id)object { OFString_UTF8 *otherString; Index: src/OFTCPSocket+SOCKS5.m ================================================================== --- src/OFTCPSocket+SOCKS5.m +++ src/OFTCPSocket+SOCKS5.m @@ -52,14 +52,14 @@ /* CONNECT request */ [self writeBuffer: request length: 4]; [self writeInt8: - [host cStringLengthWithEncoding: OF_STRING_ENCODING_NATIVE]]; - [self writeBuffer: [host cStringWithEncoding: + [host lengthOfBytesUsingEncoding: OF_STRING_ENCODING_NATIVE]]; + [self writeBuffer: [host cStringUsingEncoding: OF_STRING_ENCODING_NATIVE] - length: [host cStringLengthWithEncoding: + length: [host lengthOfBytesUsingEncoding: OF_STRING_ENCODING_NATIVE]]; [self writeBigEndianInt16: port]; [self flushWriteBuffer]; [self setWriteBufferEnabled: oldWriteBufferEnabled]; Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -310,11 +310,11 @@ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; snprintf(portCString, 7, "%" PRIu16, port); - if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (getaddrinfo([host cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], portCString, &hints, &res0)) @throw [OFAddressTranslationFailedException exceptionWithClass: [self class] socket: self host: host]; @@ -344,11 +344,11 @@ addrlist = [[OFDataArray alloc] initWithItemSize: sizeof(char**)]; [mutex lock]; # endif - if ((he = gethostbyname([host cStringWithEncoding: + if ((he = gethostbyname([host cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) { # ifdef OF_THREADS [addrlist release]; [mutex unlock]; # endif @@ -487,11 +487,11 @@ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; snprintf(portCString, 7, "%" PRIu16, port); - if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + if (getaddrinfo([host cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], portCString, &hints, &res)) @throw [OFAddressTranslationFailedException exceptionWithClass: [self class] socket: self host: host]; @@ -518,11 +518,11 @@ # ifdef OF_THREADS [mutex lock]; # endif - if ((he = gethostbyname([host cStringWithEncoding: + if ((he = gethostbyname([host cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) { # ifdef OF_THREADS [mutex unlock]; # endif @throw [OFAddressTranslationFailedException Index: src/OFXMLElement+Serialization.m ================================================================== --- src/OFXMLElement+Serialization.m +++ src/OFXMLElement+Serialization.m @@ -34,11 +34,11 @@ { void *pool = objc_autoreleasePoolPush(); Class class; id object; - if ((class = objc_lookUpClass([name cStringWithEncoding: + if ((class = objc_getClass([name cStringUsingEncoding: OF_STRING_ENCODING_ASCII])) == Nil) @throw [OFNotImplementedException exceptionWithClass: Nil]; if (![class conformsToProtocol: @protocol(OFSerialization)]) @throw [OFNotImplementedException