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. Change-Id: Ide4dbd0777a44ed0870efffd17394f9f25062122 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 2d7a27b918ff576dbd8ec8b3aecaa45f8c78fa5e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
072c2ddbf3
commit
ea42f36c90
@ -266,12 +266,11 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
class SmallByteArray {
|
class SmallByteArray {
|
||||||
std::array<char, MaxHashLength> m_data;
|
std::array<quint8, MaxHashLength> m_data;
|
||||||
static_assert(MaxHashLength <= std::numeric_limits<std::uint8_t>::max());
|
static_assert(MaxHashLength <= std::numeric_limits<std::uint8_t>::max());
|
||||||
std::uint8_t m_size;
|
quint8 m_size;
|
||||||
public:
|
public:
|
||||||
char *data() noexcept { return m_data.data(); }
|
quint8 *data() noexcept { return m_data.data(); }
|
||||||
const char *data() const noexcept { return m_data.data(); }
|
|
||||||
qsizetype size() const noexcept { return qsizetype{m_size}; }
|
qsizetype size() const noexcept { return qsizetype{m_size}; }
|
||||||
bool isEmpty() const noexcept { return size() == 0; }
|
bool isEmpty() const noexcept { return size() == 0; }
|
||||||
void clear() noexcept { m_size = 0; }
|
void clear() noexcept { m_size = 0; }
|
||||||
@ -281,7 +280,7 @@ public:
|
|||||||
m_size = std::uint8_t(s);
|
m_size = std::uint8_t(s);
|
||||||
}
|
}
|
||||||
QByteArrayView toByteArrayView() const noexcept
|
QByteArrayView toByteArrayView() const noexcept
|
||||||
{ return QByteArrayView{data(), size()}; }
|
{ return QByteArrayView{m_data.data(), size()}; }
|
||||||
};
|
};
|
||||||
SmallByteArray result;
|
SmallByteArray result;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user