This is an automated email from the ASF dual-hosted git repository. jking pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/thrift.git
commit 7b935597bac2336c7f4d282069ab4d78ca473543 Author: cyy <cyye...@outlook.com> AuthorDate: Sat Jan 5 10:04:25 2019 +0800 use noexcept instead of throw() in library --- lib/cpp/src/thrift/TApplicationException.h | 4 ++-- lib/cpp/src/thrift/Thrift.h | 4 ++-- lib/cpp/src/thrift/protocol/TProtocolException.h | 4 ++-- lib/cpp/src/thrift/transport/TSSLSocket.cpp | 6 +++--- lib/cpp/src/thrift/transport/TSSLSocket.h | 14 +++++++------- lib/cpp/src/thrift/transport/TTransportException.cpp | 2 +- lib/cpp/src/thrift/transport/TTransportException.h | 6 +++--- lib/cpp/src/thrift/transport/TZlibTransport.h | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/cpp/src/thrift/TApplicationException.h b/lib/cpp/src/thrift/TApplicationException.h index 81d9424..60618fb 100644 --- a/lib/cpp/src/thrift/TApplicationException.h +++ b/lib/cpp/src/thrift/TApplicationException.h @@ -57,7 +57,7 @@ public: TApplicationException(TApplicationExceptionType type, const std::string& message) : TException(message), type_(type) {} - virtual ~TApplicationException() throw() {} + virtual ~TApplicationException() noexcept {} /** * Returns an error code that provides information about the type of error @@ -67,7 +67,7 @@ public: */ TApplicationExceptionType getType() const { return type_; } - virtual const char* what() const throw() { + virtual const char* what() const noexcept { if (message_.empty()) { switch (type_) { case UNKNOWN: diff --git a/lib/cpp/src/thrift/Thrift.h b/lib/cpp/src/thrift/Thrift.h index e8e70eb..b41d5d2 100644 --- a/lib/cpp/src/thrift/Thrift.h +++ b/lib/cpp/src/thrift/Thrift.h @@ -82,9 +82,9 @@ public: TException(const std::string& message) : message_(message) {} - virtual ~TException() throw() {} + virtual ~TException() noexcept {} - virtual const char* what() const throw() { + virtual const char* what() const noexcept { if (message_.empty()) { return "Default TException."; } else { diff --git a/lib/cpp/src/thrift/protocol/TProtocolException.h b/lib/cpp/src/thrift/protocol/TProtocolException.h index 6e536b4..10178e1 100644 --- a/lib/cpp/src/thrift/protocol/TProtocolException.h +++ b/lib/cpp/src/thrift/protocol/TProtocolException.h @@ -59,7 +59,7 @@ public: TProtocolException(TProtocolExceptionType type, const std::string& message) : apache::thrift::TException(message), type_(type) {} - virtual ~TProtocolException() throw() {} + virtual ~TProtocolException() noexcept {} /** * Returns an error code that provides information about the type of error @@ -69,7 +69,7 @@ public: */ TProtocolExceptionType getType() const { return type_; } - virtual const char* what() const throw() { + virtual const char* what() const noexcept { if (message_.empty()) { switch (type_) { case UNKNOWN: diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp index 251ef2f..5f8a2c0 100644 --- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp +++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp @@ -1046,14 +1046,14 @@ void buildErrors(string& errors, int errno_copy, int sslerrno) { /** * Default implementation of AccessManager */ -Decision DefaultClientAccessManager::verify(const sockaddr_storage& sa) throw() { +Decision DefaultClientAccessManager::verify(const sockaddr_storage& sa) noexcept { (void)sa; return SKIP; } Decision DefaultClientAccessManager::verify(const string& host, const char* name, - int size) throw() { + int size) noexcept { if (host.empty() || name == NULL || size <= 0) { return SKIP; } @@ -1062,7 +1062,7 @@ Decision DefaultClientAccessManager::verify(const string& host, Decision DefaultClientAccessManager::verify(const sockaddr_storage& sa, const char* data, - int size) throw() { + int size) noexcept { bool match = false; if (sa.ss_family == AF_INET && size == sizeof(in_addr)) { match = (memcmp(&((sockaddr_in*)&sa)->sin_addr, data, size) == 0); diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.h b/lib/cpp/src/thrift/transport/TSSLSocket.h index ec30cc1..d8fd77e 100644 --- a/lib/cpp/src/thrift/transport/TSSLSocket.h +++ b/lib/cpp/src/thrift/transport/TSSLSocket.h @@ -335,7 +335,7 @@ public: TSSLException(const std::string& message) : TTransportException(TTransportException::INTERNAL_ERROR, message) {} - virtual const char* what() const throw() { + virtual const char* what() const noexcept { if (message_.empty()) { return "TSSLException"; } else { @@ -386,7 +386,7 @@ public: * @param sa Peer IP address * @return True if the peer is trusted, false otherwise */ - virtual Decision verify(const sockaddr_storage& /* sa */) throw() { return DENY; } + virtual Decision verify(const sockaddr_storage& /* sa */) noexcept { return DENY; } /** * Determine whether the peer should be granted access or not. It's called * every time a DNS subjectAltName/common name is extracted from peer's @@ -402,7 +402,7 @@ public: */ virtual Decision verify(const std::string& /* host */, const char* /* name */, - int /* size */) throw() { + int /* size */) noexcept { return DENY; } /** @@ -416,7 +416,7 @@ public: */ virtual Decision verify(const sockaddr_storage& /* sa */, const char* /* data */, - int /* size */) throw() { + int /* size */) noexcept { return DENY; } }; @@ -426,9 +426,9 @@ typedef AccessManager::Decision Decision; class DefaultClientAccessManager : public AccessManager { public: // AccessManager interface - Decision verify(const sockaddr_storage& sa) throw(); - Decision verify(const std::string& host, const char* name, int size) throw(); - Decision verify(const sockaddr_storage& sa, const char* data, int size) throw(); + Decision verify(const sockaddr_storage& sa) noexcept; + Decision verify(const std::string& host, const char* name, int size) noexcept; + Decision verify(const sockaddr_storage& sa, const char* data, int size) noexcept; }; } } diff --git a/lib/cpp/src/thrift/transport/TTransportException.cpp b/lib/cpp/src/thrift/transport/TTransportException.cpp index 9e15dbd..a527317 100644 --- a/lib/cpp/src/thrift/transport/TTransportException.cpp +++ b/lib/cpp/src/thrift/transport/TTransportException.cpp @@ -28,7 +28,7 @@ namespace apache { namespace thrift { namespace transport { -const char* TTransportException::what() const throw() { +const char* TTransportException::what() const noexcept { if (message_.empty()) { switch (type_) { case UNKNOWN: diff --git a/lib/cpp/src/thrift/transport/TTransportException.h b/lib/cpp/src/thrift/transport/TTransportException.h index dbbb971..fb5f00c 100644 --- a/lib/cpp/src/thrift/transport/TTransportException.h +++ b/lib/cpp/src/thrift/transport/TTransportException.h @@ -65,7 +65,7 @@ public: TTransportException(TTransportExceptionType type, const std::string& message, int errno_copy) : apache::thrift::TException(message + ": " + TOutput::strerror_s(errno_copy)), type_(type) {} - virtual ~TTransportException() throw() {} + virtual ~TTransportException() noexcept {} /** * Returns an error code that provides information about the type of error @@ -73,9 +73,9 @@ public: * * @return Error code */ - TTransportExceptionType getType() const throw() { return type_; } + TTransportExceptionType getType() const noexcept { return type_; } - virtual const char* what() const throw(); + virtual const char* what() const noexcept; protected: /** Just like strerror_r but returns a C++ string object. */ diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.h b/lib/cpp/src/thrift/transport/TZlibTransport.h index a0fb464..59acd69 100644 --- a/lib/cpp/src/thrift/transport/TZlibTransport.h +++ b/lib/cpp/src/thrift/transport/TZlibTransport.h @@ -38,7 +38,7 @@ public: zlib_status_(status), zlib_msg_(msg == NULL ? "(null)" : msg) {} - virtual ~TZlibTransportException() throw() {} + virtual ~TZlibTransportException() noexcept {} int getZlibStatus() { return zlib_status_; } std::string getZlibMessage() { return zlib_msg_; }