summaryrefslogtreecommitdiff
path: root/ZAPD/Main.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/Main.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/Main.cpp')
-rw-r--r--ZAPD/Main.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/ZAPD/Main.cpp b/ZAPD/Main.cpp
index cf9efe3..f044f34 100644
--- a/ZAPD/Main.cpp
+++ b/ZAPD/Main.cpp
@@ -33,28 +33,26 @@ void BuildAssetTexture(const std::string& pngFilePath, TextureType texType,
const std::string& outPath);
void BuildAssetBackground(const std::string& imageFilePath, const std::string& outPath);
void BuildAssetBlob(const std::string& blobFilePath, const std::string& outPath);
-void BuildAssetModelIntermediette(const std::string& mdlPath, const std::string& outPath);
+void BuildAssetModelIntermediette(const std::string& outPath);
void BuildAssetAnimationIntermediette(const std::string& animPath, const std::string& outPath);
-int NewMain(int argc, char* argv[]);
-
#if !defined(_MSC_VER) && !defined(__CYGWIN__)
void ErrorHandler(int sig)
{
void* array[4096];
- const int nMaxFrames = sizeof(array) / sizeof(array[0]);
+ const size_t nMaxFrames = sizeof(array) / sizeof(array[0]);
size_t size = backtrace(array, nMaxFrames);
char** symbols = backtrace_symbols(array, nMaxFrames);
for (size_t i = 1; i < size; i++)
{
Dl_info info;
- int gotAddress = dladdr(array[i], &info);
+ uint32_t gotAddress = dladdr(array[i], &info);
string functionName(symbols[i]);
if (gotAddress != 0 && info.dli_sname != nullptr)
{
- int status;
+ int32_t status;
char* demangled = abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, &status);
const char* nameFound = info.dli_sname;
@@ -79,12 +77,6 @@ void ErrorHandler(int sig)
int main(int argc, char* argv[])
{
- Globals* g = new Globals();
- return NewMain(argc, argv);
-}
-
-int NewMain(int argc, char* argv[])
-{
// Syntax: ZAPD.exe [mode (btex/bovl/e)] (Arbritrary Number of Arguments)
if (argc < 2)
@@ -93,6 +85,8 @@ int NewMain(int argc, char* argv[])
return 1;
}
+ Globals* g = new Globals();
+
// Parse File Mode
string buildMode = argv[1];
ZFileMode fileMode = ZFileMode::Invalid;
@@ -121,7 +115,7 @@ int NewMain(int argc, char* argv[])
}
// Parse other "commands"
- for (int i = 2; i < argc; i++)
+ for (int32_t i = 2; i < argc; i++)
{
string arg = argv[i];
@@ -252,8 +246,7 @@ int NewMain(int argc, char* argv[])
}
else if (fileMode == ZFileMode::BuildModelIntermediette)
{
- BuildAssetModelIntermediette(Globals::Instance->inputPath,
- Globals::Instance->outputPath);
+ BuildAssetModelIntermediette(Globals::Instance->outputPath);
}
else if (fileMode == ZFileMode::BuildAnimationIntermediette)
{
@@ -270,11 +263,11 @@ int NewMain(int argc, char* argv[])
File::WriteAllText(Globals::Instance->outputPath, overlay->GetSourceOutputCode(""));
}
}
- catch (std::runtime_error e)
+ catch (std::runtime_error& e)
{
printf("Exception occurred: %s\n", e.what());
}
-
+ delete g;
return 0;
}
@@ -371,7 +364,7 @@ void BuildAssetBlob(const std::string& blobFilePath, const std::string& outPath)
delete blob;
}
-void BuildAssetModelIntermediette(const std::string& mdlPath, const std::string& outPath)
+void BuildAssetModelIntermediette(const std::string& outPath)
{
XMLDocument doc;