summaryrefslogtreecommitdiff
path: root/AK/ByteBuffer.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-23 13:00:53 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-23 13:00:53 +0200
commit58240fdb337a3ca0e2a8e63212cae509cda38daf (patch)
tree38747e507f7a7301a1fd0b7a31a4ce1d8cd8bf66 /AK/ByteBuffer.h
parent243e1d84627c20a39f5464bb61cafae9fa2fe456 (diff)
downloadserenity-58240fdb337a3ca0e2a8e63212cae509cda38daf.zip
Do a pass of compiler warning fixes.
This is really making me question not using 64-bit integers more.
Diffstat (limited to 'AK/ByteBuffer.h')
-rw-r--r--AK/ByteBuffer.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h
index bea90cb450..f263c1c13b 100644
--- a/AK/ByteBuffer.h
+++ b/AK/ByteBuffer.h
@@ -14,6 +14,7 @@ public:
static Retained<ByteBufferImpl> create_zeroed(int);
static Retained<ByteBufferImpl> copy(const void*, int);
static Retained<ByteBufferImpl> wrap(void*, int);
+ static Retained<ByteBufferImpl> wrap(const void*, int);
static Retained<ByteBufferImpl> adopt(void*, int);
~ByteBufferImpl() { clear(); }
@@ -89,6 +90,7 @@ public:
static ByteBuffer create_uninitialized(ssize_t size) { return ByteBuffer(ByteBufferImpl::create_uninitialized(size)); }
static ByteBuffer create_zeroed(ssize_t size) { return ByteBuffer(ByteBufferImpl::create_zeroed(size)); }
static ByteBuffer copy(const void* data, ssize_t size) { return ByteBuffer(ByteBufferImpl::copy(data, size)); }
+ static ByteBuffer wrap(const void* data, ssize_t size) { return ByteBuffer(ByteBufferImpl::wrap(data, size)); }
static ByteBuffer wrap(void* data, ssize_t size) { return ByteBuffer(ByteBufferImpl::wrap(data, size)); }
static ByteBuffer adopt(void* data, ssize_t size) { return ByteBuffer(ByteBufferImpl::adopt(data, size)); }
@@ -219,6 +221,11 @@ inline Retained<ByteBufferImpl> ByteBufferImpl::wrap(void* data, int size)
return ::adopt(*new ByteBufferImpl(data, size, Wrap));
}
+inline Retained<ByteBufferImpl> ByteBufferImpl::wrap(const void* data, int size)
+{
+ return ::adopt(*new ByteBufferImpl(const_cast<void*>(data), size, Wrap));
+}
+
inline Retained<ByteBufferImpl> ByteBufferImpl::adopt(void* data, int size)
{
return ::adopt(*new ByteBufferImpl(data, size, Adopt));