diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/pointer.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/pointer.h b/src/util/pointer.h index efca62d2d..59b6f5216 100644 --- a/src/util/pointer.h +++ b/src/util/pointer.h @@ -168,6 +168,18 @@ public: /* Copies whole buffer */ + SharedBuffer(const Buffer<T> &buffer) + { + m_size = buffer.getSize(); + if (m_size != 0) { + data = new T[m_size]; + memcpy(data, *buffer, buffer.getSize()); + } + else + data = NULL; + refcount = new unsigned int; + (*refcount) = 1; + } ~SharedBuffer() { drop(); |