[Box Backup-dev] COMMIT r696 - box/chris/general/lib/server
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Wed, 26 Jul 2006 23:14:16 +0000 (GMT)
Author: chris
Date: 2006-07-26 23:14:15 +0000 (Wed, 26 Jul 2006)
New Revision: 696
Modified:
box/chris/general/lib/server/WinNamedPipeStream.cpp
Log:
* WinNamedPipeStream.cpp
- Fixed a compiler warning about comparing signed and unsigned values
Modified: box/chris/general/lib/server/WinNamedPipeStream.cpp
===================================================================
--- box/chris/general/lib/server/WinNamedPipeStream.cpp 2006-07-26 23:13:52 UTC (rev 695)
+++ box/chris/general/lib/server/WinNamedPipeStream.cpp 2006-07-26 23:14:15 UTC (rev 696)
@@ -218,6 +218,12 @@
THROW_EXCEPTION(ConnectionException, SocketShutdownError)
}
+ // ensure safe to cast NBytes to unsigned
+ if (NBytes < 0)
+ {
+ THROW_EXCEPTION(CommonException, AssertFailed)
+ }
+
DWORD NumBytesRead;
if (mIsServer)
@@ -272,7 +278,7 @@
size_t BytesToCopy = NumBytesRead + mBytesInBuffer;
size_t BytesRemaining = 0;
- if (BytesToCopy > NBytes)
+ if (BytesToCopy > (size_t)NBytes)
{
BytesRemaining = BytesToCopy - NBytes;
BytesToCopy = NBytes;