@@ -124,17 +124,17 @@ char *str_c; size_t len, i, j, attrs_count; OFXMLAttribute **attrs_data; OFString *ret, *tmp; - len = [name length] + 4; + len = [name cStringLength] + 4; str_c = [self allocMemoryWithSize: len]; /* Start of tag */ *str_c = '<'; - memcpy(str_c + 1, [name cString], [name length]); - i = [name length] + 1; + memcpy(str_c + 1, [name cString], [name cStringLength]); + i = [name cStringLength] + 1; /* Attributes */ attrs_data = [attrs data]; attrs_count = [attrs count]; @@ -141,11 +141,11 @@ for (j = 0; j < attrs_count; j++) { /* FIXME: Add namespace support */ OFString *attr_name = [attrs_data[j] name]; tmp = [[attrs_data[j] stringValue] stringByXMLEscaping]; - len += [attr_name length] + [tmp length] + 4; + len += [attr_name cStringLength] + [tmp cStringLength] + 4; @try { str_c = [self resizeMemory: str_c toSize: len]; } @catch (OFException *e) { [self freeMemory: str_c]; @@ -152,16 +152,16 @@ @throw e; } str_c[i++] = ' '; memcpy(str_c + i, [attr_name cString], - [attr_name length]); - i += [attr_name length]; + [attr_name cStringLength]); + i += [attr_name cStringLength]; str_c[i++] = '='; str_c[i++] = '\''; - memcpy(str_c + i, [tmp cString], [tmp length]); - i += [tmp length]; + memcpy(str_c + i, [tmp cString], [tmp cStringLength]); + i += [tmp cStringLength]; str_c[i++] = '\''; [pool releaseObjects]; } @@ -182,26 +182,26 @@ append(tmp, @selector( appendCStringWithoutUTF8Checking:), [[data[j] string] cString]); } - len += [tmp length] + [name length] + 2; + len += [tmp cStringLength] + [name cStringLength] + 2; @try { str_c = [self resizeMemory: str_c toSize: len]; } @catch (OFException *e) { [self freeMemory: str_c]; @throw e; } str_c[i++] = '>'; - memcpy(str_c + i, [tmp cString], [tmp length]); - i += [tmp length]; + memcpy(str_c + i, [tmp cString], [tmp cStringLength]); + i += [tmp cStringLength]; str_c[i++] = '<'; str_c[i++] = '/'; - memcpy(str_c + i, [name cString], [name length]); - i += [name length]; + memcpy(str_c + i, [name cString], [name cStringLength]); + i += [name cStringLength]; } else str_c[i++] = '/'; str_c[i++] = '>'; str_c[i++] = '\0';