Fix error messages on error when loading gdt

This commit is contained in:
Jan 2021-03-28 13:07:14 +02:00
parent 41b4fb8c9a
commit 49f19d95c2
2 changed files with 9 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;
}