ObjFW  Diff

Differences From Artifact [8741247447]:

  • File src/OFXMLParser.m — part of check-in [e1e7ffa903] at 2011-09-22 23:25:42 on branch trunk — Exceptions are now autoreleased.

    This is safe as an "exception loop" can't happen, since if allocating
    an exception fails, it throws an OFAllocFailedException which is
    preallocated and can always be thrown.

    So, the worst case would be that an autorelease of an exception fails,
    triggering an OFOutOfMemoryException for which there is no memory,
    resulting in an OFAllocFailedException to be thrown. (user: js, size: 25324) [annotate] [blame] [check-ins using]

To Artifact [7b02ea3041]:


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

static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
    OFObject <OFStringXMLUnescapingDelegate> *delegate)
{
	OFMutableString *ret = [OFMutableString
	    stringWithUTF8String: [cache cArray]
			  length: [cache count]];

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

	if (cut > 0) {
		size_t length = [ret length];

		[ret deleteCharactersInRange: of_range(length - cut, cut)];
	}

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

	[ret makeImmutable];

	return ret;
}







|






<
<
<
<
<
<







62
63
64
65
66
67
68
69
70
71
72
73
74
75






76
77
78
79
80
81
82

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;
}