From c83dfdb66e096f16805d0a842e0492645dc086c2 Mon Sep 17 00:00:00 2001 From: Tycho Bickerstaff Date: Sun, 22 Dec 2013 14:19:29 +0000 Subject: fixed warnings in bytebuffer.cpp --- src/ByteBuffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ByteBuffer.cpp') diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index 64c03d0d3..510018005 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,9 @@ bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes) return false; } char buf[1024]; - while (a_NumBytes > 0) + while (a_NumBytes > static_cast(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; -- cgit v1.2.3 From c3e34ee81af71c70514d53f4e54e3a6c2ac5a976 Mon Sep 17 00:00:00 2001 From: Tycho Bickerstaff Date: Sun, 22 Dec 2013 17:02:36 +0000 Subject: removed unneccisary cast --- src/ByteBuffer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ByteBuffer.cpp') diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index 510018005..e06f63a0e 100644 --- a/src/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp @@ -781,7 +781,8 @@ bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes) return false; } char buf[1024]; - while (a_NumBytes > static_cast(0)) + // > 0 without generating warnings about unsigned comparisons where size_t is unsigned + while (a_NumBytes != 0) { size_t num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes; VERIFY(ReadBuf(buf, num)); -- cgit v1.2.3