Overview
Comment: | Use memset() for indentation in OFXMLElement. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
af23d890f1ce9e423efdb02c099e5488 |
User & Date: | js on 2011-06-06 16:28:49 |
Other Links: | manifest | tags |
Context
2011-06-07
| ||
14:10 | Small changes to OF_SETTER/OF_GETTER. check-in: 9e2ea02a08 user: js tags: trunk | |
2011-06-06
| ||
16:28 | Use memset() for indentation in OFXMLElement. check-in: af23d890f1 user: js tags: trunk | |
16:19 | Add -Wsemicolon-before-method-body if available. check-in: 831997311c user: js tags: trunk | |
Changes
Modified src/OFXMLElement.m from [e91819cfc0] to [53deb299eb].
︙ | ︙ | |||
526 527 528 529 530 531 532 | else defaultNS = defaultNamespace; i = 0; length = [name cStringLength] + 3 + (level * indentation); cString = [self allocMemoryWithSize: length]; | > | < | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | else defaultNS = defaultNamespace; i = 0; length = [name cStringLength] + 3 + (level * indentation); cString = [self allocMemoryWithSize: length]; memset(cString + i, ' ', level * indentation); i += level * indentation; /* Start of tag */ cString[i++] = '<'; if (prefix != nil && ![ns isEqual: defaultNS]) { length += [prefix cStringLength] + 1; @try { |
︙ | ︙ | |||
672 673 674 675 676 677 678 | } cString[i++] = '>'; memcpy(cString + i, [tmp cString], [tmp cStringLength]); i += [tmp cStringLength]; | | > | < > | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | } cString[i++] = '>'; memcpy(cString + i, [tmp cString], [tmp cStringLength]); i += [tmp cStringLength]; if (indent) { memset(cString + i, ' ', level * indentation); i += level * indentation; } cString[i++] = '<'; cString[i++] = '/'; if (prefix != nil) { length += [prefix cStringLength] + 1; @try { cString = [self resizeMemory: cString |
︙ | ︙ |
Modified tests/OFXMLElementTests.m from [0c7d40f6d8] to [6d538f8842].
︙ | ︙ | |||
132 133 134 135 136 137 138 | TEST(@"-[isEqual:]", [[OFXMLElement elementWithXMLString: @"<foo bar='asd'/>"] isEqual: [OFXMLElement elementWithXMLString: @"<foo bar='asd'></foo>"]] && [[OFXMLElement elementWithXMLString: @"<x><y/></x>"] isEqual: [OFXMLElement elementWithXMLString: @"<x><y></y></x>"]]) TEST(@"-[XMLStringWithIndentation:]", | | | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | TEST(@"-[isEqual:]", [[OFXMLElement elementWithXMLString: @"<foo bar='asd'/>"] isEqual: [OFXMLElement elementWithXMLString: @"<foo bar='asd'></foo>"]] && [[OFXMLElement elementWithXMLString: @"<x><y/></x>"] isEqual: [OFXMLElement elementWithXMLString: @"<x><y></y></x>"]]) TEST(@"-[XMLStringWithIndentation:]", [[[OFXMLElement elementWithXMLString: @"<x><y><z>a\nb</z>" @"<!-- foo --></y></x>"] XMLStringWithIndentation: 2] isEqual: @"<x>\n <y>\n <z>a\nb</z>\n <!-- foo -->\n </y>\n</x>"]) [pool drain]; } @end |