summaryrefslogtreecommitdiff
path: root/include/object
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-11-22 15:00:12 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-11-22 15:00:12 +0100
commite4b3987cc6e2cc1a28bbaf566f0fb6625e25f3ee (patch)
tree1af91b9429d2893a93531856c90122b6da278e9e /include/object
parent0770f9e077bf1dad9a977e6ad78ea0389794922b (diff)
stdbuf: Track buffer size
Diffstat (limited to 'include/object')
-rw-r--r--include/object/stdbuf.h7
-rw-r--r--include/object/xdrstream.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/include/object/stdbuf.h b/include/object/stdbuf.h
index db30621..271c3ea 100644
--- a/include/object/stdbuf.h
+++ b/include/object/stdbuf.h
@@ -8,12 +8,17 @@ class BufferOutput : public T {
private:
BufferOutput(const BufferOutput &copy);
char *buffer;
+ uint16_t length;
public:
- BufferOutput(char *target) { buffer = target; }
+ BufferOutput(char *target) : buffer(target), length(0) {}
virtual void put(char c) {
*buffer = c;
buffer++;
+ length++;
+ }
+ inline uint16_t size() {
+ return length;
}
};
diff --git a/include/object/xdrstream.h b/include/object/xdrstream.h
index 55bef5b..e8d4ddc 100644
--- a/include/object/xdrstream.h
+++ b/include/object/xdrstream.h
@@ -6,7 +6,7 @@
class XDRStream {
private:
XDRStream(const XDRStream& copy);
- uint32_t next_array_len;
+ uint16_t next_array_len;
bool is_fixed_length;
public: