Fix a small logic error in TBufferedTransport::borrowSlow.
authorDavid Reiss <dreiss@apache.org>
Fri, 9 May 2008 00:40:26 +0000 (00:40 +0000)
committerDavid Reiss <dreiss@apache.org>
Fri, 9 May 2008 00:40:26 +0000 (00:40 +0000)
Was using an unsigned int for a value that could be negative.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665680 13f79535-47bb-0310-9956-ffa450edef68

lib/cpp/src/transport/TBufferTransports.cpp

index 9164a1f..0deef1b 100644 (file)
@@ -101,7 +101,7 @@ const uint8_t* TBufferedTransport::borrowSlow(uint8_t* buf, uint32_t* len) {
   // The number of bytes of data we have already.
   uint32_t have = rBound_ - rBase_;
   // The number of additional bytes we need from the underlying transport.
-  uint32_t need = *len - have;
+  int32_t need = *len - have;
   // The space from the start of the buffer to the end of our data.
   uint32_t offset = rBound_ - rBuf_.get();
   assert(need > 0);