Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -296,15 +296,15 @@ [self finishInitialization]; return [self UTF8String]; } -- (const char*)cStringUsingEncoding: (of_string_encoding_t)encoding +- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding { [self finishInitialization]; - return [self cStringUsingEncoding: encoding]; + return [self cStringWithEncoding: encoding]; } - (size_t)length { [self finishInitialization]; @@ -317,15 +317,15 @@ [self finishInitialization]; return [self UTF8StringLength]; } -- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding +- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding { [self finishInitialization]; - return [self lengthOfBytesUsingEncoding: encoding]; + return [self cStringLengthWithEncoding: encoding]; } - (of_comparison_result_t)caseInsensitiveCompare: (OFString*)otherString { [self finishInitialization]; Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -180,19 +180,19 @@ const char *cString; size_t i; itemSize = 1; count = [string - lengthOfBytesUsingEncoding: OF_STRING_ENCODING_ASCII]; + cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII]; if (count & 1) @throw [OFInvalidFormatException exceptionWithClass: [self class]]; count >>= 1; cString = [string - cStringUsingEncoding: OF_STRING_ENCODING_ASCII]; + cStringWithEncoding: 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]; @@ -233,13 +233,13 @@ self = [super init]; @try { itemSize = 1; - if (!of_base64_decode(self, [string cStringUsingEncoding: + if (!of_base64_decode(self, [string cStringWithEncoding: OF_STRING_ENCODING_ASCII], [string - lengthOfBytesUsingEncoding: OF_STRING_ENCODING_ASCII])) { + cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) { Class c = [self class]; [self release]; @throw [OFInvalidFormatException exceptionWithClass: c]; } } @catch (id e) { @@ -267,12 +267,12 @@ selector: _cmd]; stringValue = [element stringValue]; if (!of_base64_decode(self, [stringValue - cStringUsingEncoding: OF_STRING_ENCODING_ASCII], - [stringValue lengthOfBytesUsingEncoding: + cStringWithEncoding: OF_STRING_ENCODING_ASCII], + [stringValue cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) @throw [OFInvalidFormatException exceptionWithClass: [self class]]; objc_autoreleasePoolPop(pool); Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -213,11 +213,11 @@ + (BOOL)fileExistsAtPath: (OFString*)path { #ifndef _WIN32 struct stat s; - if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) return NO; #else struct _stat s; @@ -234,11 +234,11 @@ + (BOOL)directoryExistsAtPath: (OFString*)path { #ifndef _WIN32 struct stat s; - if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) return NO; #else struct _stat s; @@ -253,11 +253,11 @@ } + (void)createDirectoryAtPath: (OFString*)path { #ifndef _WIN32 - if (mkdir([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (mkdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], DIR_MODE)) #else if (_wmkdir([path UTF16String])) #endif @throw [OFCreateDirectoryFailedException @@ -311,11 +311,11 @@ #ifndef _WIN32 DIR *dir; struct dirent *dirent; - if ((dir = opendir([path cStringUsingEncoding: + if ((dir = opendir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFOpenFileFailedException exceptionWithClass: self path: path mode: @"r"]; @@ -378,11 +378,11 @@ } + (void)changeToDirectoryAtPath: (OFString*)path { #ifndef _WIN32 - if (chdir([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) + if (chdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (_wchdir([path UTF16String])) #endif @throw [OFChangeDirectoryFailedException exceptionWithClass: self @@ -392,11 +392,11 @@ #ifndef _PSP + (void)changeModeOfFileAtPath: (OFString*)path mode: (mode_t)mode { # ifndef _WIN32 - if (chmod([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], mode)) + if (chmod([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], mode)) @throw [OFChangeFileModeFailedException exceptionWithClass: self path: path mode: mode]; # else @@ -425,11 +425,11 @@ + (off_t)sizeOfFileAtPath: (OFString*)path { #ifndef _WIN32 struct stat s; - if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) #else struct _stat s; if (_wstat([path UTF16String], &s) == -1) @@ -445,11 +445,11 @@ + (OFDate*)modificationDateOfFileAtPath: (OFString*)path { #ifndef _WIN32 struct stat s; - if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &s) == -1) #else struct _stat s; if (_wstat([path UTF16String], &s) == -1) @@ -482,11 +482,11 @@ @try { # endif if (owner != nil) { struct passwd *passwd; - if ((passwd = getpwnam([owner cStringUsingEncoding: + if ((passwd = getpwnam([owner cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFChangeFileOwnerFailedException exceptionWithClass: self path: path owner: owner @@ -496,11 +496,11 @@ } if (group != nil) { struct group *group_; - if ((group_ = getgrnam([group cStringUsingEncoding: + if ((group_ = getgrnam([group cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) @throw [OFChangeFileOwnerFailedException exceptionWithClass: self path: path owner: owner @@ -514,11 +514,11 @@ @throw [OFUnlockFailedException exceptionWithClass: self]; } # endif - if (chown([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (chown([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], uid, gid)) @throw [OFChangeFileOwnerFailedException exceptionWithClass: self path: path owner: owner @@ -593,12 +593,12 @@ destination = [OFString stringWithPath: destination, filename, nil]; } #ifndef _WIN32 - if (rename([source cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], - [destination cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) + if (rename([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (!MoveFileW([source UTF16String], [destination UTF16String])) #endif @throw [OFRenameFileFailedException exceptionWithClass: self @@ -609,11 +609,11 @@ } + (void)deleteFileAtPath: (OFString*)path { #ifndef _WIN32 - if (unlink([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) + if (unlink([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (_wunlink([path UTF16String])) #endif @throw [OFDeleteFileFailedException exceptionWithClass: self path: path]; @@ -620,11 +620,11 @@ } + (void)deleteDirectoryAtPath: (OFString*)path { #ifndef _WIN32 - if (rmdir([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE])) + if (rmdir([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) #else if (_wrmdir([path UTF16String])) #endif @throw [OFDeleteDirectoryFailedException exceptionWithClass: self @@ -641,12 +641,12 @@ OFString *filename = [source lastPathComponent]; destination = [OFString stringWithPath: destination, filename, nil]; } - if (link([source cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], - [destination cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]) != 0) + if (link([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]) != 0) @throw [OFLinkFailedException exceptionWithClass: self sourcePath: source destinationPath: destination]; objc_autoreleasePoolPop(pool); @@ -663,12 +663,12 @@ OFString *filename = [source lastPathComponent]; destination = [OFString stringWithPath: destination, filename, nil]; } - if (symlink([source cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], - [destination cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]) != 0) + if (symlink([source cStringWithEncoding: OF_STRING_ENCODING_NATIVE], + [destination cStringWithEncoding: OF_STRING_ENCODING_NATIVE]) != 0) @throw [OFSymlinkFailedException exceptionWithClass: self sourcePath: source destinationPath: destination]; @@ -699,11 +699,11 @@ @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; #ifndef _WIN32 - if ((fd = open([path cStringUsingEncoding: + if ((fd = open([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], flags, DEFAULT_MODE)) == -1) #else if ((fd = _wopen([path UTF16String], flags, DEFAULT_MODE)) == -1) #endif Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -224,11 +224,11 @@ const char* _NSPrintForDebugger(id object) { return [[object description] - cStringUsingEncoding: OF_STRING_ENCODING_NATIVE]; + cStringWithEncoding: 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 @@ -44,11 +44,11 @@ OFPlugin *plugin; path = [path stringByAppendingString: @PLUGIN_SUFFIX]; #ifndef _WIN32 - if ((handle = dlopen([path cStringUsingEncoding: + if ((handle = dlopen([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], RTLD_LAZY)) == NULL) #else if ((handle = LoadLibraryW([path UTF16String])) == NULL) #endif @throw [OFInitializationFailedException Index: src/OFProcess.m ================================================================== --- src/OFProcess.m +++ src/OFProcess.m @@ -129,16 +129,16 @@ char **argv; argv = [self allocMemoryWithSize: sizeof(char*) count: count + 2]; - argv[0] = (char*)[programName cStringUsingEncoding: + argv[0] = (char*)[programName cStringWithEncoding: OF_STRING_ENCODING_NATIVE]; for (i = 0; i < count; i++) argv[i + 1] = (char*)[objects[i] - cStringUsingEncoding: + cStringWithEncoding: OF_STRING_ENCODING_NATIVE]; argv[i + 1] = NULL; if (environment != nil) { @@ -153,11 +153,11 @@ close(readPipe[0]); close(writePipe[1]); dup2(writePipe[0], 0); dup2(readPipe[1], 1); - execvp([program cStringUsingEncoding: + execvp([program cStringWithEncoding: OF_STRING_ENCODING_NATIVE], argv); @throw [OFInitializationFailedException exceptionWithClass: [self class]]; case -1: @@ -300,21 +300,21 @@ size_t keyLen, objectLen; key = [keyEnumerator nextObject]; object = [objectEnumerator nextObject]; - keyLen = [key lengthOfBytesUsingEncoding: + keyLen = [key cStringLengthWithEncoding: OF_STRING_ENCODING_NATIVE]; - objectLen = [object lengthOfBytesUsingEncoding: + objectLen = [object cStringLengthWithEncoding: OF_STRING_ENCODING_NATIVE]; envp[i] = [self allocMemoryWithSize: keyLen + objectLen + 2]; - memcpy(envp[i], [key cStringUsingEncoding: + memcpy(envp[i], [key cStringWithEncoding: OF_STRING_ENCODING_NATIVE], keyLen); envp[i][keyLen] = '='; - memcpy(envp[i] + keyLen + 1, [object cStringUsingEncoding: + memcpy(envp[i] + keyLen + 1, [object cStringWithEncoding: OF_STRING_ENCODING_NATIVE], objectLen); envp[i][keyLen + objectLen + 1] = '\0'; } envp[i] = NULL; Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -771,12 +771,12 @@ const char *delimiterCString; size_t i, j, delimiterLength, pageSize, bufferLength, retLength; char *retCString, *buffer, *newCache; OFString *ret; - delimiterCString = [delimiter cStringUsingEncoding: encoding]; - delimiterLength = [delimiter lengthOfBytesUsingEncoding: encoding]; + delimiterCString = [delimiter cStringWithEncoding: encoding]; + delimiterLength = [delimiter cStringLengthWithEncoding: encoding]; j = 0; if (delimiterLength == 0) @throw [OFInvalidArgumentException exceptionWithClass: [self class] @@ -1376,13 +1376,13 @@ } - (size_t)writeString: (OFString*)string usingEncoding: (of_string_encoding_t)encoding { - size_t length = [string lengthOfBytesUsingEncoding: encoding]; + size_t length = [string cStringLengthWithEncoding: encoding]; - [self writeBuffer: [string cStringUsingEncoding: encoding] + [self writeBuffer: [string cStringWithEncoding: encoding] length: length]; return length; } @@ -1393,17 +1393,17 @@ } - (size_t)writeLine: (OFString*)string usingEncoding: (of_string_encoding_t)encoding { - size_t stringLength = [string lengthOfBytesUsingEncoding: encoding]; + size_t stringLength = [string cStringLengthWithEncoding: encoding]; char *buffer; buffer = [self allocMemoryWithSize: stringLength + 1]; @try { - memcpy(buffer, [string cStringUsingEncoding: encoding], + memcpy(buffer, [string cStringWithEncoding: encoding], stringLength); buffer[stringLength] = '\n'; [self writeBuffer: buffer length: stringLength + 1]; Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -563,11 +563,11 @@ * 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 +- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding OF_RETURNS_INNER_POINTER; /*! * @brief Returns the OFString as a UTF-8 encoded C string. * @@ -591,11 +591,11 @@ * encoding. * * @param encoding The encoding for the string * @return The number of bytes the string needs in the specified encoding. */ -- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding; +- (size_t)cStringLengthWithEncoding: (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. Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -853,11 +853,11 @@ struct stat st; @try { OFFile *file; - if (stat([path cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (stat([path cStringWithEncoding: OF_STRING_ENCODING_NATIVE], &st) == -1) @throw [OFOpenFileFailedException exceptionWithClass: [self class] path: path mode: @"rb"]; @@ -987,11 +987,11 @@ } return self; } -- (const char*)cStringUsingEncoding: (of_string_encoding_t)encoding +- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding { const of_unichar_t *characters = [self characters]; size_t i, length = [self length]; OFObject *object = [[[OFObject alloc] init] autorelease]; char *cString; @@ -1088,20 +1088,20 @@ return cString; } - (const char*)UTF8String { - return [self cStringUsingEncoding: OF_STRING_ENCODING_UTF_8]; + return [self cStringWithEncoding: OF_STRING_ENCODING_UTF_8]; } - (size_t)length { [self doesNotRecognizeSelector: _cmd]; abort(); } -- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding +- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8:; const of_unichar_t *characters; size_t i, length, UTF8StringLength = 0; @@ -1132,11 +1132,11 @@ } } - (size_t)UTF8StringLength { - return [self lengthOfBytesUsingEncoding: OF_STRING_ENCODING_UTF_8]; + return [self cStringLengthWithEncoding: OF_STRING_ENCODING_UTF_8]; } - (of_unichar_t)characterAtIndex: (size_t)index { [self doesNotRecognizeSelector: _cmd]; Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -774,11 +774,11 @@ free(s->freeWhenDone); [super dealloc]; } -- (const char*)cStringUsingEncoding: (of_string_encoding_t)encoding +- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cString; case OF_STRING_ENCODING_ASCII: @@ -786,11 +786,11 @@ @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; return s->cString; default: - return [super cStringUsingEncoding: encoding]; + return [super cStringWithEncoding: encoding]; } } - (const char*)UTF8String { @@ -800,18 +800,18 @@ - (size_t)length { return s->length; } -- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding +- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8: case OF_STRING_ENCODING_ASCII: return s->cStringLength; default: - return [super lengthOfBytesUsingEncoding: encoding]; + return [super cStringLengthWithEncoding: encoding]; } } - (size_t)UTF8StringLength { Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -311,11 +311,11 @@ hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICSERV | AI_ADDRCONFIG; snprintf(portCString, 7, "%" PRIu16, port); - if (getaddrinfo([host cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], portCString, &hints, &res0)) @throw [OFAddressTranslationFailedException exceptionWithClass: [self class] socket: self host: host]; @@ -345,11 +345,11 @@ addrlist = [[OFDataArray alloc] initWithItemSize: sizeof(char**)]; [mutex lock]; # endif - if ((he = gethostbyname([host cStringUsingEncoding: + if ((he = gethostbyname([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE])) == NULL) { # ifdef OF_THREADS [addrlist release]; [mutex unlock]; # endif @@ -490,11 +490,11 @@ hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICSERV | AI_ADDRCONFIG | AI_PASSIVE; snprintf(portCString, 7, "%" PRIu16, port); - if (getaddrinfo([host cStringUsingEncoding: OF_STRING_ENCODING_NATIVE], + if (getaddrinfo([host cStringWithEncoding: OF_STRING_ENCODING_NATIVE], portCString, &hints, &res)) @throw [OFAddressTranslationFailedException exceptionWithClass: [self class] socket: self host: host]; @@ -527,11 +527,11 @@ # ifdef OF_THREADS [mutex lock]; # endif - if ((he = gethostbyname([host cStringUsingEncoding: + if ((he = gethostbyname([host cStringWithEncoding: 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 @@ -33,11 +33,11 @@ { void *pool = objc_autoreleasePoolPush(); Class class; id object; - if ((class = objc_getClass([name cStringUsingEncoding: + if ((class = objc_getClass([name cStringWithEncoding: OF_STRING_ENCODING_ASCII])) == Nil) @throw [OFInvalidArgumentException exceptionWithClass: [self class]]; if (![class conformsToProtocol: @protocol(OFSerialization)])