MCPcopy Create free account
hub / github.com/ElementsProject/elements / Unserialize_impl

Function Unserialize_impl

src/serialize.h:763–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761
762template<typename Stream, unsigned int N, typename T>
763void Unserialize_impl(Stream& is, prevector<N, T>& v, const unsigned char&)
764{
765 // Limit size per read so bogus size value won't cause out of memory
766 v.clear();
767 unsigned int nSize = ReadCompactSize(is);
768 unsigned int i = 0;
769 while (i < nSize)
770 {
771 unsigned int blk = std::min(nSize - i, (unsigned int)(1 + 4999999 / sizeof(T)));
772 v.resize_uninitialized(i + blk);
773 is.read(AsWritableBytes(Span{&v[i], blk}));
774 i += blk;
775 }
776}
777
778template<typename Stream, unsigned int N, typename T, typename V>
779void Unserialize_impl(Stream& is, prevector<N, T>& v, const V&)

Callers 1

UnserializeFunction · 0.85

Calls 7

ReadCompactSizeFunction · 0.85
AsWritableBytesFunction · 0.85
UnserializeFunction · 0.85
clearMethod · 0.45
resize_uninitializedMethod · 0.45
readMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected