31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
{
char *retCString;
const char *string, *append;
size_t length, retLength, appendLen;
size_t i, j;
OFString *ret;
string = [self cString];
length = [self cStringLength];
j = 0;
retLength = length;
/*
* We can't use allocMemoryWithSize: here as it might be a @"" literal
*/
|
|
|
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
{
char *retCString;
const char *string, *append;
size_t length, retLength, appendLen;
size_t i, j;
OFString *ret;
string = [self UTF8String];
length = [self UTF8StringLength];
j = 0;
retLength = length;
/*
* We can't use allocMemoryWithSize: here as it might be a @"" literal
*/
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
} else
retCString[j++] = string[i];
}
assert(j == retLength);
@try {
ret = [OFString stringWithCString: retCString
length: retLength];
} @finally {
free(retCString);
}
return ret;
}
@end
|
|
|
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
} else
retCString[j++] = string[i];
}
assert(j == retLength);
@try {
ret = [OFString stringWithUTF8String: retCString
length: retLength];
} @finally {
free(retCString);
}
return ret;
}
@end
|