summaryrefslogtreecommitdiff
path: root/src/util/ConstBuffer.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-08-21 08:20:17 +0200
committerMax Kellermann <max@musicpd.org>2018-08-21 08:20:17 +0200
commit855750c784a391c3a5fe5658c61a67cceb18d676 (patch)
tree2f0c13eb6a31fbed90665877276a8720d68978e1 /src/util/ConstBuffer.hxx
parent4f2163e76c98ab0c3833e71be42c2ed546150a55 (diff)
util/{Const,Writable}Buffer: add method SetEnd()
Diffstat (limited to 'src/util/ConstBuffer.hxx')
-rw-r--r--src/util/ConstBuffer.hxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/ConstBuffer.hxx b/src/util/ConstBuffer.hxx
index 74fe297b5..ad795911e 100644
--- a/src/util/ConstBuffer.hxx
+++ b/src/util/ConstBuffer.hxx
@@ -289,6 +289,19 @@ struct ConstBuffer {
size = end() - new_data;
data = new_data;
}
+
+ /**
+ * Move the end pointer to the given address (by adjusting the
+ * size).
+ */
+ void SetEnd(pointer_type new_end) {
+#ifndef NDEBUG
+ assert(IsNull() == (new_end == nullptr));
+ assert(new_end >= begin());
+#endif
+
+ size = new_end - data;
+ }
};
#endif