aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-08-27 15:12:43 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-08-27 15:12:43 +0000
commit6d26d9a1fb8ccdcc2b930f9ce3561820fb84acae (patch)
treef8acec783931ca4517cda8e5d46f2e7f2d4b971e /vespalib
parent2a9d62ac9c68731a46f53a6b80224c053a7b01ec (diff)
Style chnages
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/objects/nbostream.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.h b/vespalib/src/vespa/vespalib/objects/nbostream.h
index daaea981b5a..c5b26d786b3 100644
--- a/vespalib/src/vespa/vespalib/objects/nbostream.h
+++ b/vespalib/src/vespa/vespalib/objects/nbostream.h
@@ -20,7 +20,7 @@ class nbostream
public:
using Buffer = Array<char>;
using Alloc = alloc::Alloc;
- enum State { ok=0, eof=0x01};
+ enum State { ok=0, eof=0x01, oob=0x02};
nbostream(size_t initialSize=1024);
protected:
nbostream(const void * buf, size_t sz, bool longLivedBuffer);
@@ -145,6 +145,7 @@ public:
const char * peek() const { return &_rbuf[_rp]; }
size_t rp() const { return _rp; }
nbostream & rp(size_t pos) { if (pos > _wp) fail(eof); _rp = pos; return *this; }
+ nbostream & wp(size_t pos) { if (pos > _wbuf.size()) fail(oob); _wp = pos; return *this; }
size_t wp() const { return _wp; }
State state() const { return _state; }
bool good() const { return _state == ok; }