summaryrefslogtreecommitdiff
path: root/ZAPD/ZFile.cpp
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2023-04-29 22:02:24 -0400
committerGitHub <noreply@github.com>2023-04-29 22:02:24 -0400
commitcb6da2e5a70f22df309268d998b89869851f4a2d (patch)
treef2dea6f44350763f55fcc1a8c88b12a74a3467c1 /ZAPD/ZFile.cpp
parent546f01cbfe2f1d7ed7f3e69f967ad84c10e7b10b (diff)
Better checks for hex digits in XMLs (#279)
* Better checking * cleanup logic and explain with a better comment * cleanups * last cleanup * the last one for real
Diffstat (limited to 'ZAPD/ZFile.cpp')
-rw-r--r--ZAPD/ZFile.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp
index 0977650..ad56f98 100644
--- a/ZAPD/ZFile.cpp
+++ b/ZAPD/ZFile.cpp
@@ -213,14 +213,12 @@ void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename)
// Check for repeated attributes.
if (offsetXml != nullptr)
{
- std::string offsetStr = StringHelper::Split(offsetXml, "0x")[1];
- if (!StringHelper::HasOnlyHexDigits(offsetStr))
+ if (!StringHelper::IsValidOffset(std::string_view(offsetXml)))
{
HANDLE_ERROR(WarningType::InvalidXML,
- StringHelper::Sprintf("Invalid offset %s entered", offsetStr.c_str()),
- "");
+ StringHelper::Sprintf("Invalid offset %s entered", offsetXml), "");
}
- rawDataIndex = strtol(offsetStr.c_str(), NULL, 16);
+ rawDataIndex = strtol(offsetXml, NULL, 16);
if (offsetSet.find(offsetXml) != offsetSet.end())
{