QCryptographicHashPrivate: standardize on quint8

So we don't have to do these reinterpret_cast everywhere, as most of the
APIs we're calling take unsigned chars themselves. The reinterpret_casts
will be removed in the next commit, which needs to modify those lines
anyway.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Ide4dbd0777a44ed0870efffd17394f9f25062122
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Thiago Macieira 2023-01-11 08:58:01 -08:00
parent 272d078926
commit 2d7a27b918

View File

@ -266,12 +266,11 @@ public:
#endif
#endif
class SmallByteArray {
std::array<char, MaxHashLength> m_data;
std::array<quint8, MaxHashLength> m_data;
static_assert(MaxHashLength <= std::numeric_limits<std::uint8_t>::max());
std::uint8_t m_size;
quint8 m_size;
public:
char *data() noexcept { return m_data.data(); }
const char *data() const noexcept { return m_data.data(); }
quint8 *data() noexcept { return m_data.data(); }
qsizetype size() const noexcept { return qsizetype{m_size}; }
bool isEmpty() const noexcept { return size() == 0; }
void clear() noexcept { m_size = 0; }
@ -281,7 +280,7 @@ public:
m_size = std::uint8_t(s);
}
QByteArrayView toByteArrayView() const noexcept
{ return QByteArrayView{data(), size()}; }
{ return QByteArrayView{m_data.data(), size()}; }
};
SmallByteArray result;
};