diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bufferstore.cc | 5 | ||||
-rw-r--r-- | lib/bufferstore.h | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/bufferstore.cc b/lib/bufferstore.cc index ea4bab6..f2686dc 100644 --- a/lib/bufferstore.cc +++ b/lib/bufferstore.cc @@ -179,3 +179,8 @@ void bufferStore::addDWord(long a) { buff[len++] = (a>>16) & 0xff; buff[len++] = (a>>24) & 0xff; } + +void bufferStore::truncate(long newLen) { + if (newLen < len) + len = newLen; +} diff --git a/lib/bufferstore.h b/lib/bufferstore.h index 81704e1..494d0af 100644 --- a/lib/bufferstore.h +++ b/lib/bufferstore.h @@ -190,6 +190,14 @@ public: */ void addBuff(const bufferStore &b, long maxLen = -1); + /** + * Truncates the buffer. + * If the buffer is smaller, does nothing. + * + * @param newLen The new length of the buffer. + */ + void truncate(long newLen); + private: void checkAllocd(long newLen); |