summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSutou Kouhei <kou@clear-code.com>2022-07-01 15:24:23 +0900
committerSutou Kouhei <kou@clear-code.com>2022-09-09 23:25:48 +0900
commitd6a42e1823d6b2686e7ab56f2d21ef2f5689aec1 (patch)
tree0981f5d451d40063878a97c954a265371d4731a4 /lib
parent72d5912424211561adc6f8e7bc502180631d9f8e (diff)
downloadthrift-d6a42e1823d6b2686e7ab56f2d21ef2f5689aec1.tar.gz
THRIFT-5602: Use std::unique_ptr instead of boost::scoped_array
Client: cpp We can use std::unique_ptr because we require C++11 or later.
Diffstat (limited to 'lib')
-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 08372b3e2..34fc1c29e 100644
--- a/lib/cpp/src/thrift/transport/TFileTransport.cpp
+++ b/lib/cpp/src/thrift/transport/TFileTransport.cpp
@@ -427,7 +427,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();