diff options
author | Tycho Bickerstaff <work.tycho@gmail.com> | 2013-12-31 16:53:17 +0100 |
---|---|---|
committer | Tycho Bickerstaff <work.tycho@gmail.com> | 2013-12-31 16:53:17 +0100 |
commit | 18fb814c3487231410b96cf237d4cc488e964f87 (patch) | |
tree | 7f846df7669175e4a5d5276c81ad3c16f96f29c4 /src/ByteBuffer.cpp | |
parent | refactored chunk Queue to seperate class (diff) | |
parent | removed unneccisary cast (diff) | |
download | cuberite-18fb814c3487231410b96cf237d4cc488e964f87.tar cuberite-18fb814c3487231410b96cf237d4cc488e964f87.tar.gz cuberite-18fb814c3487231410b96cf237d4cc488e964f87.tar.bz2 cuberite-18fb814c3487231410b96cf237d4cc488e964f87.tar.lz cuberite-18fb814c3487231410b96cf237d4cc488e964f87.tar.xz cuberite-18fb814c3487231410b96cf237d4cc488e964f87.tar.zst cuberite-18fb814c3487231410b96cf237d4cc488e964f87.zip |
Diffstat (limited to 'src/ByteBuffer.cpp')
-rw-r--r-- | src/ByteBuffer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index 64c03d0d3..e06f63a0e 100644 --- a/src/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp @@ -773,7 +773,7 @@ void cByteBuffer::ReadAll(AString & a_Data) -bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes) +bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes) { if (!a_Dst.CanWriteBytes(a_NumBytes) || !CanReadBytes(a_NumBytes)) { @@ -781,9 +781,10 @@ bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes) return false; } char buf[1024]; - while (a_NumBytes > 0) + // > 0 without generating warnings about unsigned comparisons where size_t is unsigned + while (a_NumBytes != 0) { - int num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes; + size_t num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes; VERIFY(ReadBuf(buf, num)); VERIFY(a_Dst.Write(buf, num)); a_NumBytes -= num; |