diff options
author | Tycho Bickerstaff <work.tycho@gmail.com> | 2013-12-31 16:52:51 +0100 |
---|---|---|
committer | Tycho Bickerstaff <work.tycho@gmail.com> | 2013-12-31 16:52:51 +0100 |
commit | 173ed0e653d05dbcfac9cfeeb6b75b7ea61b0e93 (patch) | |
tree | f22cc0530050584e430ede31481b34bff48b3e2f /src/ByteBuffer.cpp | |
parent | fixed bad merge (diff) | |
parent | removed unneccisary cast (diff) | |
download | cuberite-173ed0e653d05dbcfac9cfeeb6b75b7ea61b0e93.tar cuberite-173ed0e653d05dbcfac9cfeeb6b75b7ea61b0e93.tar.gz cuberite-173ed0e653d05dbcfac9cfeeb6b75b7ea61b0e93.tar.bz2 cuberite-173ed0e653d05dbcfac9cfeeb6b75b7ea61b0e93.tar.lz cuberite-173ed0e653d05dbcfac9cfeeb6b75b7ea61b0e93.tar.xz cuberite-173ed0e653d05dbcfac9cfeeb6b75b7ea61b0e93.tar.zst cuberite-173ed0e653d05dbcfac9cfeeb6b75b7ea61b0e93.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; |