ObjFW  Diff

Differences From Artifact [7b02ea3041]:

To Artifact [e2b24f34eb]:


60
61
62
63
64
65
66



67

68
69
70





71

72





73
74

75
76
77
78
79
80
81
82
83
	}
}

static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
    OFObject <OFStringXMLUnescapingDelegate> *delegate)
{



	OFMutableString *ret = [OFMutableString

	    stringWithUTF8String: [cache cArray]
			  length: [cache count] - cut];






	[ret replaceOccurrencesOfString: @"\r\n"

			     withString: @"\n"];





	[ret replaceOccurrencesOfString: @"\r"
			     withString: @"\n"];


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

	[ret makeImmutable];

	return ret;
}








>
>
>
|
>
|
|

>
>
>
>
>
|
>
|
>
>
>
>
>
|
|
>

|







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
91
92
93
94
95
96
97
98
99
	}
}

static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
    OFObject <OFStringXMLUnescapingDelegate> *delegate)
{
	char *cArray;
	size_t i, length;
	BOOL hasEntities = NO;
	OFMutableString *ret;

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

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

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

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

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

	[ret makeImmutable];

	return ret;
}