thrift git commit: THRIFT-4075: better support for headers-only boost with mingw Client: C++

2017-02-10 Thread jking
Repository: thrift
Updated Branches:
  refs/heads/master e1832c354 -> bff044667


THRIFT-4075: better support for headers-only boost with mingw
Client: C++

This closes #1184


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

Branch: refs/heads/master
Commit: bff044667caf8a8c2b0dd30ed11b328ff2902cf5
Parents: e1832c3
Author: James E. King, III 
Authored: Sat Feb 11 01:18:03 2017 -0500
Committer: James E. King, III 
Committed: Sat Feb 11 01:18:03 2017 -0500

--
 lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h | 2 +-
 lib/cpp/src/thrift/windows/config.h | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/thrift/blob/bff04466/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
--
diff --git a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h 
b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
index 56684bb..dd0c5c9 100644
--- a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
+++ b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
@@ -63,7 +63,7 @@ namespace apache {
 namespace thrift {
 namespace transport {
 
-DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) struct TOverlappedWorkItem : 
public SLIST_ENTRY {
+struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) TOverlappedWorkItem : 
public SLIST_ENTRY {
   TOverlappedWorkItem();
 
   enum action_t {

http://git-wip-us.apache.org/repos/asf/thrift/blob/bff04466/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 cde9de6..f54cb5e 100644
--- a/lib/cpp/src/thrift/windows/config.h
+++ b/lib/cpp/src/thrift/windows/config.h
@@ -28,8 +28,8 @@
 #error "This is a Windows header only"
 #endif
 
-// use std::thread in MSVC11 (2012) or newer
-#if _MSC_VER >= 1700
+// use std::thread in MSVC11 (2012) or newer and in MinGW
+#if (_MSC_VER >= 1700) || defined(__MINGW32__)
 #define USE_STD_THREAD 1
 #else
 // otherwise use boost threads
@@ -39,8 +39,8 @@
 // Something that defines PRId64 is required to build
 #define HAVE_INTTYPES_H 1
 
-// VS2010 or later has stdint.h
-#if _MSC_VER >= 1600
+// VS2010 or later has stdint.h as does MinGW
+#if (_MSC_VER >= 1600) || defined(__MINGW32__)
 #define HAVE_STDINT_H 1
 #endif
 



thrift git commit: THRIFT-3622: remove auto_ptr use in the codebase because it is deprecated Client: C++

2017-02-10 Thread jking
Repository: thrift
Updated Branches:
  refs/heads/master 3590f1e7c -> e1832c354


THRIFT-3622: remove auto_ptr use in the codebase because it is deprecated
Client: C++

This closes #1183


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

Branch: refs/heads/master
Commit: e1832c354391deb0e0ce94a62ff32e8ce1c83fd3
Parents: 3590f1e
Author: James E. King, III 
Authored: Fri Feb 10 13:03:10 2017 -0500
Committer: James E. King, III 
Committed: Fri Feb 10 13:03:10 2017 -0500

--
 lib/cpp/src/thrift/async/TEvhttpServer.cpp  |  4 +--
 .../thrift/concurrency/BoostThreadFactory.cpp   |  8 +++---
 lib/cpp/src/thrift/transport/TFileTransport.cpp | 27 +---
 lib/cpp/test/DebugProtoTest.cpp |  7 ++---
 lib/cpp/test/JSONProtoTest.cpp  |  7 ++---
 5 files changed, 38 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/thrift/blob/e1832c35/lib/cpp/src/thrift/async/TEvhttpServer.cpp
--
diff --git a/lib/cpp/src/thrift/async/TEvhttpServer.cpp 
b/lib/cpp/src/thrift/async/TEvhttpServer.cpp
index 57d0d61..4fa41f8 100644
--- a/lib/cpp/src/thrift/async/TEvhttpServer.cpp
+++ b/lib/cpp/src/thrift/async/TEvhttpServer.cpp
@@ -20,10 +20,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-
 #include 
 
 #ifndef HTTP_INTERNAL // libevent < 2
@@ -118,7 +118,7 @@ void TEvhttpServer::process(struct evhttp_request* req) {
 
 void TEvhttpServer::complete(RequestContext* ctx, bool success) {
   (void)success;
-  std::auto_ptr ptr(ctx);
+  boost::scoped_ptr ptr(ctx);
 
   int code = success ? 200 : 400;
   const char* reason = success ? "OK" : "Bad Request";

http://git-wip-us.apache.org/repos/asf/thrift/blob/e1832c35/lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp
--
diff --git a/lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp 
b/lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp
index a72d38b..6adcb68 100644
--- a/lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp
+++ b/lib/cpp/src/thrift/concurrency/BoostThreadFactory.cpp
@@ -26,8 +26,9 @@
 
 #include 
 
-#include 
+#include 
 #include 
+#include 
 
 namespace apache {
 namespace thrift {
@@ -48,7 +49,7 @@ public:
   static void* threadMain(void* arg);
 
 private:
-  std::auto_ptr thread_;
+  boost::scoped_ptr thread_;
   STATE state_;
   weak_ptr self_;
   bool detached_;
@@ -80,8 +81,7 @@ public:
 
 state_ = starting;
 
-thread_
-= std::auto_ptr(new 
boost::thread(boost::bind(threadMain, (void*)selfRef)));
+thread_.reset(new boost::thread(boost::bind(threadMain, (void*)selfRef)));
 
 if (detached_)
   thread_->detach();

http://git-wip-us.apache.org/repos/asf/thrift/blob/e1832c35/lib/cpp/src/thrift/transport/TFileTransport.cpp
--
diff --git a/lib/cpp/src/thrift/transport/TFileTransport.cpp 
b/lib/cpp/src/thrift/transport/TFileTransport.cpp
index 85e88b9..e49f81c 100644
--- a/lib/cpp/src/thrift/transport/TFileTransport.cpp
+++ b/lib/cpp/src/thrift/transport/TFileTransport.cpp
@@ -24,6 +24,16 @@
 #include 
 #include 
 
+#include 
+#include 
+#if (BOOST_VERSION >= 105700)
+#include 
+using boost::movelib::unique_ptr;
+#else
+#include 
+using boost::interprocess::unique_ptr;
+#endif
+
 #ifdef HAVE_SYS_TIME_H
 #include 
 #else
@@ -52,9 +62,12 @@ namespace apache {
 namespace thrift {
 namespace transport {
 
-using boost::scoped_ptr;
 using boost::shared_ptr;
-using namespace std;
+using std::cerr;
+using std::cout;
+using std::endl;
+using std::min;
+using std::string;
 using namespace apache::thrift::protocol;
 using namespace apache::thrift::concurrency;
 
@@ -192,6 +205,14 @@ void TFileTransport::write(const uint8_t* buf, uint32_t 
len) {
   enqueueEvent(buf, len);
 }
 
+// this is needed until boost 1.57 as the older unique_ptr implementation
+// has no default deleter in interprocess
+template 
+struct uniqueDeleter
+{
+  void operator()(_T *ptr) const { delete ptr; }
+};
+
 void TFileTransport::enqueueEvent(const uint8_t* buf, uint32_t eventLen) {
   // can't enqueue more events if file is going to close
   if (closing_) {
@@ -209,7 +230,7 @@ void TFileTransport::enqueueEvent(const uint8_t* buf, 
uint32_t eventLen) {
 return;
   }
 
-  std::auto_ptr toEnqueue(new eventInfo());
+  unique_ptr toEnqueue(new eventInfo());
   toEnqueue->eventBuff_ = new uint8_t[(sizeof(uint8_t) * eventLen) + 4];
 
   // first 4 bytes is the event