summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/generator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r--src/tools/moc/generator.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index bd9a002d5b..46acbc608b 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1530,7 +1530,13 @@ static void writePluginMetaData(FILE *out, const QJsonObject &data)
const QByteArray binary = doc.toBinaryData();
const int last = binary.size() - 1;
for (int i = 0; i < last; ++i) {
- fprintf(out, " 0x%02x,", (uchar)binary.at(i));
+ uchar c = (uchar)binary.at(i);
+ if (c < 0x20 || c >= 0x7f)
+ fprintf(out, " 0x%02x,", c);
+ else if (c == '\'' || c == '\\')
+ fprintf(out, " '\\%c',", c);
+ else
+ fprintf(out, " '%c', ", c);
if (!((i + 1) % 8))
fputs("\n ", out);
}