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:
Mårten Nordheim 2022-06-17 14:50:11 +02:00
parent f5138d3065
commit 2ba153dd5f

View File

@ -54,7 +54,7 @@ bool QHttpHeaderParser::parseHeaders(QByteArrayView header)
QList<QPair<QByteArray, QByteArray>> result;
while (!header.empty()) {
const int colon = header.indexOf(':');
const qsizetype colon = header.indexOf(':');
if (colon == -1) // if no colon check if empty headers
return result.empty() && (header == "\n" || header == "\r\n");
if (result.size() >= maxFieldCount)
@ -66,7 +66,7 @@ bool QHttpHeaderParser::parseHeaders(QByteArrayView header)
QByteArray value;
qsizetype valueSpace = maxFieldSize - name.size() - 1;
do {
const int endLine = header.indexOf('\n');
const qsizetype endLine = header.indexOf('\n');
Q_ASSERT(endLine != -1);
auto line = header.first(endLine); // includes space
valueSpace -= line.size() - (line.endsWith('\r') ? 1 : 0);
@ -115,7 +115,7 @@ bool QHttpHeaderParser::parseStatus(QByteArrayView status)
minorVersion = status.at(dotPos + 1) - '0';
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)
: status.sliced(i + 1);