| 651 | |
| 652 | template<typename Stream, unsigned int N, typename T> |
| 653 | void Unserialize_impl(Stream& is, prevector<N, T>& v, const unsigned char&) |
| 654 | { |
| 655 | // Limit size per read so bogus size value won't cause out of memory |
| 656 | v.clear(); |
| 657 | unsigned int nSize = ReadCompactSize(is); |
| 658 | unsigned int i = 0; |
| 659 | while (i < nSize) |
| 660 | { |
| 661 | unsigned int blk = std::min(nSize - i, (unsigned int)(1 + 4999999 / sizeof(T))); |
| 662 | v.resize(i + blk); |
| 663 | is.read((char*)&v[i], blk * sizeof(T)); |
| 664 | i += blk; |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | template<typename Stream, unsigned int N, typename T, typename V> |
| 669 | void Unserialize_impl(Stream& is, prevector<N, T>& v, const V&) |
no test coverage detected