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
PIM
KItinerary
Commits
a100e721
Commit
a100e721
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
421759f7
Pipeline
#71558
passed with stage
in 9 minutes and 56 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/processors/htmldocumentprocessor.cpp
View file @
a100e721
...
...
@@ -26,7 +26,7 @@ Q_DECLARE_METATYPE(KItinerary::Internal::OwnedPtr<KItinerary::HtmlDocument>)
static
bool
contentStartsWith
(
const
QByteArray
&
data
,
char
s
)
{
for
(
const
auto
c
:
data
)
{
for
(
unsigned
char
c
:
data
)
{
if
(
std
::
isspace
(
c
))
{
continue
;
}
...
...
@@ -91,7 +91,7 @@ static QByteArray fixupJson(const QByteArray &data)
for
(
int
idx
=
output
.
indexOf
(
"
\"
,
\n
"
);
idx
>
0
&&
idx
+
3
<
output
.
size
();
idx
=
output
.
indexOf
(
"
\"
,
\n
"
,
idx
))
{
const
auto
comma
=
idx
+
1
;
idx
+=
3
;
while
(
idx
<
output
.
size
()
&&
std
::
isspace
(
output
[
idx
]))
{
while
(
idx
<
output
.
size
()
&&
std
::
isspace
(
static_cast
<
unsigned
char
>
(
output
[
idx
]))
)
{
++
idx
;
}
if
(
idx
<
output
.
size
()
&&
output
[
idx
]
==
'}'
)
{
...
...
src/lib/processors/icaldocumentprocessor.cpp
View file @
a100e721
...
...
@@ -32,7 +32,7 @@ using namespace KItinerary;
static
bool
contentStartsWith
(
const
QByteArray
&
data
,
const
char
*
str
)
{
auto
it
=
data
.
begin
();
while
(
it
!=
data
.
end
()
&&
std
::
isspace
(
*
it
))
{
while
(
it
!=
data
.
end
()
&&
std
::
isspace
(
static_cast
<
unsigned
char
>
(
*
it
))
)
{
++
it
;
}
...
...
src/lib/processors/jsonlddocumentprocessor.cpp
View file @
a100e721
...
...
@@ -16,7 +16,7 @@ using namespace KItinerary;
static
bool
contentStartsWith
(
const
QByteArray
&
data
,
char
s
)
{
for
(
const
auto
c
:
data
)
{
for
(
unsigned
char
c
:
data
)
{
if
(
std
::
isspace
(
c
))
{
continue
;
}
...
...
src/lib/processors/textdocumentprocessor.cpp
View file @
a100e721
...
...
@@ -18,7 +18,7 @@ using namespace KItinerary;
bool
TextDocumentProcessor
::
canHandleData
(
const
QByteArray
&
encodedData
,
QStringView
fileName
)
const
{
return
std
::
none_of
(
encodedData
.
begin
(),
encodedData
.
end
(),
[](
auto
c
)
{
return
std
::
iscntrl
(
c
)
&&
!
std
::
isspace
(
c
);
})
return
std
::
none_of
(
encodedData
.
begin
(),
encodedData
.
end
(),
[](
unsigned
char
c
)
{
return
std
::
iscntrl
(
c
)
&&
!
std
::
isspace
(
c
);
})
||
fileName
.
endsWith
(
QLatin1String
(
".txt"
),
Qt
::
CaseInsensitive
);
}
...
...
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