You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ns...@apache.org on 2016/10/01 14:57:36 UTC

[1/3] thrift git commit: THRIFT-3936: fix compile error on VS2013 and earlier from changes introduced during 0.10.0 development (snprintf)

Repository: thrift
Updated Branches:
  refs/heads/master e349c345d -> 3129549fe


THRIFT-3936: fix compile error on VS2013 and earlier from changes introduced during 0.10.0 development (snprintf)

This closes #1099


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/4d39ac52
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/4d39ac52
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/4d39ac52

Branch: refs/heads/master
Commit: 4d39ac5240ec5f25faebfefa26e30389a1cf417f
Parents: e349c34
Author: James E. King, III <ji...@simplivity.com>
Authored: Wed Sep 28 11:03:27 2016 -0400
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Sat Oct 1 23:39:46 2016 +0900

----------------------------------------------------------------------
 compiler/cpp/src/thrift/windows/config.h       | 21 +++++++++++++++++++++
 lib/cpp/src/thrift/transport/PlatformSocket.h  |  6 +++++-
 lib/cpp/src/thrift/transport/TServerSocket.cpp |  6 +++---
 lib/cpp/src/thrift/windows/config.h            | 11 ++++++++---
 4 files changed, 37 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/4d39ac52/compiler/cpp/src/thrift/windows/config.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/windows/config.h b/compiler/cpp/src/thrift/windows/config.h
index a600080..5f057ca 100644
--- a/compiler/cpp/src/thrift/windows/config.h
+++ b/compiler/cpp/src/thrift/windows/config.h
@@ -42,4 +42,25 @@
 // squelch bool conversion performance warning
 #pragma warning(disable : 4800)
 
+// MSVC10 (2010) or later has stdint.h
+#if _MSC_VER >= 1600
+#define HAVE_STDINT_H 1
+#endif
+
+// Must be using VS2010 or later, or boost, so that C99 types are defined in the global namespace
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
+#include <boost/cstdint.hpp>
+
+typedef boost::int64_t int64_t;
+typedef boost::uint64_t uint64_t;
+typedef boost::int32_t int32_t;
+typedef boost::uint32_t uint32_t;
+typedef boost::int16_t int16_t;
+typedef boost::uint16_t uint16_t;
+typedef boost::int8_t int8_t;
+typedef boost::uint8_t uint8_t;
+#endif
+
 #endif // _THRIFT_WINDOWS_CONFIG_H_

http://git-wip-us.apache.org/repos/asf/thrift/blob/4d39ac52/lib/cpp/src/thrift/transport/PlatformSocket.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/PlatformSocket.h b/lib/cpp/src/thrift/transport/PlatformSocket.h
index 96a3da3..e7addd6 100644
--- a/lib/cpp/src/thrift/transport/PlatformSocket.h
+++ b/lib/cpp/src/thrift/transport/PlatformSocket.h
@@ -58,7 +58,11 @@
 #    define THRIFT_GAI_STRERROR gai_strerrorA
 #  endif
 #  define THRIFT_SSIZET ptrdiff_t
-#  define THRIFT_SNPRINTF _snprintf
+#  if (_MSC_VER < 1900)
+#    define THRIFT_SNPRINTF _snprintf
+#  else
+#    define THRIFT_SNPRINTF snprintf
+#  endif
 #  define THRIFT_SLEEP_SEC thrift_sleep
 #  define THRIFT_SLEEP_USEC thrift_usleep
 #  define THRIFT_TIMESPEC thrift_timespec

