Use spans of std::byte in serialize

This switches .read() and .write() to take spans of bytes.
This commit is contained in:
MarcoFalke
2022-01-02 11:31:25 +01:00
parent fa65bbf217
commit fa24493d63
26 changed files with 195 additions and 184 deletions

View File

@@ -142,14 +142,14 @@ public:
{
unsigned int len = size();
::WriteCompactSize(s, len);
s.write((char*)vch, len);
s.write(AsBytes(Span{vch, len}));
}
template <typename Stream>
void Unserialize(Stream& s)
{
const unsigned int len(::ReadCompactSize(s));
if (len <= SIZE) {
s.read((char*)vch, len);
s.read(AsWritableBytes(Span{vch, len}));
if (len != size()) {
Invalidate();
}