You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by em...@apache.org on 2022/09/10 07:26:42 UTC
[thrift] branch master updated: THRIFT-5602: Use std::unique_ptr instead of boost::scoped_array
This is an automated email from the ASF dual-hosted git repository.
emmenlau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new d6a42e182 THRIFT-5602: Use std::unique_ptr instead of boost::scoped_array
new c96c044cf Merge pull request #2630 from kou/cpp-scoped-array-to-unique-ptr
d6a42e182 is described below
commit d6a42e1823d6b2686e7ab56f2d21ef2f5689aec1
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Fri Jul 1 15:24:23 2022 +0900
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.
---
lib/cpp/src/thrift/transport/TBufferTransports.h | 9 ++++-----
lib/cpp/src/thrift/transport/TFileTransport.cpp | 2 +-
lib/cpp/src/thrift/transport/THeaderTransport.h | 4 +---
lib/cpp/test/TransportTest.cpp | 2 +-
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();