Differences From Artifact [743856ba0d]:
- File
src/OFString+XMLUnescaping.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 5096) [annotate] [blame] [check-ins using]
To Artifact [d6e6b667b8]:
- File
src/OFString+XMLUnescaping.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 5104) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
21 22 23 24 25 26 27 | #import "OFString.h" #import "OFInvalidFormatException.h" #import "OFUnknownXMLEntityException.h" int _OFString_XMLUnescaping_reference; | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFString.h" #import "OFInvalidFormatException.h" #import "OFUnknownXMLEntityException.h" int _OFString_XMLUnescaping_reference; static OF_INLINE OFString * parseNumericEntity(const char *entity, size_t length) { of_unichar_t c; size_t i; char buffer[5]; if (length == 1 || *entity != '#') |
︙ | ︙ | |||
69 70 71 72 73 74 75 | return nil; buffer[i] = 0; return [OFString stringWithUTF8String: buffer length: i]; } | | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | return nil; buffer[i] = 0; return [OFString stringWithUTF8String: buffer length: i]; } static OFString * parseEntities(OFString *self, id (*lookup)(void *, OFString *, OFString *), void *context) { OFMutableString *ret; void *pool; const char *string; size_t i, last, length; bool inEntity; |
︙ | ︙ | |||
201 202 203 204 205 206 207 | return nil; return block(self, entity); } #endif @implementation OFString (XMLUnescaping) | | | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | return nil; return block(self, entity); } #endif @implementation OFString (XMLUnescaping) - (OFString *)stringByXMLUnescaping { return [self stringByXMLUnescapingWithDelegate: nil]; } - (OFString *)stringByXMLUnescapingWithDelegate: (id <OFStringXMLUnescapingDelegate>)delegate { return parseEntities(self, lookupUsingDelegate, delegate); } #ifdef OF_HAVE_BLOCKS - (OFString *)stringByXMLUnescapingWithBlock: (of_string_xml_unescaping_block_t)block { return parseEntities(self, lookupUsingBlock, block); } #endif @end |