QHttpHeaderParser: fix int/qsizetype nags

These values won't extend past MAX_INT but it may produce warnings
nonetheless.

Found by clang-tidy.

Task-number: QTBUG-104452
Change-Id: Icd8aa80a318274be00a3b32ad26a92745903cecb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2ba153dd5f450c008d49d30b5868abbca1974e28)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Mårten Nordheim 2022-06-17 14:50:11 +02:00
parent e0ed5b63a1
commit f83a79f267

View File

@ -54,7 +54,7 @@ bool QHttpHeaderParser::parseHeaders(QByteArrayView header)
QList<QPair<QByteArray, QByteArray>> result;
while (header.size()) {
const int colon = header.indexOf(':');
const qsizetype colon = header.indexOf(':');
if (colon == -1) // if no colon check if empty headers
return result.size() == 0 && (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);