QHttpHeaderParser: fix int/qsizetype nags
These values won't extend past MAX_INT but it may produce warnings nonetheless. Found by clang-tidy. Pick-to: 6.4 6.3 Task-number: QTBUG-104452 Change-Id: Icd8aa80a318274be00a3b32ad26a92745903cecb Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
f5138d3065
commit
2ba153dd5f
@ -54,7 +54,7 @@ bool QHttpHeaderParser::parseHeaders(QByteArrayView header)
|
|||||||
|
|
||||||
QList<QPair<QByteArray, QByteArray>> result;
|
QList<QPair<QByteArray, QByteArray>> result;
|
||||||
while (!header.empty()) {
|
while (!header.empty()) {
|
||||||
const int colon = header.indexOf(':');
|
const qsizetype colon = header.indexOf(':');
|
||||||
if (colon == -1) // if no colon check if empty headers
|
if (colon == -1) // if no colon check if empty headers
|
||||||
return result.empty() && (header == "\n" || header == "\r\n");
|
return result.empty() && (header == "\n" || header == "\r\n");
|
||||||
if (result.size() >= maxFieldCount)
|
if (result.size() >= maxFieldCount)
|
||||||
@ -66,7 +66,7 @@ bool QHttpHeaderParser::parseHeaders(QByteArrayView header)
|
|||||||
QByteArray value;
|
QByteArray value;
|
||||||
qsizetype valueSpace = maxFieldSize - name.size() - 1;
|
qsizetype valueSpace = maxFieldSize - name.size() - 1;
|
||||||
do {
|
do {
|
||||||
const int endLine = header.indexOf('\n');
|
const qsizetype endLine = header.indexOf('\n');
|
||||||
Q_ASSERT(endLine != -1);
|
Q_ASSERT(endLine != -1);
|
||||||
auto line = header.first(endLine); // includes space
|
auto line = header.first(endLine); // includes space
|
||||||
valueSpace -= line.size() - (line.endsWith('\r') ? 1 : 0);
|
valueSpace -= line.size() - (line.endsWith('\r') ? 1 : 0);
|
||||||
@ -115,7 +115,7 @@ bool QHttpHeaderParser::parseStatus(QByteArrayView status)
|
|||||||
minorVersion = status.at(dotPos + 1) - '0';
|
minorVersion = status.at(dotPos + 1) - '0';
|
||||||
|
|
||||||
int i = spacePos;
|
int i = spacePos;
|
||||||
int j = status.indexOf(' ', i + 1);
|
qsizetype j = status.indexOf(' ', i + 1);
|
||||||
const QByteArrayView code = j > i ? status.sliced(i + 1, j - i - 1)
|
const QByteArrayView code = j > i ? status.sliced(i + 1, j - i - 1)
|
||||||
: status.sliced(i + 1);
|
: status.sliced(i + 1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user