From a6cab234b6ff9e1c804cd1f0aa24a2ae60ab835e Mon Sep 17 00:00:00 2001 From: msojocs Date: Sun, 6 Aug 2023 21:10:11 +0800 Subject: [PATCH] feat: NewLintAndParseCSSList --- src/wxss/common.cpp | 68 +++++++++++++++++++++++++++++++++++++-- test/wcsc.disassembly.cpp | 10 ++++-- 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/src/wxss/common.cpp b/src/wxss/common.cpp index d038077..f701aeb 100644 --- a/src/wxss/common.cpp +++ b/src/wxss/common.cpp @@ -1,4 +1,5 @@ #include "../include/wxss.h" +#include "../include/wxml.h" namespace WXSS { @@ -55,9 +56,72 @@ namespace WXSS } return ret; } - int NewLintAndParseCSSList(std::map const&, std::vector &, std::string&, std::string&, int, bool, std::string const&, std::string const&) + int NewLintAndParseCSSList( + std::map const& a1, + std::vector & a2, + std::string& a3, + std::string& a4, + int a5, + bool a6, + std::string const& a7, + std::string const& a8) { - throw "not implement"; + WXSS::XCompiler v32(a1, a6, a7); + a4.assign(v32.offset_8); + int ret = v32.offset_0; + if (!v32.offset_0) + { + std::string v21; + ret = v32.GetCommHead(a2, v21, true, a8); + if (!ret) + { + a3 = "version=v0.4me_20190328_db="; + std::string v28 = WXML::Rewrite::ToStringCode2(v21); + v28 = v28.insert(0, "comm="); + v28.append("="); + a3 += v28; + + for (int i = 0; i < a2.size(); i++) + { + std::string v23; + + int pageCss = v32.GetPageCss(a2[i], v23, 2); + if (pageCss) + { + ret = pageCss; + break; + } + std::string v28 = WXML::Rewrite::ToStringCode2(v23); + std::string v25 = a2[i]; + v25.append("="); + int v12 = 15; + int v14 = 15; + int v13 = v25.length() + v28.length(); + + if (v25.length() > 15) + { + v12 = v25.length(); + } + if (v28.length() > 15) + { + v14 = v28.length(); + } + std::string v31; + if (v13 <= v12 || v13 > v14) + { + v31 = v25.append(v28); + } + else + { + v31 = v28.insert(0, v25); + } + v31.append("="); + a3 += v31; + } + + } + } + return ret; } } \ No newline at end of file diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index 830fb60..7b69e20 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -9377,9 +9377,10 @@ struct _Unwind_Exception *__cdecl WXSS::NewLintAndParseCSSList( lpuexcpt = (struct _Unwind_Exception *)v32[0]; if ( !v32[0] ) { - v21[0] = &v22; + v21[0] = &v22; // std::string v21[1] = 0; v22 = 0; + lpuexcpt = (struct _Unwind_Exception *)WXSS::XCompiler::GetCommHead((int)v32, a2, v21, 1, a8); if ( !lpuexcpt ) { @@ -9398,9 +9399,11 @@ struct _Unwind_Exception *__cdecl WXSS::NewLintAndParseCSSList( v10 = *a2; if ( -1431655765 * ((a2[1] - *a2) >> 3) <= i ) break; - v23[0] = &v24; + + v23[0] = &v24; // std::string v23[1] = 0; v24 = 0; + PageCss = WXSS::XCompiler::GetPageCss((char *)v32, (int *)&v10[24 * i], v23, 2); if ( PageCss ) { @@ -9409,6 +9412,7 @@ struct _Unwind_Exception *__cdecl WXSS::NewLintAndParseCSSList( break; } WXML::Rewrite::ToStringCode2((int)v28, (int *)v23); + // byte_50DF9A '\0' std::operator+((int)v25, (char *)&byte_50DF9A, (int)&(*a2)[24 * i]); v11 = std::string::append(v25, "="); std::string::basic_string(v26, v11); @@ -9422,7 +9426,7 @@ struct _Unwind_Exception *__cdecl WXSS::NewLintAndParseCSSList( if ( v28[0] != &v29 ) v14 = v29; if ( (unsigned int)v13 > v14 ) -LABEL_14: + LABEL_14: v15 = std::string::append(v26, (int)v28); else v15 = std::string::insert((unsigned int **)v28, 0, (int)v26);