THRIFT-2610 MSVC warning in TSocket.cpp
authorRoger Meier <roger@apache.org>
Tue, 8 Jul 2014 05:46:11 +0000 (07:46 +0200)
committerRoger Meier <roger@apache.org>
Tue, 8 Jul 2014 05:46:11 +0000 (07:46 +0200)
Patch: Konrad Grochowski

lib/cpp/src/thrift/transport/TSocket.cpp

index 7dec442..e80f712 100755 (executable)
@@ -622,7 +622,12 @@ void TSocket::setLinger(bool on, int linger) {
     return;
   }
 
+#ifndef _WIN32
   struct linger l = {(lingerOn_ ? 1 : 0), lingerVal_};
+#else
+  struct linger l = {(lingerOn_ ? 1 : 0), static_cast<u_short>(lingerVal_)};
+#endif
+
   int ret = setsockopt(socket_, SOL_SOCKET, SO_LINGER, cast_sockopt(&l), sizeof(l));
   if (ret == -1) {
     int errno_copy = THRIFT_GET_SOCKET_ERROR;  // Copy THRIFT_GET_SOCKET_ERROR because we're allocating memory.