From 2442bb46c581c2d44a4cc4df3a9774c4490a4c7e Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 1 Jun 2020 16:41:46 +0200 Subject: [PATCH] Fix several compiler warnings --- relocator/src/ModuleDataPersistence.cpp | 4 ++-- relocator/src/entry.cpp | 1 - relocator/src/hooks.cpp | 2 +- source/module/ExportData.h | 2 +- source/module/HookData.h | 2 +- source/module/ModuleDataPersistence.cpp | 4 ++-- source/module/SectionInfo.h | 4 ++-- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/relocator/src/ModuleDataPersistence.cpp b/relocator/src/ModuleDataPersistence.cpp index 47821d5..ec372f8 100644 --- a/relocator/src/ModuleDataPersistence.cpp +++ b/relocator/src/ModuleDataPersistence.cpp @@ -38,7 +38,7 @@ std::vector ModuleDataPersistence::loadModuleData(module_information for (uint32_t j = 0; j < EXPORT_ENTRY_LIST_LENGTH; j++) { export_data_t *export_entry = &(module_data->export_entries[j]); - if (export_entry->address == NULL) { + if (export_entry->address == 0) { continue; } moduleData.addExportData(ExportData(static_cast(export_entry->type), export_entry->name, reinterpret_cast(export_entry->address))); @@ -46,7 +46,7 @@ std::vector ModuleDataPersistence::loadModuleData(module_information for (uint32_t j = 0; j < HOOK_ENTRY_LIST_LENGTH; j++) { hook_data_t *hook_entry = &(module_data->hook_entries[j]); - if (hook_entry->target == NULL) { + if (hook_entry->target == 0) { continue; } moduleData.addHookData(HookData(static_cast(hook_entry->type), reinterpret_cast(hook_entry->target))); diff --git a/relocator/src/entry.cpp b/relocator/src/entry.cpp index 72a1778..17aa9e0 100644 --- a/relocator/src/entry.cpp +++ b/relocator/src/entry.cpp @@ -97,7 +97,6 @@ bool doRelocation(std::vector &relocData, relocation_trampolin_e bool ResolveRelocations(const std::vector &loadedModules, bool replaceAllocFunctions) { bool wasSuccessful = true; - uint32_t count = 0; for (auto const &curModule : loadedModules) { DEBUG_FUNCTION_LINE("Let's do the relocations for %s\n", curModule.getExportName().c_str()); diff --git a/relocator/src/hooks.cpp b/relocator/src/hooks.cpp index 9415b8b..d84c3e2 100644 --- a/relocator/src/hooks.cpp +++ b/relocator/src/hooks.cpp @@ -20,7 +20,7 @@ void CallHook(const std::vector &modules, wums_hook_type_t type) { curHook.getType() == WUMS_HOOK_INIT_WUT || curHook.getType() == WUMS_HOOK_FINI_WUT) { uint32_t func_ptr = (uint32_t) curHook.getTarget(); - if (func_ptr == NULL) { + if (func_ptr == 0) { DEBUG_FUNCTION_LINE("Hook ptr was NULL\n"); } else { DEBUG_FUNCTION_LINE("Calling for module [%s]\n", curModule.getExportName().c_str()); diff --git a/source/module/ExportData.h b/source/module/ExportData.h index 80b571b..4c86306 100644 --- a/source/module/ExportData.h +++ b/source/module/ExportData.h @@ -11,7 +11,7 @@ public: this->address = address; } - const wums_entry_type_t getType() const { + wums_entry_type_t getType() const { return type; } diff --git a/source/module/HookData.h b/source/module/HookData.h index cf90a3c..1320f35 100644 --- a/source/module/HookData.h +++ b/source/module/HookData.h @@ -9,7 +9,7 @@ public: this->target = target; } - const wums_hook_type_t getType() const { + wums_hook_type_t getType() const { return type; } diff --git a/source/module/ModuleDataPersistence.cpp b/source/module/ModuleDataPersistence.cpp index c473f44..3328d63 100644 --- a/source/module/ModuleDataPersistence.cpp +++ b/source/module/ModuleDataPersistence.cpp @@ -31,7 +31,7 @@ bool ModuleDataPersistence::saveModuleData(module_information_t *moduleInformati bool found = false; for (uint32_t j = 0; j < EXPORT_ENTRY_LIST_LENGTH; j++) { export_data_t *export_entry = &(module_data->export_entries[j]); - if (export_entry->address == NULL) { + if (export_entry->address == 0) { export_entry->type = curExport.getType(); strncpy(export_entry->name, curExport.getName().c_str(), EXPORT_MAXIMUM_NAME_LENGTH); export_entry->address = (uint32_t) curExport.getAddress(); @@ -50,7 +50,7 @@ bool ModuleDataPersistence::saveModuleData(module_information_t *moduleInformati bool found = false; for (uint32_t j = 0; j < HOOK_ENTRY_LIST_LENGTH; j++) { hook_data_t *hook_entry = &(module_data->hook_entries[j]); - if (hook_entry->target == NULL) { + if (hook_entry->target == 0) { hook_entry->type = curHook.getType(); hook_entry->target = (uint32_t) curHook.getTarget(); found = true; diff --git a/source/module/SectionInfo.h b/source/module/SectionInfo.h index c7ea72b..98d9544 100644 --- a/source/module/SectionInfo.h +++ b/source/module/SectionInfo.h @@ -46,11 +46,11 @@ public: return name; } - const uint32_t getAddress() const { + uint32_t getAddress() const { return address; } - const uint32_t getSize() const { + uint32_t getSize() const { return sectionSize; }