Skip to content

Commit 8256505

Browse files
committed
Merge remote-tracking branch 'remotes/origin/master' into testnet
2 parents 5e67010 + cd98157 commit 8256505

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

utility/common.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,12 @@ namespace std
430430
throw runtime_error("not impl");
431431
}
432432

433+
void FStream::ensure_size(size_t s)
434+
{
435+
if (s > m_Remaining)
436+
throw runtime_error("underflow");
437+
}
438+
433439
size_t FStream::read(void* pPtr, size_t nSize)
434440
{
435441
m_F.read((char*)pPtr, nSize);

utility/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ namespace std
269269
void Seek(uint64_t);
270270
uint64_t Tell();
271271

272+
void ensure_size(size_t s);
272273
// read/write always return the size requested. Exception is thrown if underflow or error
273274
size_t read(void* pPtr, size_t nSize);
274275
size_t write(const void* pPtr, size_t nSize);

0 commit comments

Comments
 (0)