Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
4937b22a
Commit
4937b22a
authored
Oct 19, 2021
by
Volker Krause
Browse files
Fix string table generation for filenames containing quotes or backslashes
parent
d9c73084
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/generator/indexeddatatable.cpp
View file @
4937b22a
...
...
@@ -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
\"
"
);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment