diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-01-12 10:03:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-12 10:03:27 +0100 |
commit | 9eb3a77a2b9d62ff5db5e10fd646badbbe73d701 (patch) | |
tree | 1275176f2bb794c41e757827fea575e39f441c98 /vespalib | |
parent | 87d6777412738c155bb776b1be257e53dc7137e7 (diff) |
Revert "Revert "Balder/group multiple commits rebased 1""
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/objects/nbostream.h | 3 |
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 70a590f79d1..8eb42ddfd53 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; } |