ObjFW  Check-in [036c487137]

Overview
Comment:OFXMLParser: OFMutableString -> OFString.

There was no point in having it mutable here.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 036c487137bb5f465427e0db7a3aacee4e14235aff1d12731288777d0c938200
User & Date: js on 2012-12-29 14:29:23
Other Links: manifest | tags
Context
2012-12-29
14:31
OFMutableString: Implement more methods. check-in: 9e8c825616 user: js tags: trunk
14:29
OFXMLParser: OFMutableString -> OFString. check-in: 036c487137 user: js tags: trunk
2012-12-28
02:46
Make 16 bit selector UIDs the default. check-in: 511a372fb8 user: js tags: trunk
Changes

Modified src/OFXMLParser.m from [e91c2714f2] to [6860431168].

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
91
92
93
94
95
96
97
98
99
100
101
102
static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
    id <OFStringXMLUnescapingDelegate> delegate)
{
	char *items;
	size_t i, length;
	BOOL hasEntities = NO;
	OFMutableString *ret;

	items = [cache items];
	length = [cache count] - cut;

	for (i = 0; i < length; i++) {
		if (items[i] == '\r') {
			if (i + 1 < length && items[i + 1] == '\n') {
				[cache removeItemAtIndex: i];
				items = [cache items];

				i--;
				length--;
			} else
				items[i] = '\n';
		} else if (items[i] == '&')
			hasEntities = YES;
	}

	ret = [OFMutableString stringWithUTF8String: items
					     length: length];

	if (unescape && hasEntities)
		return [ret stringByXMLUnescapingWithDelegate: delegate];

	[ret makeImmutable];

	return ret;
}

static OFString*
namespace_for_prefix(OFString *prefix, OFArray *namespaces)
{
	OFDictionary **objects = [namespaces objects];







|


















|
|




<
<







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
91
92
93


94
95
96
97
98
99
100
static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
    id <OFStringXMLUnescapingDelegate> delegate)
{
	char *items;
	size_t i, length;
	BOOL hasEntities = NO;
	OFString *ret;

	items = [cache items];
	length = [cache count] - cut;

	for (i = 0; i < length; i++) {
		if (items[i] == '\r') {
			if (i + 1 < length && items[i + 1] == '\n') {
				[cache removeItemAtIndex: i];
				items = [cache items];

				i--;
				length--;
			} else
				items[i] = '\n';
		} else if (items[i] == '&')
			hasEntities = YES;
	}

	ret = [OFString stringWithUTF8String: items
				      length: length];

	if (unescape && hasEntities)
		return [ret stringByXMLUnescapingWithDelegate: delegate];



	return ret;
}

static OFString*
namespace_for_prefix(OFString *prefix, OFArray *namespaces)
{
	OFDictionary **objects = [namespaces objects];