From 7c7c82fa43a10f89a8842ea51dca34f68a1a846d Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 15 Nov 2025 00:50:05 +0800 Subject: improve find in xml --- xmake/core/base/xml.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xmake/core/base/xml.lua b/xmake/core/base/xml.lua index 07260959c..9bcbe420c 100644 --- a/xmake/core/base/xml.lua +++ b/xmake/core/base/xml.lua @@ -290,7 +290,7 @@ function xml.decode(data, opt) table.insert(children, xml.cdata(value)) i = close + 3 elseif data:sub(lt + 1, lt + 8):upper() == "!DOCTYPE" then - local close = data:find(">", lt + 8) + local close = data:find(">", lt + 8, true) if not close then return nil, "unterminated doctype declaration" end @@ -306,13 +306,13 @@ function xml.decode(data, opt) end i = close + 2 elseif data:sub(lt + 1, lt + 1) == "!" then - local close = data:find(">", lt + 2) + local close = data:find(">", lt + 2, true) if not close then return nil, "unterminated xml declaration" end i = close + 1 elseif data:sub(lt + 1, lt + 1) == "/" then - local close = data:find(">", lt + 1) + local close = data:find(">", lt + 1, true) if not close then return nil, "unterminated closing tag" end @@ -323,7 +323,7 @@ function xml.decode(data, opt) end i = close + 1 else - local close = data:find(">", lt + 1) + local close = data:find(">", lt + 1, true) if not close then return nil, "unterminated opening tag" end @@ -440,7 +440,7 @@ function xml.scan(data, callback, opt) emit(node) i = close + 3 elseif data:sub(lt + 1, lt + 8):upper() == "!DOCTYPE" then - local close = data:find(">", lt + 8) + local close = data:find(">", lt + 8, true) if not close then return nil, "unterminated doctype declaration" end @@ -458,13 +458,13 @@ function xml.scan(data, callback, opt) end i = close + 2 elseif data:sub(lt + 1, lt + 1) == "!" then - local close = data:find(">", lt + 2) + local close = data:find(">", lt + 2, true) if not close then return nil, "unterminated xml declaration" end i = close + 1 elseif data:sub(lt + 1, lt + 1) == "/" then - local close = data:find(">", lt + 1) + local close = data:find(">", lt + 1, true) if not close then return nil, "unterminated closing tag" end @@ -476,7 +476,7 @@ function xml.scan(data, callback, opt) emit(node) i = close + 1 else - local close = data:find(">", lt + 1) + local close = data:find(">", lt + 1, true) if not close then return nil, "unterminated opening tag" end -- cgit v1.3.1