From 49f19d95c23ae2e0585735587e749958eb8c9af2 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 28 Mar 2021 13:07:14 +0200 Subject: [PATCH] Fix error messages on error when loading gdt --- src/Linker/Linker.cpp | 2 +- src/ObjCommon/Obj/Gdt/GdtStream.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Linker/Linker.cpp b/src/Linker/Linker.cpp index 5e213637..dfebe8a9 100644 --- a/src/Linker/Linker.cpp +++ b/src/Linker/Linker.cpp @@ -397,7 +397,7 @@ class Linker::Impl const auto gdtFile = gdtSearchPath->Open(i->second->m_value + ".gdt"); if (!gdtFile.IsOpen()) { - std::cout << "Failed to open file for gdt \"" << i->second << "\"" << std::endl; + std::cout << "Failed to open file for gdt \"" << i->second->m_value << "\"" << std::endl; return false; } diff --git a/src/ObjCommon/Obj/Gdt/GdtStream.cpp b/src/ObjCommon/Obj/Gdt/GdtStream.cpp index a5944726..4355c347 100644 --- a/src/ObjCommon/Obj/Gdt/GdtStream.cpp +++ b/src/ObjCommon/Obj/Gdt/GdtStream.cpp @@ -126,15 +126,12 @@ bool GdtReader::ReadProperties(GdtEntry& entry) if (!ReadStringContent(propertyKey)) return false; - if (PeekChar() != '"') + if (PeekChar() != '"' || !ReadStringContent(propertyValue)) { PrintError("Expected value string"); return false; } - if (!ReadStringContent(propertyValue)) - return false; - entry.m_properties.emplace(std::move(propertyKey), std::move(propertyValue)); } @@ -207,7 +204,10 @@ bool GdtReader::Read(Gdt& gdt) { NextChar(); if (!ReadStringContent(entry.m_gdf_name)) + { + PrintError("Expected gdf name string"); return false; + } if (NextChar() != ')') { PrintError("Expected closing parenthesis"); @@ -219,7 +219,10 @@ bool GdtReader::Read(Gdt& gdt) NextChar(); std::string parentName; if (!ReadStringContent(parentName)) + { + PrintError("Expected parent name string"); return false; + } if (NextChar() != ']') { PrintError("Expected closing square brackets"); @@ -238,6 +241,7 @@ bool GdtReader::Read(Gdt& gdt) } else { + PrintError("Expected gdf or parent opening"); return false; }