summaryrefslogtreecommitdiff
path: root/ZAPD/ZArray.cpp
diff options
context:
space:
mode:
authorlouist103 <35883445+louist103@users.noreply.github.com>2021-04-24 16:42:52 -0400
committerGitHub <noreply@github.com>2021-04-24 16:42:52 -0400
commit6d27dbaab3b32ccebb076895fac3cc6aa3240d6c (patch)
tree601c6ab5bef2f93b6d6ef4ba5506eb04dfb59c9f /ZAPD/ZArray.cpp
parentee8bdea252db4c764f4a2567c32754118fdce10b (diff)
Fix most -Wall warnings (#115)
* started on basic type errors * Done. For now * remove libgfxd binary * Most warnings fixed * Fix conflicts and new warnings * Makefile * Sig * Clang format * destructor * Add a bunch of destructors * clear the scalars vector after freeing the elements * PR fixes (Anghelo Alf) * Fix most clang -Wall warnings
Diffstat (limited to 'ZAPD/ZArray.cpp')
-rw-r--r--ZAPD/ZArray.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/ZAPD/ZArray.cpp b/ZAPD/ZArray.cpp
index dabe526..ac9561b 100644
--- a/ZAPD/ZArray.cpp
+++ b/ZAPD/ZArray.cpp
@@ -10,6 +10,11 @@ ZArray::ZArray(ZFile* nParent) : ZResource(nParent)
canHaveInner = true;
}
+ZArray::~ZArray()
+{
+ delete testFile;
+}
+
void ZArray::ParseXML(tinyxml2::XMLElement* reader)
{
ZResource::ParseXML(reader);
@@ -29,7 +34,7 @@ std::string ZArray::GetSourceOutputCode(const std::string& prefix)
StringHelper::Sprintf("Error! Array needs at least one sub-element.\n"));
ZResource* res = testFile->resources[0];
- int resSize = res->GetRawDataSize();
+ size_t resSize = res->GetRawDataSize();
if (!res->DoesSupportArray())
{
@@ -38,9 +43,9 @@ std::string ZArray::GetSourceOutputCode(const std::string& prefix)
res->GetName().c_str()));
}
- for (int i = 0; i < arrayCnt; i++)
+ for (size_t i = 0; i < arrayCnt; i++)
{
- int childIndex = rawDataIndex + (i * resSize);
+ size_t childIndex = rawDataIndex + (i * resSize);
res->SetRawDataIndex(childIndex);
res->ParseRawData();
std::string test = res->GetSourceOutputCode("");
@@ -58,13 +63,13 @@ std::string ZArray::GetSourceOutputCode(const std::string& prefix)
return "";
}
-int ZArray::GetRawDataSize()
+size_t ZArray::GetRawDataSize()
{
return arrayCnt * testFile->resources[0]->GetRawDataSize();
}
void ZArray::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData,
- const int nRawDataIndex, const std::string& nRelPath)
+ const uint32_t nRawDataIndex, const std::string& nRelPath)
{
rawData = nRawData;
rawDataIndex = nRawDataIndex;