Fix bug in SAXEqualTags.

This commit is contained in:
Brent Simmons
2024-08-26 23:02:22 -07:00
parent 6966b8a7aa
commit 13b467186c
3 changed files with 5 additions and 4 deletions

View File

@@ -103,6 +103,7 @@ extension OPMLParser: SAXParserDelegate {
if let item = currentItem as? OPMLDocument {
item.title = saxParser.currentStringWithTrimmedWhitespace
}
saxParser.endStoringCharacters()
return
}

View File

@@ -85,7 +85,7 @@ public final class SAXParser {
characters.count = 0
}
func endStoringCharacters() {
public func endStoringCharacters() {
storingCharacters = false
characters.count = 0

View File

@@ -12,9 +12,9 @@ public func SAXEqualTags(_ localName: XMLPointer, _ tag: ContiguousArray<Int8>)
return tag.withUnsafeBufferPointer { bufferPointer in
let tagCount = tag.count
let tagCount = tag.count // includes 0 terminator
for i in 0..<tagCount {
for i in 0..<tagCount - 1 {
let localNameCharacter = localName[i]
if localNameCharacter == 0 {
@@ -28,6 +28,6 @@ public func SAXEqualTags(_ localName: XMLPointer, _ tag: ContiguousArray<Int8>)
}
// localName might actually be longer  make sure its the same length as tag.
return localName[tagCount] == 0
return localName[tagCount - 1] == 0
}
}