Skip to content

Commit 167e11b

Browse files
committed
Switch to TinyXml2
1 parent b892d2e commit 167e11b

File tree

15 files changed

+4089
-6156
lines changed

15 files changed

+4089
-6156
lines changed

cli/cli.vcxproj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,12 @@
357357
<ResourceCompile Include="version.rc" />
358358
</ItemGroup>
359359
<ItemGroup>
360-
<ClInclude Include="..\externals\tinyxml\tinystr.h" />
361-
<ClInclude Include="..\externals\tinyxml\tinyxml.h" />
360+
<ClInclude Include="..\externals\tinyxml\tinyxml2.h">
361+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
362+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
363+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
364+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
365+
</ClInclude>
362366
<ClInclude Include="..\lib\config.h" />
363367
<ClInclude Include="cmdlineparser.h" />
364368
<ClInclude Include="cppcheckexecutor.h" />
@@ -372,10 +376,12 @@
372376
</ProjectReference>
373377
</ItemGroup>
374378
<ItemGroup>
375-
<ClCompile Include="..\externals\tinyxml\tinystr.cpp" />
376-
<ClCompile Include="..\externals\tinyxml\tinyxml.cpp" />
377-
<ClCompile Include="..\externals\tinyxml\tinyxmlerror.cpp" />
378-
<ClCompile Include="..\externals\tinyxml\tinyxmlparser.cpp" />
379+
<ClCompile Include="..\externals\tinyxml\tinyxml2.cpp">
380+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
381+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
382+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
383+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
384+
</ClCompile>
379385
<ClCompile Include="cmdlineparser.cpp" />
380386
<ClCompile Include="cppcheckexecutor.cpp" />
381387
<ClCompile Include="filelister.cpp" />

cli/cli.vcxproj.filters

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
<ClInclude Include="pathmatch.h">
3333
<Filter>Header Files</Filter>
3434
</ClInclude>
35-
<ClInclude Include="..\externals\tinyxml\tinystr.h">
36-
<Filter>Header Files</Filter>
37-
</ClInclude>
38-
<ClInclude Include="..\externals\tinyxml\tinyxml.h">
35+
<ClInclude Include="..\externals\tinyxml\tinyxml2.h">
3936
<Filter>Header Files</Filter>
4037
</ClInclude>
4138
</ItemGroup>
@@ -58,16 +55,7 @@
5855
<ClCompile Include="cmdlineparser.cpp">
5956
<Filter>Source Files</Filter>
6057
</ClCompile>
61-
<ClCompile Include="..\externals\tinyxml\tinystr.cpp">
62-
<Filter>Source Files</Filter>
63-
</ClCompile>
64-
<ClCompile Include="..\externals\tinyxml\tinyxml.cpp">
65-
<Filter>Source Files</Filter>
66-
</ClCompile>
67-
<ClCompile Include="..\externals\tinyxml\tinyxmlerror.cpp">
68-
<Filter>Source Files</Filter>
69-
</ClCompile>
70-
<ClCompile Include="..\externals\tinyxml\tinyxmlparser.cpp">
58+
<ClCompile Include="..\externals\tinyxml\tinyxml2.cpp">
7159
<Filter>Source Files</Filter>
7260
</ClCompile>
7361
</ItemGroup>

cli/cmdlineparser.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#ifdef HAVE_RULES
3434
// xml is used in rules
35-
#include <tinyxml.h>
35+
#include <tinyxml2.h>
3636
#endif
3737

3838
static void AddFilesToList(const std::string& FileList, std::vector<std::string>& PathNames)
@@ -587,28 +587,28 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
587587

588588
// Rule file
589589
else if (std::strncmp(argv[i], "--rule-file=", 12) == 0) {
590-
TiXmlDocument doc;
591-
if (doc.LoadFile(12+argv[i])) {
592-
TiXmlElement *node = doc.FirstChildElement();
593-
for (; node && node->ValueStr() == "rule"; node = node->NextSiblingElement()) {
590+
tinyxml2::XMLDocument doc;
591+
if (doc.LoadFile(12+argv[i]) == tinyxml2::XML_NO_ERROR) {
592+
tinyxml2::XMLElement *node = doc.FirstChildElement();
593+
for (; node && strcmp(node->Value(), "rule") == 0; node = node->NextSiblingElement()) {
594594
Settings::Rule rule;
595595

596-
TiXmlElement *pattern = node->FirstChildElement("pattern");
596+
tinyxml2::XMLElement *pattern = node->FirstChildElement("pattern");
597597
if (pattern) {
598598
rule.pattern = pattern->GetText();
599599
}
600600

601-
TiXmlElement *message = node->FirstChildElement("message");
601+
tinyxml2::XMLElement *message = node->FirstChildElement("message");
602602
if (message) {
603-
TiXmlElement *severity = message->FirstChildElement("severity");
603+
tinyxml2::XMLElement *severity = message->FirstChildElement("severity");
604604
if (severity)
605605
rule.severity = severity->GetText();
606606

607-
TiXmlElement *id = message->FirstChildElement("id");
607+
tinyxml2::XMLElement *id = message->FirstChildElement("id");
608608
if (id)
609609
rule.id = id->GetText();
610610

611-
TiXmlElement *summary = message->FirstChildElement("summary");
611+
tinyxml2::XMLElement *summary = message->FirstChildElement("summary");
612612
if (summary)
613613
rule.summary = summary->GetText();
614614
}

0 commit comments

Comments
 (0)