Overview
Comment: | OFXML*: Remember delimiter of attributes
This means that if OFXMLParser parsed double-quoted attributes, |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0ec6f9c1d94c83987d8ce54f007132d5 |
User & Date: | js on 2018-06-16 14:36:35 |
Other Links: | manifest | tags |
Context
2018-06-16
| ||
15:50 | Move OFLHAArchive_LHStream to a separate file check-in: 3d7f5098f2 user: js tags: trunk | |
14:36 | OFXML*: Remember delimiter of attributes check-in: 0ec6f9c1d9 user: js tags: trunk | |
14:21 | OFXMLElement: Add a few extra type checks check-in: 3af65b5d98 user: js tags: trunk | |
Changes
Modified src/OFXMLAttribute.h from [a635c9f146] to [bfa69118b1].
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | */ @interface OFXMLAttribute: OFXMLNode { #if defined(OF_XML_ELEMENT_M) || defined(OF_XML_PARSER_M) @public #endif OFString *_name, *_Nullable _namespace, *_stringValue; } /*! * @brief The name of the attribute. */ @property (readonly, nonatomic) OFString *name; | > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | */ @interface OFXMLAttribute: OFXMLNode { #if defined(OF_XML_ELEMENT_M) || defined(OF_XML_PARSER_M) @public #endif OFString *_name, *_Nullable _namespace, *_stringValue; bool _useDoubleQuotes; } /*! * @brief The name of the attribute. */ @property (readonly, nonatomic) OFString *name; |
︙ | ︙ |
Modified src/OFXMLElement.m from [0b50609229] to [8558828739].
︙ | ︙ | |||
521 522 523 524 525 526 527 | i += [_namespace UTF8StringLength]; cString[i++] = '\''; } /* Attributes */ for (OFXMLAttribute *attribute in _attributes) { void *pool2 = objc_autoreleasePoolPush(); | > > | > > | | | | | < | | | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | i += [_namespace UTF8StringLength]; cString[i++] = '\''; } /* Attributes */ for (OFXMLAttribute *attribute in _attributes) { void *pool2 = objc_autoreleasePoolPush(); const char *attributeNameCString = [attribute->_name UTF8String]; size_t attributeNameLength = [attribute->_name UTF8StringLength]; OFString *attributePrefix = nil; OFString *tmp = [[attribute stringValue] stringByXMLEscaping]; char delimiter = (attribute->_useDoubleQuotes ? '"' : '\''); if (attribute->_namespace != nil && (attributePrefix = [allNamespaces objectForKey: attribute->_namespace]) == nil) @throw [OFUnboundNamespaceException exceptionWithNamespace: [attribute namespace] element: self]; length += attributeNameLength + (attributePrefix != nil ? [attributePrefix UTF8StringLength] + 1 : 0) + [tmp UTF8StringLength] + 4; @try { cString = [self resizeMemory: cString size: length]; } @catch (id e) { [self freeMemory: cString]; @throw e; } cString[i++] = ' '; if (attributePrefix != nil) { memcpy(cString + i, [attributePrefix UTF8String], [attributePrefix UTF8StringLength]); i += [attributePrefix UTF8StringLength]; cString[i++] = ':'; } memcpy(cString + i, attributeNameCString, attributeNameLength); i += attributeNameLength; cString[i++] = '='; cString[i++] = delimiter; memcpy(cString + i, [tmp UTF8String], [tmp UTF8StringLength]); i += [tmp UTF8StringLength]; cString[i++] = delimiter; objc_autoreleasePoolPop(pool2); } /* Children */ if (_children != nil) { OFMutableData *tmp = [OFMutableData data]; |
︙ | ︙ |
Modified src/OFXMLParser.m from [3d72b3b75b] to [a92d1baa88].
︙ | ︙ | |||
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | /* Looking for attribute value */ - (void)of_inAttributeValueState { void *pool; OFString *attributeValue; size_t length; if (_data[_i] != _delimiter) return; if ((length = _i - _last) > 0) appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); attributeValue = transformString(self, _buffer, 0, true); if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: @""]; if ([_attributePrefix isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: _attributeName]; | > < | | | > > | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | /* Looking for attribute value */ - (void)of_inAttributeValueState { void *pool; OFString *attributeValue; size_t length; OFXMLAttribute *attribute; if (_data[_i] != _delimiter) return; if ((length = _i - _last) > 0) appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); attributeValue = transformString(self, _buffer, 0, true); if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: @""]; if ([_attributePrefix isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: _attributeName]; attribute = [OFXMLAttribute attributeWithName: _attributeName namespace: _attributePrefix stringValue: attributeValue]; attribute->_useDoubleQuotes = (_delimiter == '"'); [_attributes addObject: attribute]; objc_autoreleasePoolPop(pool); [_buffer removeAllItems]; [_attributeName release]; [_attributePrefix release]; _attributeName = _attributePrefix = nil; |
︙ | ︙ |