THRIFT-5225: Use nullptr instead of NULL
Patch: Zezeng Wang
This closes #2168
diff --git a/lib/cpp/src/thrift/TOutput.cpp b/lib/cpp/src/thrift/TOutput.cpp
index 800ba07..a30879a 100644
--- a/lib/cpp/src/thrift/TOutput.cpp
+++ b/lib/cpp/src/thrift/TOutput.cpp
@@ -122,8 +122,8 @@
#else // HAVE_STRERROR_R
#ifdef _WIN32
const size_t size = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, errno_copy, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- b_errbuf, sizeof(b_errbuf), NULL);
+ nullptr, errno_copy, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ b_errbuf, sizeof(b_errbuf), nullptr);
if (size > 2 && b_errbuf[size-2] == '\r' && b_errbuf[size-1] == '\n') {
b_errbuf[size-2] = '\0';
diff --git a/lib/cpp/src/thrift/VirtualProfiling.cpp b/lib/cpp/src/thrift/VirtualProfiling.cpp
index 6ce346b..4d752cf 100644
--- a/lib/cpp/src/thrift/VirtualProfiling.cpp
+++ b/lib/cpp/src/thrift/VirtualProfiling.cpp
@@ -112,7 +112,7 @@
void* getFrame(int index) const {
int adjusted_index = index + skip_;
if (adjusted_index < 0 || adjusted_index >= numCallers_) {
- return NULL;
+ return nullptr;
}
return callers_[adjusted_index];
}
@@ -151,7 +151,7 @@
};
Key(const Backtrace* bt, const std::type_info& type_info)
- : backtrace_(bt), typeName1_(type_info.name()), typeName2_(NULL) {}
+ : backtrace_(bt), typeName1_(type_info.name()), typeName2_(nullptr) {}
Key(const Backtrace* bt, const std::type_info& type_info1, const std::type_info& type_info2)
: backtrace_(bt), typeName1_(type_info1.name()), typeName2_(type_info2.name()) {}
@@ -189,7 +189,7 @@
*/
void cleanup() {
delete backtrace_;
- backtrace_ = NULL;
+ backtrace_ = nullptr;
}
int cmp(const Key& k) const {
diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
index 26ffa68..ea394c8 100644
--- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
@@ -1341,7 +1341,7 @@
FD_ZERO(&efds);
FD_SET(fd, &wfds);
FD_SET(fd, &efds);
- ret = select(static_cast<int>(fd + 1), NULL, &wfds, &efds, NULL);
+ ret = select(static_cast<int>(fd + 1), nullptr, &wfds, &efds, nullptr);
if (ret < 0) {
return false;
} else if (ret == 0) {
diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.h b/lib/cpp/src/thrift/server/TNonblockingServer.h
index e44c7ee..65e569d 100644
--- a/lib/cpp/src/thrift/server/TNonblockingServer.h
+++ b/lib/cpp/src/thrift/server/TNonblockingServer.h
@@ -158,7 +158,7 @@
/// The optional user-provided event-base (for single-thread servers)
event_base* userEventBase_;
- /// For processing via thread pool, may be NULL
+ /// For processing via thread pool, may be nullptr
std::shared_ptr<ThreadManager> threadManager_;
/// Is thread pool processing?
diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.cpp b/lib/cpp/src/thrift/transport/TBufferTransports.cpp
index 329d220..d8a1b3e 100644
--- a/lib/cpp/src/thrift/transport/TBufferTransports.cpp
+++ b/lib/cpp/src/thrift/transport/TBufferTransports.cpp
@@ -112,7 +112,7 @@
const uint8_t* TBufferedTransport::borrowSlow(uint8_t* buf, uint32_t* len) {
(void)buf;
(void)len;
- // Simply return NULL. We don't know if there is actually data available on
+ // Simply return nullptr. We don't know if there is actually data available on
// the underlying transport, so calling read() might block.
return nullptr;
}
diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.h b/lib/cpp/src/thrift/transport/TBufferTransports.h
index df06586..86f0c5a 100644
--- a/lib/cpp/src/thrift/transport/TBufferTransports.h
+++ b/lib/cpp/src/thrift/transport/TBufferTransports.h
@@ -137,7 +137,7 @@
/**
* Slow path borrow.
*
- * POSTCONDITION: return == NULL || rBound_ - rBase_ >= *len
+ * POSTCONDITION: return == nullptr || rBound_ - rBase_ >= *len
*/
virtual const uint8_t* borrowSlow(uint8_t* buf, uint32_t* len) = 0;
@@ -245,7 +245,7 @@
/**
* The following behavior is currently implemented by TBufferedTransport,
* but that may change in a future version:
- * 1/ If len is at most rBufSize_, borrow will never return NULL.
+ * 1/ If len is at most rBufSize_, borrow will never return nullptr.
* Depending on the underlying transport, it could throw an exception
* or hang forever.
* 2/ Some borrow requests may copy bytes internally. However,
diff --git a/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h b/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h
index f811328..e8997d7 100644
--- a/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h
+++ b/lib/cpp/src/thrift/transport/TNonblockingServerTransport.h
@@ -49,7 +49,7 @@
* Gets a new dynamically allocated transport object and passes it to the
* caller. Note that it is the explicit duty of the caller to free the
* allocated object. The returned TTransport object must always be in the
- * opened state. NULL should never be returned, instead an Exception should
+ * opened state. nullptr should never be returned, instead an Exception should
* always be thrown.
*
* @return A new TTransport object
@@ -58,7 +58,7 @@
std::shared_ptr<TSocket> accept() {
std::shared_ptr<TSocket> result = acceptImpl();
if (!result) {
- throw TTransportException("accept() may not return NULL");
+ throw TTransportException("accept() may not return nullptr");
}
return result;
}
diff --git a/lib/cpp/src/thrift/transport/TPipe.cpp b/lib/cpp/src/thrift/transport/TPipe.cpp
index 72af4fc..4c2fea9 100644
--- a/lib/cpp/src/thrift/transport/TPipe.cpp
+++ b/lib/cpp/src/thrift/transport/TPipe.cpp
@@ -183,7 +183,7 @@
uint32_t written = 0;
while (written < len) {
- BOOL result = ::WriteFile(pipe, buf + written, len - written, NULL, &tempOverlap);
+ BOOL result = ::WriteFile(pipe, buf + written, len - written, nullptr, &tempOverlap);
if (result == FALSE && ::GetLastError() != ERROR_IO_PENDING) {
GlobalOutput.perror("TPipe ::WriteFile errored GLE=", ::GetLastError());
@@ -205,7 +205,7 @@
memset(&tempOverlap, 0, sizeof(tempOverlap));
tempOverlap.hEvent = event;
- BOOL result = ::ReadFile(pipe, buf, len, NULL, &tempOverlap);
+ BOOL result = ::ReadFile(pipe, buf, len, nullptr, &tempOverlap);
if (result == FALSE && ::GetLastError() != ERROR_IO_PENDING) {
GlobalOutput.perror("TPipe ::ReadFile errored GLE=", ::GetLastError());
@@ -255,7 +255,7 @@
// Transport callbacks
//---------------------------------------------------------
bool TPipe::isOpen() const {
- return impl_.get() != NULL;
+ return impl_.get() != nullptr;
}
bool TPipe::peek() {
@@ -272,10 +272,10 @@
hPipe.reset(CreateFileA(pipename_.c_str(),
GENERIC_READ | GENERIC_WRITE,
0, // no sharing
- NULL, // default security attributes
+ nullptr, // default security attributes
OPEN_EXISTING, // opens existing pipe
flags,
- NULL)); // no template file
+ nullptr)); // no template file
if (hPipe.h != INVALID_HANDLE_VALUE)
break; // success!
@@ -310,7 +310,7 @@
buf, // buffer to receive reply
len, // size of buffer
&cbRead, // number of bytes read
- NULL); // not overlapped
+ nullptr); // not overlapped
if (!fSuccess && GetLastError() != ERROR_MORE_DATA)
return 0; // No more data, possibly because client disconnected.
@@ -330,7 +330,7 @@
buf, // message
len, // message length
&cbWritten, // bytes written
- NULL); // not overlapped
+ nullptr); // not overlapped
if (!fSuccess)
throw TTransportException(TTransportException::NOT_OPEN, "Write to pipe failed");
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp
index e1cee80..2763551 100644
--- a/lib/cpp/src/thrift/transport/TPipeServer.cpp
+++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp
@@ -50,7 +50,7 @@
virtual HANDLE getWrtPipeHandle() = 0;
virtual HANDLE getClientRdPipeHandle() = 0;
virtual HANDLE getClientWrtPipeHandle() = 0;
- virtual HANDLE getNativeWaitHandle() { return NULL; }
+ virtual HANDLE getNativeWaitHandle() { return nullptr; }
};
class TAnonPipeServer : public TPipeServerImpl {
@@ -155,7 +155,7 @@
HANDLE TPipeServer::getNativeWaitHandle() {
if (impl_)
return impl_->getNativeWaitHandle();
- return NULL;
+ return nullptr;
}
//---- Constructors ----
@@ -227,7 +227,7 @@
&buf, // buffer to receive reply
0, // size of buffer
&br, // number of bytes read
- NULL); // not overlapped
+ nullptr); // not overlapped
if (!fSuccess && GetLastError() != ERROR_MORE_DATA) {
GlobalOutput.perror("TPipeServer unable to initiate pipe comms, GLE=", GetLastError());
@@ -248,7 +248,7 @@
// The prior connection has been handled, so close the gate
ResetEvent(listen_event_.h);
- connectOverlap_.reset(NULL, 0, listen_event_.h);
+ connectOverlap_.reset(nullptr, 0, listen_event_.h);
connectOverlap_.h = Pipe_.h;
thread_->addWorkItem(&connectOverlap_);
@@ -283,7 +283,7 @@
shared_ptr<TTransport> TNamedPipeServer::acceptImpl() {
{
TAutoCrit lock(pipe_protect_);
- if (cached_client_.get() != NULL) {
+ if (cached_client_.get() != nullptr) {
shared_ptr<TPipe> client;
// zero out cached_client, since we are about to return it.
client.swap(cached_client_);
@@ -350,7 +350,7 @@
bool TNamedPipeServer::createNamedPipe(const TAutoCrit& /*lockProof*/) {
- PSECURITY_DESCRIPTOR psd = NULL;
+ PSECURITY_DESCRIPTOR psd = nullptr;
ULONG size = 0;
if (!ConvertStringSecurityDescriptorToSecurityDescriptorA(securityDescriptor_.c_str(),
@@ -404,7 +404,7 @@
GetLastError());
return false;
}
- if (!SetSecurityDescriptorDacl(&sd, true, NULL, false)) {
+ if (!SetSecurityDescriptorDacl(&sd, true, nullptr, false)) {
GlobalOutput.perror("TPipeServer SetSecurityDescriptorDacl (anon) failed, GLE=",
GetLastError());
return false;
diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
index 64f08dd..aa76980 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
@@ -562,7 +562,7 @@
throw TSSLException("BIO_flush: Handshake is not completed");
BIO* bio = SSL_get_wbio(ssl_);
if (bio == nullptr) {
- throw TSSLException("SSL_get_wbio returns NULL");
+ throw TSSLException("SSL_get_wbio returns nullptr");
}
if (BIO_flush(bio) != 1) {
int errno_copy = THRIFT_GET_SOCKET_ERROR;
@@ -798,7 +798,7 @@
}
if (bio == nullptr) {
- throw TSSLException("SSL_get_?bio returned NULL");
+ throw TSSLException("SSL_get_?bio returned nullptr");
}
if (BIO_get_fd(bio, &fdSocket) <= 0) {
@@ -943,7 +943,7 @@
void TSSLSocketFactory::loadCertificate(const char* path, const char* format) {
if (path == nullptr || format == nullptr) {
throw TTransportException(TTransportException::BAD_ARGS,
- "loadCertificateChain: either <path> or <format> is NULL");
+ "loadCertificateChain: either <path> or <format> is nullptr");
}
if (strcmp(format, "PEM") == 0) {
if (SSL_CTX_use_certificate_chain_file(ctx_->get(), path) == 0) {
@@ -960,12 +960,12 @@
void TSSLSocketFactory::loadCertificateFromBuffer(const char* aCertificate, const char* format) {
if (aCertificate == nullptr || format == nullptr) {
throw TTransportException(TTransportException::BAD_ARGS,
- "loadCertificate: either <path> or <format> is NULL");
+ "loadCertificate: either <path> or <format> is nullptr");
}
if (strcmp(format, "PEM") == 0) {
BIO* mem = BIO_new(BIO_s_mem());
BIO_puts(mem, aCertificate);
- X509* cert = PEM_read_bio_X509(mem, NULL, 0, NULL);
+ X509* cert = PEM_read_bio_X509(mem, nullptr, 0, nullptr);
BIO_free(mem);
if (SSL_CTX_use_certificate(ctx_->get(), cert) == 0) {
@@ -982,7 +982,7 @@
void TSSLSocketFactory::loadPrivateKey(const char* path, const char* format) {
if (path == nullptr || format == nullptr) {
throw TTransportException(TTransportException::BAD_ARGS,
- "loadPrivateKey: either <path> or <format> is NULL");
+ "loadPrivateKey: either <path> or <format> is nullptr");
}
if (strcmp(format, "PEM") == 0) {
if (SSL_CTX_use_PrivateKey_file(ctx_->get(), path, SSL_FILETYPE_PEM) == 0) {
@@ -997,7 +997,7 @@
void TSSLSocketFactory::loadPrivateKeyFromBuffer(const char* aPrivateKey, const char* format) {
if (aPrivateKey == nullptr || format == nullptr) {
throw TTransportException(TTransportException::BAD_ARGS,
- "loadPrivateKey: either <path> or <format> is NULL");
+ "loadPrivateKey: either <path> or <format> is nullptr");
}
if (strcmp(format, "PEM") == 0) {
BIO* mem = BIO_new(BIO_s_mem());
@@ -1019,7 +1019,7 @@
void TSSLSocketFactory::loadTrustedCertificates(const char* path, const char* capath) {
if (path == nullptr) {
throw TTransportException(TTransportException::BAD_ARGS,
- "loadTrustedCertificates: <path> is NULL");
+ "loadTrustedCertificates: <path> is nullptr");
}
if (SSL_CTX_load_verify_locations(ctx_->get(), path, capath) == 0) {
int errno_copy = THRIFT_GET_SOCKET_ERROR;
@@ -1037,7 +1037,7 @@
X509_STORE* vX509Store = SSL_CTX_get_cert_store(ctx_->get());
BIO* mem = BIO_new(BIO_s_mem());
BIO_puts(mem, aCertificate);
- X509* cert = PEM_read_bio_X509(mem, NULL, 0, NULL);
+ X509* cert = PEM_read_bio_X509(mem, nullptr, 0, nullptr);
BIO_free(mem);
if (X509_STORE_add_cert(vX509Store, cert) == 0) {
@@ -1050,7 +1050,7 @@
if (aChain) {
mem = BIO_new(BIO_s_mem());
BIO_puts(mem, aChain);
- cert = PEM_read_bio_X509(mem, NULL, 0, NULL);
+ cert = PEM_read_bio_X509(mem, nullptr, 0, nullptr);
BIO_free(mem);
if (SSL_CTX_add_extra_chain_cert(ctx_->get(), cert) == 0) {
diff --git a/lib/cpp/src/thrift/transport/TServerTransport.h b/lib/cpp/src/thrift/transport/TServerTransport.h
index 9e84850..0c56609 100644
--- a/lib/cpp/src/thrift/transport/TServerTransport.h
+++ b/lib/cpp/src/thrift/transport/TServerTransport.h
@@ -54,7 +54,7 @@
* Gets a new dynamically allocated transport object and passes it to the
* caller. Note that it is the explicit duty of the caller to free the
* allocated object. The returned TTransport object must always be in the
- * opened state. NULL should never be returned, instead an Exception should
+ * opened state. nullptr should never be returned, instead an Exception should
* always be thrown.
*
* @return A new TTransport object
@@ -63,7 +63,7 @@
std::shared_ptr<TTransport> accept() {
std::shared_ptr<TTransport> result = acceptImpl();
if (!result) {
- throw TTransportException("accept() may not return NULL");
+ throw TTransportException("accept() may not return nullptr");
}
return result;
}
diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp
index 3811279..a1a6dfb 100644
--- a/lib/cpp/src/thrift/transport/TSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSocket.cpp
@@ -432,7 +432,7 @@
void TSocket::unix_open() {
if (!path_.empty()) {
- // Unix Domain SOcket does not need addrinfo struct, so we pass NULL
+ // Unix Domain SOcket does not need addrinfo struct, so we pass nullptr
openConnection(nullptr);
}
}
diff --git a/lib/cpp/src/thrift/transport/TTransport.h b/lib/cpp/src/thrift/transport/TTransport.h
index 891bfe1..6397882 100644
--- a/lib/cpp/src/thrift/transport/TTransport.h
+++ b/lib/cpp/src/thrift/transport/TTransport.h
@@ -191,7 +191,7 @@
* @oaram buf A buffer where the data can be stored if needed.
* If borrow doesn't return buf, then the contents of
* buf after the call are undefined. This parameter may be
- * NULL to indicate that the caller is not supplying storage,
+ * nullptr to indicate that the caller is not supplying storage,
* but would like a pointer into an internal buffer, if
* available.
* @param len *len should initially contain the number of bytes to borrow.
diff --git a/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp b/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp
index 0a0292c..ac24124 100644
--- a/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp
+++ b/lib/cpp/src/thrift/windows/GetTimeOfDay.cpp
@@ -51,7 +51,7 @@
int thrift_gettimeofday(struct timeval * tp, struct timezone * tzp)
{
// We don't fill it in so prove nobody is looking for the data
- assert(tzp == NULL);
+ assert(tzp == nullptr);
// Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
// This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC)
diff --git a/lib/cpp/src/thrift/windows/SocketPair.cpp b/lib/cpp/src/thrift/windows/SocketPair.cpp
index 7228832..2650b37 100644
--- a/lib/cpp/src/thrift/windows/SocketPair.cpp
+++ b/lib/cpp/src/thrift/windows/SocketPair.cpp
@@ -77,12 +77,12 @@
break;
if (listen(listener, 1) == SOCKET_ERROR)
break;
- sv[0] = WSASocket(AF_INET, SOCK_STREAM, 0, NULL, 0, flags);
+ sv[0] = WSASocket(AF_INET, SOCK_STREAM, 0, nullptr, 0, flags);
if (sv[0] == INVALID_SOCKET)
break;
if (connect(sv[0], &a.addr, sizeof(a.inaddr)) == SOCKET_ERROR)
break;
- sv[1] = accept(listener, NULL, NULL);
+ sv[1] = accept(listener, nullptr, nullptr);
if (sv[1] == INVALID_SOCKET)
break;
diff --git a/lib/cpp/src/thrift/windows/Sync.h b/lib/cpp/src/thrift/windows/Sync.h
index 5d32199..a296d7e 100644
--- a/lib/cpp/src/thrift/windows/Sync.h
+++ b/lib/cpp/src/thrift/windows/Sync.h
@@ -55,8 +55,8 @@
HANDLE h;
TAutoResetEvent() {
- h = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (h == NULL) {
+ h = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (h == nullptr) {
GlobalOutput.perror("TAutoResetEvent unable to create event, GLE=", GetLastError());
throw apache::thrift::concurrency::SystemResourceException("CreateEvent failed");
}
@@ -68,8 +68,8 @@
HANDLE h;
TManualResetEvent() {
- h = CreateEvent(NULL, TRUE, FALSE, NULL);
- if (h == NULL) {
+ h = CreateEvent(nullptr, TRUE, FALSE, nullptr);
+ if (h == nullptr) {
GlobalOutput.perror("TManualResetEvent unable to create event, GLE=", GetLastError());
throw apache::thrift::concurrency::SystemResourceException("CreateEvent failed");
}
diff --git a/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp b/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp
index a502cbd..c3339f3 100644
--- a/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp
+++ b/lib/cpp/src/thrift/windows/TWinsockSingleton.cpp
@@ -26,7 +26,7 @@
namespace thrift {
namespace transport {
-TWinsockSingleton::instance_ptr TWinsockSingleton::instance_ptr_(NULL);
+TWinsockSingleton::instance_ptr TWinsockSingleton::instance_ptr_(nullptr);
std::once_flag TWinsockSingleton::flags_;
//------------------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/windows/WinFcntl.cpp b/lib/cpp/src/thrift/windows/WinFcntl.cpp
index c907e92..292ddfc 100644
--- a/lib/cpp/src/thrift/windows/WinFcntl.cpp
+++ b/lib/cpp/src/thrift/windows/WinFcntl.cpp
@@ -45,8 +45,8 @@
#if WINVER <= 0x0502 // XP, Server2003
int thrift_poll(THRIFT_POLLFD* fdArray, ULONG nfds, INT timeout) {
fd_set read_fds, write_fds;
- fd_set* read_fds_ptr = NULL;
- fd_set* write_fds_ptr = NULL;
+ fd_set* read_fds_ptr = nullptr;
+ fd_set* write_fds_ptr = nullptr;
FD_ZERO(&read_fds);
FD_ZERO(&write_fds);
@@ -65,7 +65,7 @@
}
timeval time_out;
- timeval* time_out_ptr = NULL;
+ timeval* time_out_ptr = nullptr;
if (timeout >= 0) {
time_out.tv_sec = timeout / 1000;
time_out.tv_usec = (timeout % 1000) * 1000;
@@ -75,7 +75,7 @@
(void)timeout;
}
- int sktready = select(1, read_fds_ptr, write_fds_ptr, NULL, time_out_ptr);
+ int sktready = select(1, read_fds_ptr, write_fds_ptr, nullptr, time_out_ptr);
if (sktready > 0) {
for (ULONG i = 0; i < nfds; i++) {
fdArray[i].revents = 0;
diff --git a/lib/cpp/test/OpenSSLManualInitTest.cpp b/lib/cpp/test/OpenSSLManualInitTest.cpp
index a751806..935a205 100644
--- a/lib/cpp/test/OpenSSLManualInitTest.cpp
+++ b/lib/cpp/test/OpenSSLManualInitTest.cpp
@@ -88,6 +88,6 @@
suite->add(BOOST_TEST_CASE(test_openssl_availability));
- return NULL;
+ return nullptr;
}
#endif
\ No newline at end of file
diff --git a/lib/cpp/test/TFileTransportTest.cpp b/lib/cpp/test/TFileTransportTest.cpp
index 21c1f3b..c116fdc 100644
--- a/lib/cpp/test/TFileTransportTest.cpp
+++ b/lib/cpp/test/TFileTransportTest.cpp
@@ -399,6 +399,6 @@
// Parse arguments
parse_args(argc, argv);
- return NULL;
+ return nullptr;
}
#endif
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
index a890aa8..085197a 100644
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -230,7 +230,7 @@
HANDLE hWrite;
CoupledPipeTransports() {
- BOOST_REQUIRE(CreatePipe(&hRead, &hWrite, NULL, 1048576 * 2));
+ BOOST_REQUIRE(CreatePipe(&hRead, &hWrite, nullptr, 1048576 * 2));
in.reset(new TPipe(hRead, hWrite));
in->open();
out = in;
@@ -707,7 +707,7 @@
uint8_t read_buf[16];
memset(write_buf, 'a', sizeof(write_buf));
- // Attemping to borrow 10 bytes when only 9 are available should return NULL
+ // Attemping to borrow 10 bytes when only 9 are available should return nullptr
// immediately.
transports.out->write(write_buf, 9);
transports.out->flush();
@@ -1075,7 +1075,7 @@
THRIFT_UNUSED_VARIABLE(argc);
THRIFT_UNUSED_VARIABLE(argv);
struct timeval tv;
- THRIFT_GETTIMEOFDAY(&tv, NULL);
+ THRIFT_GETTIMEOFDAY(&tv, nullptr);
int seed = tv.tv_sec ^ tv.tv_usec;
initrand(seed);
@@ -1084,6 +1084,6 @@
suite->p_name.value = "TransportTest";
TransportTestGen transport_test_generator(suite, 1);
transport_test_generator.generate();
- return NULL;
+ return nullptr;
}
#endif
diff --git a/lib/cpp/test/ZlibTest.cpp b/lib/cpp/test/ZlibTest.cpp
index 3e2eb81..274a243 100644
--- a/lib/cpp/test/ZlibTest.cpp
+++ b/lib/cpp/test/ZlibTest.cpp
@@ -454,7 +454,7 @@
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
THRIFT_UNUSED_VARIABLE(argc);
THRIFT_UNUSED_VARIABLE(argv);
- uint32_t seed = static_cast<uint32_t>(time(NULL));
+ uint32_t seed = static_cast<uint32_t>(time(nullptr));
#ifdef HAVE_INTTYPES_H
printf("seed: %" PRIu32 "\n", seed);
#endif
@@ -470,6 +470,6 @@
suite->add(BOOST_TEST_CASE(test_no_write));
- return NULL;
+ return nullptr;
}
#endif
diff --git a/lib/cpp/test/processor/ProcessorTest.cpp b/lib/cpp/test/processor/ProcessorTest.cpp
index a36ef3e..017fa89 100644
--- a/lib/cpp/test/processor/ProcessorTest.cpp
+++ b/lib/cpp/test/processor/ProcessorTest.cpp
@@ -924,6 +924,6 @@
THRIFT_UNUSED_VARIABLE(argc);
THRIFT_UNUSED_VARIABLE(argv);
::boost::unit_test::framework::master_test_suite().p_name.value = "ProcessorTest";
- return NULL;
+ return nullptr;
}
#endif