Commit 4937b22a authored by Volker Krause's avatar Volker Krause
Browse files

Fix string table generation for filenames containing quotes or backslashes

parent d9c73084
......@@ -20,11 +20,23 @@ std::size_t StringTable::stringOffset(const QString &s) const
return entryOffset(s.toUtf8());
}
static void writeQuoted(const QByteArray &b, QIODevice *out)
{
for (char c : b) {
switch (c) {
case '"':
case '\\':
out->write("\\");
}
out->write(&c, 1);
}
}
void StringTable::writeCode(const char* name, QIODevice *out) const
{
IndexedDataTable<QByteArray>::writeCode("char", name, out, [](const QByteArray &b, QIODevice *out) {
out->write("\"");
out->write(b);
writeQuoted(b, out);
out->write("\\0\"");
});
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment