Remove \n in log messages

This commit is contained in:
Maschell
2020-12-28 14:40:53 +01:00
parent 4ef9a90378
commit f7b4b568d2
9 changed files with 29 additions and 29 deletions

View File

@@ -14,7 +14,7 @@ dyn_linking_function_t *DynamicLinkingHelper::getOrAddFunctionEntryByName(dyn_li
dyn_linking_function_t *curEntry = &(data->functions[i]);
if (strlen(curEntry->functionName) == 0) {
if (strlen(functionName) > DYN_LINK_FUNCTION_NAME_LENGTH) {
DEBUG_FUNCTION_LINE("Failed to add function name, it's too long.\n");
DEBUG_FUNCTION_LINE("Failed to add function name, it's too long.");
return nullptr;
}
strncpy(curEntry->functionName, functionName, DYN_LINK_FUNCTION_NAME_LENGTH);
@@ -46,7 +46,7 @@ dyn_linking_import_t *DynamicLinkingHelper::getOrAddImport(dyn_linking_relocatio
dyn_linking_import_t *curEntry = &(data->imports[i]);
if (strlen(curEntry->importName) == 0) {
if (strlen(importName) > DYN_LINK_IMPORT_NAME_LENGTH) {
DEBUG_FUNCTION_LINE("Failed to add Import, it's too long.\n");
DEBUG_FUNCTION_LINE("Failed to add Import, it's too long.");
return nullptr;
}
strncpy(curEntry->importName, importName, DYN_LINK_IMPORT_NAME_LENGTH);
@@ -70,13 +70,13 @@ bool DynamicLinkingHelper::addReloationEntry(dyn_linking_relocation_data_t *link
const std::string &name, const ImportRPLInformation &rplInfo) {
dyn_linking_import_t *importInfoGbl = DynamicLinkingHelper::getOrAddImport(linking_data, rplInfo.getName().c_str(), rplInfo.isData());
if (importInfoGbl == nullptr) {
DEBUG_FUNCTION_LINE("Getting import info failed. Probably maximum of %d rpl files to import reached.\n", DYN_LINK_IMPORT_LIST_LENGTH);
DEBUG_FUNCTION_LINE("Getting import info failed. Probably maximum of %d rpl files to import reached.", DYN_LINK_IMPORT_LIST_LENGTH);
return false;
}
dyn_linking_function_t *functionInfo = DynamicLinkingHelper::getOrAddFunctionEntryByName(linking_data, name.c_str());
if (functionInfo == nullptr) {
DEBUG_FUNCTION_LINE("Getting import info failed. Probably maximum of %d function to be relocated reached.\n", DYN_LINK_FUNCTION_LIST_LENGTH);
DEBUG_FUNCTION_LINE("Getting import info failed. Probably maximum of %d function to be relocated reached.", DYN_LINK_FUNCTION_LIST_LENGTH);
return false;
}

View File

@@ -17,7 +17,7 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t *pluginInformat
//auto pluginPath = plugin.getMetaInformation().getPath();
if (plugin_count >= MAXIMUM_PLUGINS - 1) {
DEBUG_FUNCTION_LINE("Maximum of %d plugins reached. %s won't be loaded!\n", MAXIMUM_PLUGINS, pluginName.c_str());
DEBUG_FUNCTION_LINE("Maximum of %d plugins reached. %s won't be loaded!", MAXIMUM_PLUGINS, pluginName.c_str());
return false;
}
// Copy data to global struct.

View File

@@ -28,12 +28,12 @@ std::vector<PluginData> PluginDataFactory::loadDir(const std::string &path, MEMH
DIR *dfd = nullptr;
if (path.empty()) {
DEBUG_FUNCTION_LINE("Path was empty\n");
DEBUG_FUNCTION_LINE("Path was empty");
return result;
}
if ((dfd = opendir(path.c_str())) == nullptr) {
DEBUG_FUNCTION_LINE("Couldn't open dir %s\n", path.c_str());
DEBUG_FUNCTION_LINE("Couldn't open dir %s", path.c_str());
return result;
}
@@ -42,14 +42,14 @@ std::vector<PluginData> PluginDataFactory::loadDir(const std::string &path, MEMH
std::string full_file_path = StringTools::strfmt("%s/%s", path.c_str(), dp->d_name);
StringTools::RemoveDoubleSlashs(full_file_path);
if (stat(full_file_path.c_str(), &stbuf) == -1) {
DEBUG_FUNCTION_LINE("Unable to stat file: %s\n", full_file_path.c_str());
DEBUG_FUNCTION_LINE("Unable to stat file: %s", full_file_path.c_str());
continue;
}
if ((stbuf.st_mode & S_IFMT) == S_IFDIR) { // Skip directories
continue;
} else {
DEBUG_FUNCTION_LINE("Found file: %s\n", full_file_path.c_str());
DEBUG_FUNCTION_LINE("Found file: %s", full_file_path.c_str());
auto pluginData = load(full_file_path, heapHandle);
if (pluginData) {
result.push_back(pluginData.value());

View File

@@ -75,14 +75,14 @@ std::optional<PluginInformation> PluginInformationFactory::load(const PluginData
}
void *text_data = MEMAllocFromExpHeapEx(heapHandle, text_size, 0x1000);
if (text_data == nullptr) {
DEBUG_FUNCTION_LINE("Failed to alloc memory for the .text section (%d bytes)\n", text_size);
DEBUG_FUNCTION_LINE("Failed to alloc memory for the .text section (%d bytes)", text_size);
return std::nullopt;
}
DEBUG_FUNCTION_LINE("Allocated %d kb from ExpHeap", text_size / 1024);
void *data_data = MEMAllocFromExpHeapEx(heapHandle, data_size, 0x1000);
if (data_data == nullptr) {
DEBUG_FUNCTION_LINE("Failed to alloc memory for the .data section (%d bytes)\n", data_size);
DEBUG_FUNCTION_LINE("Failed to alloc memory for the .data section (%d bytes)", data_size);
MEMFreeToExpHeap(heapHandle, text_data);
return std::nullopt;
@@ -266,7 +266,7 @@ std::vector<RelocationData> PluginInformationFactory::getImportRelocationData(co
rplName = rawSectionName.substr(dimport.size());
isData = true;
} else {
DEBUG_FUNCTION_LINE("invalid section name\n");
DEBUG_FUNCTION_LINE("invalid section name");
continue;
}

View File

@@ -43,7 +43,7 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(co
std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(std::string &filePath) {
elfio reader;
if (!reader.load(filePath)) {
DEBUG_FUNCTION_LINE("Can't find or process ELF file\n");
DEBUG_FUNCTION_LINE("Can't find or process ELF file");
return std::nullopt;
}
return loadPlugin(reader);
@@ -52,7 +52,7 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(st
std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(char *buffer, size_t size) {
elfio reader;
if (!reader.load(buffer, size)) {
DEBUG_FUNCTION_LINE("Can't find or process ELF file\n");
DEBUG_FUNCTION_LINE("Can't find or process ELF file");
return std::nullopt;
}
@@ -115,7 +115,7 @@ std::optional<PluginMetaInformation> PluginMetaInformationFactory::loadPlugin(co
pluginInfo.setDescription(value);
} else if (key.compare("wups") == 0) {
if (value.compare("0.2") != 0) {
DEBUG_FUNCTION_LINE("Warning: Ignoring plugin - Unsupported WUPS version: %s.\n", value.c_str());
DEBUG_FUNCTION_LINE("Warning: Ignoring plugin - Unsupported WUPS version: %s.", value.c_str());
return std::nullopt;
}
}