From: Ben Craig Date: Wed, 9 Oct 2013 20:21:38 +0000 (-0500) Subject: THRIFT-2027: Minor 64-bit and NOMINMAX issues in C++ library X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=6493523e96df96069c94647c5e9b841b0be491a6;p=common%2Fthrift.git THRIFT-2027: Minor 64-bit and NOMINMAX issues in C++ library Client: cpp Patch: Ben Craig --- diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp index b9553c40..1552e89a 100644 --- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp +++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp @@ -893,7 +893,7 @@ TNonblockingServer::TConnection* TNonblockingServer::createConnection( // pick an IO thread to handle this connection -- currently round robin assert(nextIOThread_ < ioThreads_.size()); int selectedThreadIdx = nextIOThread_; - nextIOThread_ = (nextIOThread_ + 1) % ioThreads_.size(); + nextIOThread_ = static_cast((nextIOThread_ + 1) % ioThreads_.size()); TNonblockingIOThread* ioThread = ioThreads_[selectedThreadIdx].get(); @@ -1421,7 +1421,7 @@ void TNonblockingIOThread::notifyHandler(evutil_socket_t fd, short which, void* while (true) { TNonblockingServer::TConnection* connection = 0; const int kSize = sizeof(connection); - int nBytes = recv(fd, cast_sockopt(&connection), kSize, 0); + long nBytes = recv(fd, cast_sockopt(&connection), kSize, 0); if (nBytes == kSize) { if (connection == NULL) { // this is the command to stop our thread, exit the handler! diff --git a/lib/cpp/src/thrift/transport/THttpServer.cpp b/lib/cpp/src/thrift/transport/THttpServer.cpp index 11352705..e5b33273 100644 --- a/lib/cpp/src/thrift/transport/THttpServer.cpp +++ b/lib/cpp/src/thrift/transport/THttpServer.cpp @@ -92,7 +92,7 @@ bool THttpServer::parseStatusLine(char* status) { string header = h.str(); // Write the header, then the data, then flush - transport_->write((const uint8_t*)header.c_str(), header.size()); + transport_->write((const uint8_t*)header.c_str(), static_cast(header.size())); transport_->write(buf, len); transport_->flush(); diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.cpp b/lib/cpp/src/thrift/transport/TZlibTransport.cpp index d77eedd0..cdde7c35 100644 --- a/lib/cpp/src/thrift/transport/TZlibTransport.cpp +++ b/lib/cpp/src/thrift/transport/TZlibTransport.cpp @@ -143,7 +143,7 @@ uint32_t TZlibTransport::read(uint8_t* buf, uint32_t len) { while (true) { // Copy out whatever we have available, then give them the min of // what we have and what they want, then advance indices. - int give = std::min((uint32_t) readAvail(), need); + int give = (std::min)((uint32_t) readAvail(), need); memcpy(buf, urbuf_ + urpos_, give); need -= give; buf += give;