http://git-wip-us.apache.org/repos/asf/thrift/blob/4d39ac52/lib/cpp/src/thrift/transport/TServerSocket.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TServerSocket.cpp b/lib/cpp/src/thrift/transport/TServerSocket.cpp
index c233e69..87b6383 100644
--- a/lib/cpp/src/thrift/transport/TServerSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TServerSocket.cpp
@@ -279,7 +279,7 @@ void TServerSocket::listen() {
   const struct addrinfo *res;
   int error;
   char port[sizeof("65535")];
-  snprintf(port, sizeof(port), "%d", port_);
+  THRIFT_SNPRINTF(port, sizeof(port), "%d", port_);
 
   struct addrinfo hints;
   std::memset(&hints, 0, sizeof(hints));
@@ -524,9 +524,9 @@ void TServerSocket::listen() {
   if (retries > retryLimit_) {
     char errbuf[1024];
     if (!path_.empty()) {
-      snprintf(errbuf, sizeof(errbuf), "TServerSocket::listen() PATH %s", path_.c_str());
+      THRIFT_SNPRINTF(errbuf, sizeof(errbuf), "TServerSocket::listen() PATH %s", path_.c_str());
     } else {
-      snprintf(errbuf, sizeof(errbuf), "TServerSocket::listen() BIND %d", port_);
+      THRIFT_SNPRINTF(errbuf, sizeof(errbuf), "TServerSocket::listen() BIND %d", port_);
     }
     GlobalOutput(errbuf);
     close();

http://git-wip-us.apache.org/repos/asf/thrift/blob/4d39ac52/lib/cpp/src/thrift/windows/config.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h
index 8650103..674c260 100644
--- a/lib/cpp/src/thrift/windows/config.h
+++ b/lib/cpp/src/thrift/windows/config.h
@@ -25,18 +25,22 @@
 #endif // _MSC_VER
 
 #ifndef _WIN32
-#error This is a MSVC header only.
+#error "This is a Windows header only"
 #endif
 
 // use std::thread in MSVC11 (2012) or newer
 #if _MSC_VER >= 1700
-#define HAVE_STDINT_H 1
 #define USE_STD_THREAD 1
-// otherwise use boost threads
 #else
+// otherwise use boost threads
 #define USE_BOOST_THREAD 1
 #endif
 
+// VS2010 or later has stdint.h
+#if _MSC_VER >= 1600
+#define HAVE_STDINT_H 1
+#endif
+
 #ifndef TARGET_WIN_XP
 #define TARGET_WIN_XP 1
 #endif
@@ -65,6 +69,7 @@
 #define HAVE_GETTIMEOFDAY 1
 #define HAVE_SYS_STAT_H 1
 
+// Must be using VS2010 or later, or boost, so that C99 types are defined in the global namespace
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
 #else


[3/3] thrift git commit: THRIFT-3831 in test/cpp explicitly use `signed char`

Posted by ns...@apache.org.
THRIFT-3831 in test/cpp explicitly use `signed char`

`char`'s signed-ness is implimentation dependent, and in the case where
`char` was not signed, we previously recieved errors like

    thrift/0.9.3-r0/git/test/cpp/src/TestClient.cpp:404:15: error: narrowing conversion of '-127' from 'int' to 'char' inside { } [-Wnarrowing]

(This example from gcc-6 on arm)

This closes #1085


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/3129549f
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/3129549f
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/3129549f

Branch: refs/heads/master
Commit: 3129549feb1647a42c5e29f4ac171583937139fa
Parents: 4bbfe61
Author: Cody P Schafer <de...@codyps.com>
Authored: Fri Sep 9 15:50:26 2016 -0400
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Sat Oct 1 23:40:56 2016 +0900

----------------------------------------------------------------------
 test/cpp/src/TestClient.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/3129549f/test/cpp/src/TestClient.cpp
----------------------------------------------------------------------
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index bbe1962..c16d045 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -530,7 +530,7 @@ int main(int argc, char** argv) {
       return_code |= ERR_BASETYPES;
     }
     cout << "testBinary([-128..127]) = {" << flush;
-    const char bin_data[256]
+    const signed char bin_data[256]
         = {-128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114,
            -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99,
            -98,  -97,  -96,  -95,  -94,  -93,  -92,  -91,  -90,  -89,  -88,  -87,  -86,  -85,  -84,
@@ -551,7 +551,7 @@ int main(int argc, char** argv) {
            127};
     try {
       string bin_result;
-      testClient.testBinary(bin_result, string(bin_data, 256));
+      testClient.testBinary(bin_result, string(reinterpret_cast<const char *>(bin_data), 256));
       if (bin_result.size() != 256) {
         cout << endl << "*** FAILED ***" << endl;
         cout << "invalid length: " << bin_result.size() << endl;


[2/3] thrift git commit: THRIFT-3878: fix interop with newer OpenSSL libraries

Posted by ns...@apache.org.
THRIFT-3878: fix interop with newer OpenSSL libraries

This closes #1102


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/4bbfe612
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/4bbfe612
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/4bbfe612

Branch: refs/heads/master
Commit: 4bbfe6120e71b81df7f23dcc246990c29eb27859
Parents: 4d39ac5
Author: James E. King, III <ji...@simplivity.com>
Authored: Thu Sep 29 15:04:09 2016 -0400
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Sat Oct 1 23:40:03 2016 +0900

----------------------------------------------------------------------
 lib/cpp/src/thrift/transport/TSSLSocket.cpp | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/4bbfe612/lib/cpp/src/thrift/transport/TSSLSocket.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
index 517151f..1efb9f7 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
@@ -108,7 +108,12 @@ void initializeOpenSSL() {
   SSL_library_init();
   SSL_load_error_strings();
   // static locking
+  // newer versions of OpenSSL changed CRYPTO_num_locks - see THRIFT-3878
+#ifdef CRYPTO_num_locks
+  mutexes = boost::shared_array<Mutex>(new Mutex[CRYPTO_num_locks()]);
+#else
   mutexes = boost::shared_array<Mutex>(new Mutex[ ::CRYPTO_num_locks()]);
+#endif
   if (mutexes == NULL) {
     throw TTransportException(TTransportException::INTERNAL_ERROR,
                               "initializeOpenSSL() failed, "