summaryrefslogtreecommitdiff
path: root/lib/cpp
diff options
context:
space:
mode:
authorMario Emmenlauer <mario@emmenlauer.de>2022-09-10 00:26:36 -0700
committerGitHub <noreply@github.com>2022-09-10 00:26:36 -0700
commitc96c044cf85e5e0b89451b9f2a06e2fd5b901f72 (patch)
treea77131ce2972e57c24b1dcfe759058f9fcc52ab2 /lib/cpp
parentc97dee069734f705937d45147cd7a1bdd2e49a6b (diff)
parentd6a42e1823d6b2686e7ab56f2d21ef2f5689aec1 (diff)
downloadthrift-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')
-rw-r--r--lib/cpp/src/thrift/transport/TBufferTransports.h9
-rw-r--r--lib/cpp/src/thrift/transport/TFileTransport.cpp2
-rw-r--r--lib/cpp/src/thrift/transport/THeaderTransport.h4
-rw-r--r--lib/cpp/test/TransportTest.cpp2
4 files changed, 7 insertions, 10 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);
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
index 085197a08..d6d38595a 100644
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -379,7 +379,7 @@ void alarm_handler() {
// Write some data to the transport to hopefully unblock it.
auto* buf = new uint8_t[info->writeLength];
memset(buf, 'b', info->writeLength);
- boost::scoped_array<uint8_t> array(buf);
+ std::unique_ptr<uint8_t[]> array(buf);
info->transport->write(buf, info->writeLength);
info->transport->flush();