@@ -52,23 +52,23 @@ else { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *tmp = [OFString stringWithCString: string encoding: encoding length: length]; - [cache addNItems: [tmp cStringLength] - fromCArray: [tmp cString]]; + [cache addNItems: [tmp UTF8StringLength] + fromCArray: [tmp UTF8String]]; [pool release]; } } static OFString* transform_string(OFDataArray *cache, size_t cut, BOOL unescape, OFObject *delegate) { OFMutableString *ret = [OFMutableString - stringWithCString: [cache cArray] - length: [cache count]]; + stringWithUTF8String: [cache cArray] + length: [cache count]]; [ret replaceOccurrencesOfString: @"\r\n" withString: @"\n"]; [ret replaceOccurrencesOfString: @"\r" withString: @"\n"]; @@ -253,12 +253,12 @@ cache_append(cache, buffer + last, encoding, length - last); } - (void)parseString: (OFString*)string { - [self parseBuffer: [string cString] - withLength: [string cStringLength]]; + [self parseBuffer: [string UTF8String] + withLength: [string UTF8StringLength]]; } - (void)parseStream: (OFStream*)stream { char *buffer = [self allocMemoryWithSize: of_pagesize]; @@ -381,12 +381,12 @@ acceptProlog = NO; pi = [pi substringWithRange: of_range(3, [pi length] - 3)]; pi = [pi stringByDeletingEnclosingWhitespaces]; - cString = [pi cString]; - length = [pi cStringLength]; + cString = [pi UTF8String]; + length = [pi UTF8StringLength]; for (i = last = 0; i < length; i++) { switch (piState) { case 0: if (cString[i] == ' ' || cString[i] == '\t' || @@ -401,12 +401,13 @@ break; case 1: if (cString[i] != '=') continue; - attribute = [OFString stringWithCString: cString + last - length: i - last]; + attribute = [OFString + stringWithUTF8String: cString + last + length: i - last]; last = i + 1; piState = 2; break; case 2: @@ -421,12 +422,12 @@ case 3: if (cString[i] != piDelimiter) continue; value = [OFMutableString - stringWithCString: cString + last - length: i - last]; + stringWithUTF8String: cString + last + length: i - last]; if ([attribute isEqual: @"version"]) if (![value hasPrefix: @"1."]) return NO; @@ -516,20 +517,20 @@ pool = [[OFAutoreleasePool alloc] init]; cacheCString = [cache cArray]; cacheLength = [cache count]; - cacheString = [OFString stringWithCString: cacheCString - length: cacheLength]; + cacheString = [OFString stringWithUTF8String: cacheCString + length: cacheLength]; if ((tmp = memchr(cacheCString, ':', cacheLength)) != NULL) { - name = [[OFString alloc] initWithCString: tmp + 1 - length: cacheLength - - (tmp - cacheCString) - - 1]; - prefix = [[OFString alloc] initWithCString: cacheCString - length: tmp - cacheCString]; + name = [[OFString alloc] + initWithUTF8String: tmp + 1 + length: cacheLength - (tmp - cacheCString) - 1]; + prefix = [[OFString alloc] + initWithUTF8String: cacheCString + length: tmp - cacheCString]; } else { name = [cacheString copy]; prefix = nil; } @@ -607,20 +608,20 @@ pool = [[OFAutoreleasePool alloc] init]; cacheCString = [cache cArray]; cacheLength = [cache count]; - cacheString = [OFString stringWithCString: cacheCString - length: cacheLength]; + cacheString = [OFString stringWithUTF8String: cacheCString + length: cacheLength]; if ((tmp = memchr(cacheCString, ':', cacheLength)) != NULL) { - name = [[OFString alloc] initWithCString: tmp + 1 - length: cacheLength - - (tmp - cacheCString) - - 1]; - prefix = [[OFString alloc] initWithCString: cacheCString - length: tmp - cacheCString]; + name = [[OFString alloc] + initWithUTF8String: tmp + 1 + length: cacheLength - (tmp - cacheCString) - 1]; + prefix = [[OFString alloc] + initWithUTF8String: cacheCString + length: tmp - cacheCString]; } else { name = [cacheString copy]; prefix = nil; } @@ -748,26 +749,26 @@ if ((length = *i - *last) > 0) cache_append(cache, buffer + *last, encoding, length); pool = [[OFAutoreleasePool alloc] init]; - cacheString = [OFMutableString stringWithCString: [cache cArray] - length: [cache count]]; + cacheString = [OFMutableString stringWithUTF8String: [cache cArray] + length: [cache count]]; [cacheString deleteEnclosingWhitespaces]; /* Prevent a useless copy later */ [cacheString makeImmutable]; - cacheCString = [cacheString cString]; - cacheLength = [cacheString cStringLength]; + cacheCString = [cacheString UTF8String]; + cacheLength = [cacheString UTF8StringLength]; if ((tmp = memchr(cacheCString, ':', cacheLength)) != NULL) { attributeName = [[OFString alloc] - initWithCString: tmp + 1 - length: cacheLength - (tmp - cacheCString) - 1]; + initWithUTF8String: tmp + 1 + length: cacheLength - (tmp - cacheCString) - 1]; attributePrefix = [[OFString alloc] - initWithCString: cacheCString - length: tmp - cacheCString]; + initWithUTF8String: cacheCString + length: tmp - cacheCString]; } else { attributeName = [cacheString copy]; attributePrefix = nil; }