qhsts: use const methods more
to prevent possible detach Change-Id: If349999b873195ca96ea0101273861b95eb16b4f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
082d15e733
commit
4d5fb42987
@ -400,7 +400,7 @@ bool QHstsHeaderParser::parseDirective()
|
|||||||
if (token == ";") // That's a weird grammar, but that's what it is.
|
if (token == ";") // That's a weird grammar, but that's what it is.
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!isTOKEN(token[0])) // Not a valid directive-name.
|
if (!isTOKEN(token.at(0))) // Not a valid directive-name.
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QByteArray directiveName = token;
|
const QByteArray directiveName = token;
|
||||||
@ -481,13 +481,13 @@ bool QHstsHeaderParser::nextToken()
|
|||||||
|
|
||||||
// Fortunately enough, by this point qhttpnetworkreply already got rid of
|
// Fortunately enough, by this point qhttpnetworkreply already got rid of
|
||||||
// [CRLF] parts, but we can have 1*(SP|HT) yet.
|
// [CRLF] parts, but we can have 1*(SP|HT) yet.
|
||||||
while (tokenPos < header.size() && isLWS(header[tokenPos]))
|
while (tokenPos < header.size() && isLWS(header.at(tokenPos)))
|
||||||
++tokenPos;
|
++tokenPos;
|
||||||
|
|
||||||
if (tokenPos == header.size())
|
if (tokenPos == header.size())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const char ch = header[tokenPos];
|
const char ch = header.at(tokenPos);
|
||||||
if (ch == ';' || ch == '=') {
|
if (ch == ';' || ch == '=') {
|
||||||
token.append(ch);
|
token.append(ch);
|
||||||
++tokenPos;
|
++tokenPos;
|
||||||
@ -501,17 +501,17 @@ bool QHstsHeaderParser::nextToken()
|
|||||||
if (ch == '"') {
|
if (ch == '"') {
|
||||||
int last = tokenPos + 1;
|
int last = tokenPos + 1;
|
||||||
while (last < header.size()) {
|
while (last < header.size()) {
|
||||||
if (header[last] == '"') {
|
if (header.at(last) == '"') {
|
||||||
// The end of a quoted-string.
|
// The end of a quoted-string.
|
||||||
break;
|
break;
|
||||||
} else if (header[last] == '\\') {
|
} else if (header.at(last) == '\\') {
|
||||||
// quoted-pair = "\" CHAR
|
// quoted-pair = "\" CHAR
|
||||||
if (last + 1 < header.size() && isCHAR(header[last + 1]))
|
if (last + 1 < header.size() && isCHAR(header.at(last + 1)))
|
||||||
last += 2;
|
last += 2;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!isTEXT(header[last]))
|
if (!isTEXT(header.at(last)))
|
||||||
return false;
|
return false;
|
||||||
++last;
|
++last;
|
||||||
}
|
}
|
||||||
@ -532,7 +532,7 @@ bool QHstsHeaderParser::nextToken()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
int last = tokenPos + 1;
|
int last = tokenPos + 1;
|
||||||
while (last < header.size() && isTOKEN(header[last]))
|
while (last < header.size() && isTOKEN(header.at(last)))
|
||||||
++last;
|
++last;
|
||||||
|
|
||||||
token = header.mid(tokenPos, last - tokenPos);
|
token = header.mid(tokenPos, last - tokenPos);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user