From 44b65558ef0be9eafd214503d0c36b48499a1104 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 7 Jun 2020 14:17:02 +0200 Subject: [PATCH] Fix compiler warnings --- source/elfio/elfio_relocation.hpp | 2 +- source/module/ModuleDataFactory.cpp | 2 +- source/module/ModuleDataPersistence.cpp | 6 +++--- source/utils/StringTools.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/elfio/elfio_relocation.hpp b/source/elfio/elfio_relocation.hpp index 4a3fab0..07bf77f 100644 --- a/source/elfio/elfio_relocation.hpp +++ b/source/elfio/elfio_relocation.hpp @@ -144,7 +144,7 @@ class relocation_section_accessor_template Elf_Half& section) const { // Do regular job - Elf_Word symbol; + Elf_Word symbol = 0; bool ret = get_entry( index, offset, symbol, type, addend ); // Find the symbol diff --git a/source/module/ModuleDataFactory.cpp b/source/module/ModuleDataFactory.cpp index 2148d73..a07ff5e 100644 --- a/source/module/ModuleDataFactory.cpp +++ b/source/module/ModuleDataFactory.cpp @@ -249,7 +249,7 @@ std::vector ModuleDataFactory::getImportRelocationData(elfio &re break; } - uint32_t adjusted_sym_value = (uint32_t) sym_value; + // uint32_t adjusted_sym_value = (uint32_t) sym_value; if(infoMap.count(sym_section_index) == 0){ continue; } diff --git a/source/module/ModuleDataPersistence.cpp b/source/module/ModuleDataPersistence.cpp index 5693516..68bb6b9 100644 --- a/source/module/ModuleDataPersistence.cpp +++ b/source/module/ModuleDataPersistence.cpp @@ -109,7 +109,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))); @@ -117,7 +117,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))); @@ -125,7 +125,7 @@ std::vector ModuleDataPersistence::loadModuleData(module_information for (uint32_t j = 0; j < DYN_LINK_RELOCATION_LIST_LENGTH; j++) { dyn_linking_relocation_entry_t *linking_entry = &(module_data->linking_entries[j]); - if (linking_entry->destination == NULL) { + if (linking_entry->destination == 0) { break; } dyn_linking_import_t *importEntry = linking_entry->importEntry; diff --git a/source/utils/StringTools.cpp b/source/utils/StringTools.cpp index d5c366f..a97e3b9 100644 --- a/source/utils/StringTools.cpp +++ b/source/utils/StringTools.cpp @@ -259,12 +259,12 @@ char *StringTools::str_replace(char *orig, char *rep, char *with) { if (len_rep == 0) return NULL; // empty rep causes infinite loop during count if (!with) - with = ""; + with = (char *) ""; len_with = strlen(with); // count the number of replacements needed ins = orig; - for (count = 0; tmp = strstr(ins, rep); ++count) { + for (count = 0; (tmp = strstr(ins, rep)); ++count) { ins = tmp + len_rep; }