Skip to content

Commit 7504fdf

Browse files
Fix XML parsing in WASI environment (#4683)
* Fix XML parsing in WASI environment Final chunk of XML document was being skipped when parsing when in a WASI environment * Update XMLParser.swift --------- Co-authored-by: Max Desiatov <m_desiatov@apple.com>
1 parent dfb2d54 commit 7504fdf

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Sources/FoundationXML/XMLParser.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,7 @@ open class XMLParser : NSObject {
601601
var result = true
602602
var chunkStart = 0
603603
var chunkEnd = min(_chunkSize, data.count)
604-
while result {
605-
if chunkStart >= data.count || chunkEnd >= data.count {
606-
break
607-
}
604+
while result && chunkStart < chunkEnd {
608605
let chunk = data[chunkStart..<chunkEnd]
609606
result = parseData(chunk)
610607
chunkStart = chunkEnd

0 commit comments

Comments
 (0)