Differences From Artifact [46e3e8dd49]:
- File src/OFString+XMLUnescaping.m — part of check-in [e6fd39d11e] at 2011-09-12 19:57:39 on branch trunk — Rename -[cString] to -[UTF8String]. (user: js, size: 6675) [annotate] [blame] [check-ins using]
To Artifact [5784ae8273]:
- File
src/OFString+XMLUnescaping.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: 6717) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
136 137 138 139 140 141 142 | pool = [[OFAutoreleasePool alloc] init]; tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) @throw [OFInvalidEncodingException | | | | | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | pool = [[OFAutoreleasePool alloc] init]; tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; } else if (delegate != nil) { OFAutoreleasePool *pool; OFString *n, *tmp; pool = [[OFAutoreleasePool alloc] init]; n = [OFString stringWithUTF8String: entity length: entityLength]; tmp = [delegate string: self containsUnknownEntityNamed: n]; if (tmp == nil) @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; } else @throw [OFInvalidEncodingException exceptionWithClass: isa]; last = i + 1; inEntity = NO; } } if (inEntity) @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendUTF8String: string + last withLength: i - last]; [ret makeImmutable]; return ret; |
︙ | ︙ | |||
238 239 240 241 242 243 244 | pool = [[OFAutoreleasePool alloc] init]; tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) @throw [OFInvalidEncodingException | | | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | pool = [[OFAutoreleasePool alloc] init]; tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; } else { OFAutoreleasePool *pool; OFString *entityString, *tmp; pool = [[OFAutoreleasePool alloc] init]; entityString = [OFString stringWithUTF8String: entity length: entityLength]; tmp = block(self, entityString); if (tmp == nil) @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendString: tmp]; [pool release]; } last = i + 1; inEntity = NO; } } if (inEntity) @throw [OFInvalidEncodingException exceptionWithClass: isa]; [ret appendUTF8String: string + last withLength: i - last]; [ret makeImmutable]; return ret; } #endif @end |