From 6e9f82312178d1fbc002a04ce97cf8b5add1f402 Mon Sep 17 00:00:00 2001 From: petrie911 <69443847+petrie911@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:31:25 -0500 Subject: [PATCH] Fix segfault issue with headers (#48) * segfault * fix segfault --- src/Companion.cpp | 4 ++-- src/factories/sf64/MessageLookupFactory.cpp | 1 + src/factories/sf64/ObjInitFactory.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Companion.cpp b/src/Companion.cpp index d52b40d..4b2b234 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -786,7 +786,7 @@ void Companion::Process() { SPDLOG_WARN("Creating pad of 0x{:X} bytes", gap); const auto padfile = this->gCurrentDirectory.filename().string(); if(this->IsDebug()){ - stream << "// 0x" << std::hex << startptr << "\n"; + stream << "// 0x" << std::hex << std::uppercase << startptr << "\n"; } stream << "char pad_" << padfile << "_" << std::to_string(gCurrentPad++) << "[] = {\n" << tab; auto gapSize = gap & ~3; @@ -795,7 +795,7 @@ void Companion::Process() { } stream << "\n};\n"; if(this->IsDebug()){ - stream << "// 0x" << std::hex << end << "\n\n"; + stream << "// 0x" << std::hex << std::uppercase << end << "\n\n"; } else { stream << "\n"; } diff --git a/src/factories/sf64/MessageLookupFactory.cpp b/src/factories/sf64/MessageLookupFactory.cpp index 6a7b221..5317a40 100644 --- a/src/factories/sf64/MessageLookupFactory.cpp +++ b/src/factories/sf64/MessageLookupFactory.cpp @@ -13,6 +13,7 @@ ExportResult SF64::MessageLookupHeaderExporter::Export(std::ostream &write, std: } write << "extern MsgLookup " << symbol << "[];\n"; + return std::nullopt; } ExportResult SF64::MessageLookupCodeExporter::Export(std::ostream &write, std::shared_ptr raw, std::string& entryName, YAML::Node &node, std::string* replacement ) { diff --git a/src/factories/sf64/ObjInitFactory.cpp b/src/factories/sf64/ObjInitFactory.cpp index 791535c..8a18033 100644 --- a/src/factories/sf64/ObjInitFactory.cpp +++ b/src/factories/sf64/ObjInitFactory.cpp @@ -14,6 +14,7 @@ ExportResult SF64::ObjInitHeaderExporter::Export(std::ostream &write, std::share } write << "extern ObjectInit " << symbol << "[];\n"; + return std::nullopt; } ExportResult SF64::ObjInitCodeExporter::Export(std::ostream &write, std::shared_ptr raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {