From 16bcfacd79ecbf18ee6231a430654f44035e6d94 Mon Sep 17 00:00:00 2001 From: msojocs Date: Sun, 30 Jul 2023 14:05:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/wxml.h | 2 +- src/wxml/compiler.cpp | 8 ++++++-- src/wxml/dom_lib/tokenizer.cpp | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/include/wxml.h b/src/include/wxml.h index 3f0a566..f2da799 100644 --- a/src/include/wxml.h +++ b/src/include/wxml.h @@ -206,7 +206,7 @@ namespace WXML /* data */ std::string fileContent; std::string fileName; - WXML::DOMLib::Machine machine; // this + 2 + WXML::DOMLib::Machine machine; // this->offset_8 public: Tokenizer(char const* fileContent, std::string const& filePath); Tokenizer(/* args */); diff --git a/src/wxml/compiler.cpp b/src/wxml/compiler.cpp index 4f2f702..1a8f9af 100644 --- a/src/wxml/compiler.cpp +++ b/src/wxml/compiler.cpp @@ -26,7 +26,7 @@ namespace WXML{ bool b1, // mark指定运算结果是否非0 a12 bool b2) // mark指定运算结果是否非0 a13 { - int pResult; + int pResult = 0; bool isWxml = filePath.substr(filePath.length() - 5) == ".wxml"; if (isWxml) { @@ -235,6 +235,10 @@ namespace WXML{ (mark & 4) != 0, // a11 -> mark a12 (mark & 0x20) != 0); // a13 // printf("parse result: %d", parseResult); + if (parseResult) + { + return parseResult; + } } // mark - 5 std::shared_ptr v301_localCommonStream1(new std::stringstream()); // v301 @@ -295,7 +299,7 @@ namespace WXML{ for (auto j: i.second) { info << j << " "; - if (v304.find( j) == v304.end()) + if (v304.find(j) == v304.end()) { errorMessage = "WXML file not found: " + j; return -1152; diff --git a/src/wxml/dom_lib/tokenizer.cpp b/src/wxml/dom_lib/tokenizer.cpp index 42128b6..912c352 100644 --- a/src/wxml/dom_lib/tokenizer.cpp +++ b/src/wxml/dom_lib/tokenizer.cpp @@ -8,6 +8,7 @@ namespace WXML Tokenizer::Tokenizer(char const* fileContent, std::string const& filePath) { this->fileContent = std::string(fileContent); + this->fileContent.resize(this->fileContent.size() + 1); this->fileName = filePath; WXML::DOMLib::Machine m(filePath); this->machine = m;