THRIFT-3757 Fix various compile warnings with VS2015

This closes #962
diff --git a/lib/cpp/src/thrift/concurrency/TimerManager.cpp b/lib/cpp/src/thrift/concurrency/TimerManager.cpp
index 122d26e..f95fcda 100644
--- a/lib/cpp/src/thrift/concurrency/TimerManager.cpp
+++ b/lib/cpp/src/thrift/concurrency/TimerManager.cpp
@@ -162,8 +162,7 @@
     try {
       stop();
     } catch (...) {
-      throw;
-      // uhoh
+      // We're really hosed.
     }
   }
 }
diff --git a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
index dbed8fb..412e927 100644
--- a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
@@ -43,7 +43,6 @@
 static const uint8_t kJSONObjectEnd = '}';
 static const uint8_t kJSONArrayStart = '[';
 static const uint8_t kJSONArrayEnd = ']';
-static const uint8_t kJSONNewline = '\n';
 static const uint8_t kJSONPairSeparator = ':';
 static const uint8_t kJSONElemSeparator = ',';
 static const uint8_t kJSONBackslash = '\\';
diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
index 1e35275..7f44c1f 100644
--- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
@@ -1436,8 +1436,8 @@
   }
 
   fd_set wfds, efds;
-  int ret = -1;
-  int kSize = sizeof(conn);
+  long ret = -1;
+  long kSize = sizeof(conn);
   const char* pos = (const char*)const_cast_sockopt(&conn);
 
   while (kSize > 0) {
@@ -1445,7 +1445,7 @@
     FD_ZERO(&efds);
     FD_SET(fd, &wfds);
     FD_SET(fd, &efds);
-    ret = select(fd + 1, NULL, &wfds, &efds, NULL);
+    ret = select(static_cast<int>(fd + 1), NULL, &wfds, &efds, NULL);
     if (ret < 0) {
       return false;
     } else if (ret == 0) {
diff --git a/lib/cpp/src/thrift/server/TServerFramework.cpp b/lib/cpp/src/thrift/server/TServerFramework.cpp
index 43d11c5..9fdd694 100644
--- a/lib/cpp/src/thrift/server/TServerFramework.cpp
+++ b/lib/cpp/src/thrift/server/TServerFramework.cpp
@@ -224,7 +224,7 @@
   // Count a concurrent client added.
   Synchronized sync(mon_);
   ++clients_;
-  hwm_ = std::max(hwm_, clients_);
+  hwm_ = (std::max)(hwm_, clients_);
 }
 
 void TServerFramework::disposeConnectedClient(TConnectedClient* pClient) {
diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp
index 6de6d4e..bc1bbdd 100644
--- a/lib/cpp/src/thrift/transport/TSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSocket.cpp
@@ -700,7 +700,7 @@
 #ifndef _WIN32
   struct linger l = {(lingerOn_ ? 1 : 0), lingerVal_};
 #else
-  struct linger l = {(lingerOn_ ? 1 : 0), static_cast<u_short>(lingerVal_)};
+  struct linger l = {static_cast<u_short>(lingerOn_ ? 1 : 0), static_cast<u_short>(lingerVal_)};
 #endif
 
   int ret = setsockopt(socket_, SOL_SOCKET, SO_LINGER, cast_sockopt(&l), sizeof(l));
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
index 6cc2c87..ccef9d5 100644
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-#include "config.h"
+#include <thrift/thrift-config.h>
 
 #include <stdlib.h>
 #include <time.h>