diff --git a/src/include/wxml.h b/src/include/wxml.h index 06296dd..88573a8 100644 --- a/src/include/wxml.h +++ b/src/include/wxml.h @@ -75,7 +75,7 @@ namespace WXML private: /* data */ public: - bool offset_0; + bool offset_0 = false; std::string offset_4; Token(/* args */); ~Token(); diff --git a/src/wxml/dom_lib/str_cache.cpp b/src/wxml/dom_lib/str_cache.cpp index f59ce48..52ce666 100644 --- a/src/wxml/dom_lib/str_cache.cpp +++ b/src/wxml/dom_lib/str_cache.cpp @@ -32,7 +32,10 @@ namespace WXML { { if (!this->offset_0.count(s)) { - this->offset_0[s] = this->offset_0.size(); + // Note: 不能合成一行,否则数量会错误(比实际值大1) + int size = this->offset_0.size(); + this->offset_0[s] = size; + // this->offset_0[s] = this->offset_0.size(); // 会导致size的值比实际大1 this->offset_24.push_back(s); } } @@ -42,6 +45,7 @@ namespace WXML { int result = -1; if(this->offset_0.count(s)) { + // printf("GetStrID: %s, size: %d\n", s.data(), this->offset_0[s]); return this->offset_0[s]; } return result; diff --git a/src/wxml/dom_lib/wxml_dom.cpp b/src/wxml/dom_lib/wxml_dom.cpp index 6a8dec3..5617fba 100644 --- a/src/wxml/dom_lib/wxml_dom.cpp +++ b/src/wxml/dom_lib/wxml_dom.cpp @@ -1498,7 +1498,9 @@ namespace WXML { std::string attr = this->offset_48[v13].ToAttrContent(); if(!this->offset_248->offset_0.count(attr)) { - this->offset_248->offset_0[attr] = this->offset_248->offset_0.size(); + // Note: 不能合成一行,否则数量会错误 + int size = this->offset_248->offset_0.size(); + this->offset_248->offset_0[attr] = size; this->offset_248->offset_24.push_back(attr); } } diff --git a/src/wxml/rpx.cpp b/src/wxml/rpx.cpp index db6eeea..a4e0f79 100644 --- a/src/wxml/rpx.cpp +++ b/src/wxml/rpx.cpp @@ -23,7 +23,7 @@ namespace WXML Table num; /** - * TODO: 逻辑待验证 + * */ int accept(int *a1, uint8_t a2[266], int &a3, char const *a4) { @@ -41,7 +41,7 @@ namespace WXML a4++; } - if (((char *)a2)[v7]) + if (a2[v7]) { a3 = i; return 0;