diff options
author | Mario Emmenlauer <mario@emmenlauer.de> | 2022-09-10 00:26:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-10 00:26:36 -0700 |
commit | c96c044cf85e5e0b89451b9f2a06e2fd5b901f72 (patch) | |
tree | a77131ce2972e57c24b1dcfe759058f9fcc52ab2 /lib/cpp/src/thrift/transport | |
parent | c97dee069734f705937d45147cd7a1bdd2e49a6b (diff) | |
parent | d6a42e1823d6b2686e7ab56f2d21ef2f5689aec1 (diff) | |
download | thrift-c96c044cf85e5e0b89451b9f2a06e2fd5b901f72.tar.gz |
Merge pull request #2630 from kou/cpp-scoped-array-to-unique-ptr
THRIFT-5602: Use std::unique_ptr instead of boost::scoped_array
Diffstat (limited to 'lib/cpp/src/thrift/transport')
-rw-r--r-- | lib/cpp/src/thrift/transport/TBufferTransports.h | 9 | ||||
-rw-r--r-- | lib/cpp/src/thrift/transport/TFileTransport.cpp | 2 | ||||
-rw-r--r-- | lib/cpp/src/thrift/transport/THeaderTransport.h | 4 |
3 files changed, 6 insertions, 9 deletions
diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.h b/lib/cpp/src/thrift/transport/TBufferTransports.h index 3ef8d1f6a..f72d8f6bf 100644 --- a/lib/cpp/src/thrift/transport/TBufferTransports.h +++ b/lib/cpp/src/thrift/transport/TBufferTransports.h @@ -23,7 +23,6 @@ #include <cstdlib> #include <cstring> #include <limits> -#include <boost/scoped_array.hpp> #include <thrift/transport/TTransport.h> #include <thrift/transport/TVirtualTransport.h> @@ -281,8 +280,8 @@ protected: uint32_t rBufSize_; uint32_t wBufSize_; - boost::scoped_array<uint8_t> rBuf_; - boost::scoped_array<uint8_t> wBuf_; + std::unique_ptr<uint8_t[]> rBuf_; + std::unique_ptr<uint8_t[]> wBuf_; }; /** @@ -422,8 +421,8 @@ protected: uint32_t rBufSize_; uint32_t wBufSize_; - boost::scoped_array<uint8_t> rBuf_; - boost::scoped_array<uint8_t> wBuf_; + std::unique_ptr<uint8_t[]> rBuf_; + std::unique_ptr<uint8_t[]> wBuf_; uint32_t bufReclaimThresh_; uint32_t maxFrameSize_; }; diff --git a/lib/cpp/src/thrift/transport/TFileTransport.cpp b/lib/cpp/src/thrift/transport/TFileTransport.cpp index 4ef8277d7..3a24e3a22 100644 --- a/lib/cpp/src/thrift/transport/TFileTransport.cpp +++ b/lib/cpp/src/thrift/transport/TFileTransport.cpp @@ -425,7 +425,7 @@ void TFileTransport::writerThread() { auto* zeros = new uint8_t[padding]; memset(zeros, '\0', padding); - boost::scoped_array<uint8_t> array(zeros); + std::unique_ptr<uint8_t[]> array(zeros); if (-1 == ::THRIFT_WRITE(fd_, zeros, padding)) { int errno_copy = THRIFT_ERRNO; GlobalOutput.perror("TFileTransport: writerThread() error while padding zeros ", diff --git a/lib/cpp/src/thrift/transport/THeaderTransport.h b/lib/cpp/src/thrift/transport/THeaderTransport.h index 63a4ac880..0343fe3e1 100644 --- a/lib/cpp/src/thrift/transport/THeaderTransport.h +++ b/lib/cpp/src/thrift/transport/THeaderTransport.h @@ -33,8 +33,6 @@ #include <inttypes.h> #endif -#include <boost/scoped_array.hpp> - #include <thrift/protocol/TProtocolTypes.h> #include <thrift/transport/TBufferTransports.h> #include <thrift/transport/TTransport.h> @@ -223,7 +221,7 @@ protected: // Buffers to use for transform processing uint32_t tBufSize_; - boost::scoped_array<uint8_t> tBuf_; + std::unique_ptr<uint8_t[]> tBuf_; void readString(uint8_t*& ptr, /* out */ std::string& str, uint8_t const* headerBoundary); |