Skip to content
GitLab
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
2d19050a
Commit
2d19050a
authored
Jul 23, 2021
by
Volker Krause
Browse files
The isspace/isctrl/etc functions require unsigned char as input
Using signed char is documented to be undefined behavior.
parent
94b9cc30
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graphql/kgraphqlminimizer.cpp
View file @
2d19050a
...
...
@@ -33,15 +33,15 @@ QByteArray KGraphQLMinimizer::minimizeQuery(const QByteArray &query)
void
KGraphQLMinimizer
::
appendSpaceCompress
(
char
c
)
{
if
(
m_out
.
isEmpty
())
{
if
(
!
std
::
isspace
(
c
))
{
if
(
!
std
::
isspace
(
static_cast
<
unsigned
char
>
(
c
)
))
{
m_out
.
push_back
(
c
);
}
return
;
}
const
auto
prev
=
m_out
.
back
();
if
(
std
::
isspace
(
prev
))
{
if
(
std
::
isspace
(
c
))
{
if
(
std
::
isspace
(
static_cast
<
unsigned
char
>
(
prev
))
)
{
if
(
std
::
isspace
(
static_cast
<
unsigned
char
>
(
c
)
))
{
if
(
c
==
'\n'
)
{
m_out
.
back
()
=
c
;
}
...
...
@@ -55,7 +55,7 @@ void KGraphQLMinimizer::appendSpaceCompress(char c)
return
;
}
if
(
!
std
::
isspace
(
c
)
||
!
isPunctuator
(
prev
))
{
if
(
!
std
::
isspace
(
static_cast
<
unsigned
char
>
(
c
)
)
||
!
isPunctuator
(
prev
))
{
m_out
.
push_back
(
c
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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