hpack: use QBAV more

While touching code, use constexpr more

Change-Id: I1c5d80f257f742a2999147c12340bba38e8b1e2f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Anton Kudryavtsev 2023-08-28 19:04:20 +03:00 committed by Anton Kudryavtsev
parent 2c86903704
commit a6886859ad
1 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ bool read_bit_pattern(const BitPattern &pattern, BitIStream &inputStream)
return true;
}
bool is_request_pseudo_header(const QByteArray &name)
bool is_request_pseudo_header(QByteArrayView name)
{
return name == ":method" || name == ":scheme" ||
name == ":authority" || name == ":path";
@ -194,8 +194,8 @@ bool Encoder::encodeRequestPseudoHeaders(BitOStream &outputStream,
using size_type = decltype(header.size());
bool methodFound = false;
const char *headerName[] = {":authority", ":scheme", ":path"};
const size_type nHeaders = sizeof headerName / sizeof headerName[0];
constexpr QByteArrayView headerName[] = {":authority", ":scheme", ":path"};
constexpr size_type nHeaders = std::size(headerName);
bool headerFound[nHeaders] = {};
for (const auto &field : header) {