Skip to content

Commit

Permalink
xrCore: Skip leading spaces and tabs when parsing xml #includes
Browse files Browse the repository at this point in the history
  • Loading branch information
AMS21 committed Nov 8, 2023
1 parent 98f8050 commit 7bfeb41
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/xrCore/XML/XMLDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ void ParseFile(pcstr path, CMemoryWriter& W, IReader* F, XMLDocument* xml)
{
F->r_string(str, sizeof str);

if (str[0] && str[0] == '#' && strstr(str, "#include"))
// Skip any spaces or tabs
const char* begin_of_include = str;
while (*begin_of_include != '\0' && std::isblank(*begin_of_include))
++begin_of_include;

if (std::strncmp(begin_of_include, "#include", 8) == 0)
{
string256 inc_name;
if (_GetItem(str, 1, inc_name, '"'))
if (_GetItem(begin_of_include, 1, inc_name, '"'))
{
IReader* I = nullptr;
tryOpenFile(I, inc_name, UI_PATH, UI_PATH, UI_PATH_WITH_DELIMITER);
Expand Down

0 comments on commit 7bfeb41

Please sign in to comment.