46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
{
[cache replaceOccurrencesOfString: @"\r\n"
withString: @"\n"];
[cache replaceOccurrencesOfString: @"\r"
withString: @"\n"];
if (cut > 0) {
/*
* We need to create a mutable copy in order to detect possible
* UTF-8, as we never checked for UTF-8 when appending to the
* cache for performance reasons.
*/
OFMutableString *ret = [[cache mutableCopy] autorelease];
size_t length;
length = [ret length];
[ret deleteCharactersFromIndex: length - cut
toIndex: length];
if (unescape)
return [ret stringByXMLUnescapingWithDelegate:
delegate];
/*
* Class swizzle the string to be immutable. We pass it as
* OFString*, so it can't be modified anyway. But not swizzling
* it would create a real copy each time -[copy] is called.
*/
ret->isa = [OFString class];
return ret;
} else {
if (unescape)
return [cache stringByXMLUnescapingWithDelegate:
delegate];
else
return [[cache copy] autorelease];
}
}
static OFString*
namespace_for_prefix(OFString *prefix, OFArray *namespaces)
{
OFDictionary **cArray = [namespaces cArray];
ssize_t i;
|
<
<
<
<
<
<
|
<
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
|
|
<
|
|
<
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
{
[cache replaceOccurrencesOfString: @"\r\n"
withString: @"\n"];
[cache replaceOccurrencesOfString: @"\r"
withString: @"\n"];
if (cut > 0) {
size_t length = [cache length];
[cache deleteCharactersFromIndex: length - cut
toIndex: length];
}
if (unescape)
return [cache stringByXMLUnescapingWithDelegate: delegate];
else
return [[cache copy] autorelease];
}
static OFString*
namespace_for_prefix(OFString *prefix, OFArray *namespaces)
{
OFDictionary **cArray = [namespaces cArray];
ssize_t i;
|