diff options
author | madmaxoft <github@xoft.cz> | 2014-04-24 22:42:33 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-04-24 22:42:33 +0200 |
commit | 616fb15508187d317a7ca4195667e204faf3749c (patch) | |
tree | f65aafc4d6e391a8c03eefeb363a4443e8796689 /src/ByteBuffer.cpp | |
parent | Declared a SharedPtr that hopefully resolves on all platforms. (diff) | |
download | cuberite-616fb15508187d317a7ca4195667e204faf3749c.tar cuberite-616fb15508187d317a7ca4195667e204faf3749c.tar.gz cuberite-616fb15508187d317a7ca4195667e204faf3749c.tar.bz2 cuberite-616fb15508187d317a7ca4195667e204faf3749c.tar.lz cuberite-616fb15508187d317a7ca4195667e204faf3749c.tar.xz cuberite-616fb15508187d317a7ca4195667e204faf3749c.tar.zst cuberite-616fb15508187d317a7ca4195667e204faf3749c.zip |
Diffstat (limited to 'src/ByteBuffer.cpp')
-rw-r--r-- | src/ByteBuffer.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index c634dc308..ad753118b 100644 --- a/src/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp @@ -171,7 +171,7 @@ cByteBuffer::~cByteBuffer() -bool cByteBuffer::Write(const char * a_Bytes, size_t a_Count) +bool cByteBuffer::Write(const void * a_Bytes, size_t a_Count) { CHECK_THREAD; CheckValid(); @@ -187,13 +187,14 @@ bool cByteBuffer::Write(const char * a_Bytes, size_t a_Count) } ASSERT(m_BufferSize >= m_WritePos); size_t TillEnd = m_BufferSize - m_WritePos; + const char * Bytes = (const char *)a_Bytes; if (TillEnd <= a_Count) { // Need to wrap around the ringbuffer end if (TillEnd > 0) { - memcpy(m_Buffer + m_WritePos, a_Bytes, TillEnd); - a_Bytes += TillEnd; + memcpy(m_Buffer + m_WritePos, Bytes, TillEnd); + Bytes += TillEnd; a_Count -= TillEnd; WrittenBytes = TillEnd; } @@ -203,7 +204,7 @@ bool cByteBuffer::Write(const char * a_Bytes, size_t a_Count) // We're guaranteed that we'll fit in a single write op if (a_Count > 0) { - memcpy(m_Buffer + m_WritePos, a_Bytes, a_Count); + memcpy(m_Buffer + m_WritePos, Bytes, a_Count); m_WritePos += a_Count; WrittenBytes += a_Count; } |