THRIFT-2027: Minor 64-bit and NOMINMAX issues in C++ library

Client: cpp
Patch: Ben Craig
This commit is contained in:
Ben Craig 2013-10-09 15:21:38 -05:00
parent 19244ed87f
commit 6493523e96
3 changed files with 4 additions and 4 deletions

View File

@ -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<uint32_t>((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!

View File

@ -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<uint32_t>(header.size()));
transport_->write(buf, len);
transport_->flush();

View File

@ -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;