Commit 38450201 authored by viettrungluu's avatar viettrungluu Committed by Commit bot

Mojo: NULL -> nullptr in mojo/public/cpp outside of bindings.

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/612243002

Cr-Commit-Position: refs/heads/master@{#297329}
parent 89949e66
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_ #ifndef MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_
#define MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_ #define MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_
#include <string>
#include "mojo/public/cpp/application/connect.h" #include "mojo/public/cpp/application/connect.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h" #include "mojo/public/interfaces/application/service_provider.mojom.h"
...@@ -15,7 +13,7 @@ namespace mojo { ...@@ -15,7 +13,7 @@ namespace mojo {
template<typename Interface> template<typename Interface>
class LazyInterfacePtr : public InterfacePtr<Interface> { class LazyInterfacePtr : public InterfacePtr<Interface> {
public: public:
LazyInterfacePtr() : service_provider_(NULL) {} LazyInterfacePtr() : service_provider_(nullptr) {}
LazyInterfacePtr(ServiceProvider* service_provider) LazyInterfacePtr(ServiceProvider* service_provider)
: service_provider_(service_provider) { : service_provider_(service_provider) {
......
...@@ -27,13 +27,13 @@ class ApplicationImpl::ShellPtrWatcher : public ErrorHandler { ...@@ -27,13 +27,13 @@ class ApplicationImpl::ShellPtrWatcher : public ErrorHandler {
ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
ScopedMessagePipeHandle shell_handle) ScopedMessagePipeHandle shell_handle)
: initialized_(false), delegate_(delegate), shell_watch_(NULL) { : initialized_(false), delegate_(delegate), shell_watch_(nullptr) {
BindShell(shell_handle.Pass()); BindShell(shell_handle.Pass());
} }
ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate, ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
MojoHandle shell_handle) MojoHandle shell_handle)
: initialized_(false), delegate_(delegate), shell_watch_(NULL) { : initialized_(false), delegate_(delegate), shell_watch_(nullptr) {
BindShell(MakeScopedHandle(MessagePipeHandle(shell_handle))); BindShell(MakeScopedHandle(MessagePipeHandle(shell_handle)));
} }
...@@ -71,7 +71,7 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication( ...@@ -71,7 +71,7 @@ ApplicationConnection* ApplicationImpl::ConnectToApplication(
out_service_provider.Pass()); out_service_provider.Pass());
if (!delegate_->ConfigureOutgoingConnection(registry)) { if (!delegate_->ConfigureOutgoingConnection(registry)) {
delete registry; delete registry;
return NULL; return nullptr;
} }
outgoing_service_registries_.push_back(registry); outgoing_service_registries_.push_back(registry);
return registry; return registry;
......
...@@ -30,7 +30,7 @@ MojoResult ApplicationRunner::Run(MojoHandle shell_handle) { ...@@ -30,7 +30,7 @@ MojoResult ApplicationRunner::Run(MojoHandle shell_handle) {
} }
delete delegate_; delete delegate_;
delegate_ = NULL; delegate_ = nullptr;
return MOJO_RESULT_OK; return MOJO_RESULT_OK;
} }
......
...@@ -9,7 +9,7 @@ namespace internal { ...@@ -9,7 +9,7 @@ namespace internal {
ServiceConnectorBase::ServiceConnectorBase(const std::string& name) ServiceConnectorBase::ServiceConnectorBase(const std::string& name)
: name_(name), : name_(name),
application_connection_(NULL) { application_connection_(nullptr) {
} }
ServiceConnectorBase::~ServiceConnectorBase() {} ServiceConnectorBase::~ServiceConnectorBase() {}
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
namespace mojo { namespace mojo {
ServiceProviderImpl::ServiceProviderImpl() : remote_(NULL) { ServiceProviderImpl::ServiceProviderImpl() : remote_(nullptr) {
} }
ServiceProviderImpl::~ServiceProviderImpl() { ServiceProviderImpl::~ServiceProviderImpl() {
...@@ -46,7 +46,7 @@ void ServiceProviderImpl::AddServiceConnector( ...@@ -46,7 +46,7 @@ void ServiceProviderImpl::AddServiceConnector(
RemoveServiceConnector(service_connector); RemoveServiceConnector(service_connector);
service_connectors_[service_connector->name()] = service_connector; service_connectors_[service_connector->name()] = service_connector;
// TODO(beng): perhaps take app connection thru ctor?? // TODO(beng): perhaps take app connection thru ctor??
service_connector->set_application_connection(NULL); service_connector->set_application_connection(nullptr);
} }
void ServiceProviderImpl::RemoveServiceConnector( void ServiceProviderImpl::RemoveServiceConnector(
...@@ -62,7 +62,7 @@ void ServiceProviderImpl::RemoveServiceConnector( ...@@ -62,7 +62,7 @@ void ServiceProviderImpl::RemoveServiceConnector(
void ServiceProviderImpl::ClearRemote() { void ServiceProviderImpl::ClearRemote() {
if (remote_) { if (remote_) {
remote_->Clear(); remote_->Clear();
remote_ = NULL; remote_ = nullptr;
} }
} }
......
...@@ -20,7 +20,7 @@ ServiceRegistry::ServiceRegistry(ApplicationImpl* application_impl, ...@@ -20,7 +20,7 @@ ServiceRegistry::ServiceRegistry(ApplicationImpl* application_impl,
remote_service_provider_.set_client(this); remote_service_provider_.set_client(this);
} }
ServiceRegistry::ServiceRegistry() : application_impl_(NULL) {} ServiceRegistry::ServiceRegistry() : application_impl_(nullptr) {}
ServiceRegistry::~ServiceRegistry() { ServiceRegistry::~ServiceRegistry() {
for (NameToServiceConnectorMap::iterator i = for (NameToServiceConnectorMap::iterator i =
......
...@@ -21,8 +21,8 @@ WeakServiceProvider::~WeakServiceProvider() { ...@@ -21,8 +21,8 @@ WeakServiceProvider::~WeakServiceProvider() {
} }
void WeakServiceProvider::Clear() { void WeakServiceProvider::Clear() {
creator_ = NULL; creator_ = nullptr;
service_provider_ = NULL; service_provider_ = nullptr;
} }
void WeakServiceProvider::ConnectToService( void WeakServiceProvider::ConnectToService(
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "mojo/public/cpp/environment/environment.h" #include "mojo/public/cpp/environment/environment.h"
#include <assert.h> #include <assert.h>
#include <stddef.h>
#include "mojo/public/c/environment/logger.h" #include "mojo/public/c/environment/logger.h"
#include "mojo/public/cpp/environment/lib/default_async_waiter.h" #include "mojo/public/cpp/environment/lib/default_async_waiter.h"
...@@ -16,8 +15,8 @@ namespace mojo { ...@@ -16,8 +15,8 @@ namespace mojo {
namespace { namespace {
const MojoAsyncWaiter* g_default_async_waiter = NULL; const MojoAsyncWaiter* g_default_async_waiter = nullptr;
const MojoLogger* g_default_logger = NULL; const MojoLogger* g_default_logger = nullptr;
void Init(const MojoAsyncWaiter* default_async_waiter, void Init(const MojoAsyncWaiter* default_async_waiter,
const MojoLogger* default_logger) { const MojoLogger* default_logger) {
...@@ -33,7 +32,7 @@ void Init(const MojoAsyncWaiter* default_async_waiter, ...@@ -33,7 +32,7 @@ void Init(const MojoAsyncWaiter* default_async_waiter,
} // namespace } // namespace
Environment::Environment() { Environment::Environment() {
Init(NULL, NULL); Init(nullptr, nullptr);
} }
Environment::Environment(const MojoAsyncWaiter* default_async_waiter, Environment::Environment(const MojoAsyncWaiter* default_async_waiter,
...@@ -46,8 +45,8 @@ Environment::~Environment() { ...@@ -46,8 +45,8 @@ Environment::~Environment() {
// TODO(vtl): Maybe we should allow nesting, and restore previous default // TODO(vtl): Maybe we should allow nesting, and restore previous default
// async waiters and loggers? // async waiters and loggers?
g_default_async_waiter = NULL; g_default_async_waiter = nullptr;
g_default_logger = NULL; g_default_logger = nullptr;
} }
// static // static
......
...@@ -31,7 +31,7 @@ bool DcheckTestHelper(bool* was_called) { ...@@ -31,7 +31,7 @@ bool DcheckTestHelper(bool* was_called) {
class LoggingTest : public testing::Test { class LoggingTest : public testing::Test {
public: public:
LoggingTest() : environment_(NULL, &kMockLogger) { LoggingTest() : environment_(nullptr, &kMockLogger) {
minimum_log_level_ = MOJO_LOG_LEVEL_INFO; minimum_log_level_ = MOJO_LOG_LEVEL_INFO;
ResetMockLogger(); ResetMockLogger();
} }
......
...@@ -93,7 +93,7 @@ class SharedBuffer { ...@@ -93,7 +93,7 @@ class SharedBuffer {
inline SharedBuffer::SharedBuffer(uint64_t num_bytes) { inline SharedBuffer::SharedBuffer(uint64_t num_bytes) {
MojoResult result MOJO_ALLOW_UNUSED = MojoResult result MOJO_ALLOW_UNUSED =
CreateSharedBuffer(NULL, num_bytes, &handle); CreateSharedBuffer(nullptr, num_bytes, &handle);
assert(result == MOJO_RESULT_OK); assert(result == MOJO_RESULT_OK);
} }
......
...@@ -120,7 +120,7 @@ class DataPipe { ...@@ -120,7 +120,7 @@ class DataPipe {
inline DataPipe::DataPipe() { inline DataPipe::DataPipe() {
MojoResult result MOJO_ALLOW_UNUSED = MojoResult result MOJO_ALLOW_UNUSED =
CreateDataPipe(NULL, &producer_handle, &consumer_handle); CreateDataPipe(nullptr, &producer_handle, &consumer_handle);
assert(result == MOJO_RESULT_OK); assert(result == MOJO_RESULT_OK);
} }
......
...@@ -214,7 +214,7 @@ inline MojoResult WaitMany(const HandleVectorType& handles, ...@@ -214,7 +214,7 @@ inline MojoResult WaitMany(const HandleVectorType& handles,
return MOJO_RESULT_OUT_OF_RANGE; return MOJO_RESULT_OUT_OF_RANGE;
if (handles.size() == 0) if (handles.size() == 0)
return MojoWaitMany(NULL, NULL, 0, deadline); return MojoWaitMany(nullptr, nullptr, 0, deadline);
const Handle& first_handle = handles[0]; const Handle& first_handle = handles[0];
const MojoHandleSignals& first_signals = signals[0]; const MojoHandleSignals& first_signals = signals[0];
......
...@@ -85,7 +85,7 @@ class MessagePipe { ...@@ -85,7 +85,7 @@ class MessagePipe {
inline MessagePipe::MessagePipe() { inline MessagePipe::MessagePipe() {
MojoResult result MOJO_ALLOW_UNUSED = MojoResult result MOJO_ALLOW_UNUSED =
CreateMessagePipe(NULL, &handle0, &handle1); CreateMessagePipe(nullptr, &handle0, &handle1);
assert(result == MOJO_RESULT_OK); assert(result == MOJO_RESULT_OK);
} }
......
...@@ -124,25 +124,25 @@ TEST(CoreCppTest, Basic) { ...@@ -124,25 +124,25 @@ TEST(CoreCppTest, Basic) {
EXPECT_FALSE(h_invalid.is_valid()); EXPECT_FALSE(h_invalid.is_valid());
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
WriteMessageRaw(h_invalid, WriteMessageRaw(h_invalid,
NULL, 0, nullptr, 0,
NULL, 0, nullptr, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE)); MOJO_WRITE_MESSAGE_FLAG_NONE));
char buffer[10] = { 0 }; char buffer[10] = { 0 };
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
WriteMessageRaw(h_invalid, WriteMessageRaw(h_invalid,
buffer, sizeof(buffer), buffer, sizeof(buffer),
NULL, 0, nullptr, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE)); MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
ReadMessageRaw(h_invalid, ReadMessageRaw(h_invalid,
NULL, NULL, nullptr, nullptr,
NULL, NULL, nullptr, nullptr,
MOJO_READ_MESSAGE_FLAG_NONE)); MOJO_READ_MESSAGE_FLAG_NONE));
uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
ReadMessageRaw(h_invalid, ReadMessageRaw(h_invalid,
buffer, &buffer_size, buffer, &buffer_size,
NULL, NULL, nullptr, nullptr,
MOJO_READ_MESSAGE_FLAG_NONE)); MOJO_READ_MESSAGE_FLAG_NONE));
// Basic tests of waiting and closing. // Basic tests of waiting and closing.
...@@ -153,7 +153,7 @@ TEST(CoreCppTest, Basic) { ...@@ -153,7 +153,7 @@ TEST(CoreCppTest, Basic) {
EXPECT_FALSE(h0.get().is_valid()); EXPECT_FALSE(h0.get().is_valid());
EXPECT_FALSE(h1.get().is_valid()); EXPECT_FALSE(h1.get().is_valid());
CreateMessagePipe(NULL, &h0, &h1); CreateMessagePipe(nullptr, &h0, &h1);
EXPECT_TRUE(h0.get().is_valid()); EXPECT_TRUE(h0.get().is_valid());
EXPECT_TRUE(h1.get().is_valid()); EXPECT_TRUE(h1.get().is_valid());
EXPECT_NE(h0.get().value(), h1.get().value()); EXPECT_NE(h0.get().value(), h1.get().value());
...@@ -193,14 +193,14 @@ TEST(CoreCppTest, Basic) { ...@@ -193,14 +193,14 @@ TEST(CoreCppTest, Basic) {
{ {
ScopedMessagePipeHandle h0; ScopedMessagePipeHandle h0;
ScopedMessagePipeHandle h1; ScopedMessagePipeHandle h1;
CreateMessagePipe(NULL, &h0, &h1); CreateMessagePipe(nullptr, &h0, &h1);
const char kHello[] = "hello"; const char kHello[] = "hello";
const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello)); const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello));
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
WriteMessageRaw(h0.get(), WriteMessageRaw(h0.get(),
kHello, kHelloSize, kHello, kHelloSize,
NULL, 0, nullptr, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE)); MOJO_WRITE_MESSAGE_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
Wait(h1.get(), MOJO_HANDLE_SIGNAL_READABLE, Wait(h1.get(), MOJO_HANDLE_SIGNAL_READABLE,
...@@ -210,7 +210,7 @@ TEST(CoreCppTest, Basic) { ...@@ -210,7 +210,7 @@ TEST(CoreCppTest, Basic) {
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
ReadMessageRaw(h1.get(), ReadMessageRaw(h1.get(),
buffer, &buffer_size, buffer, &buffer_size,
NULL, NULL, nullptr, nullptr,
MOJO_READ_MESSAGE_FLAG_NONE)); MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(kHelloSize, buffer_size); EXPECT_EQ(kHelloSize, buffer_size);
EXPECT_STREQ(kHello, buffer); EXPECT_STREQ(kHello, buffer);
...@@ -226,7 +226,7 @@ TEST(CoreCppTest, Basic) { ...@@ -226,7 +226,7 @@ TEST(CoreCppTest, Basic) {
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
WriteMessageRaw(mp.handle0.get(), WriteMessageRaw(mp.handle0.get(),
kWorld, kWorldSize, kWorld, kWorldSize,
NULL, 0, nullptr, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE)); MOJO_WRITE_MESSAGE_FLAG_NONE));
// Send |mp.handle1| over |h1| to |h0|. // Send |mp.handle1| over |h1| to |h0|.
...@@ -296,12 +296,12 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) { ...@@ -296,12 +296,12 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) {
{ {
ScopedMessagePipeHandle h0; ScopedMessagePipeHandle h0;
ScopedMessagePipeHandle h1; ScopedMessagePipeHandle h1;
CreateMessagePipe(NULL, &h0, &h1); CreateMessagePipe(nullptr, &h0, &h1);
// Send a handle over the previously-establish message pipe. // Send a handle over the previously-establish message pipe.
ScopedMessagePipeHandle h2; ScopedMessagePipeHandle h2;
ScopedMessagePipeHandle h3; ScopedMessagePipeHandle h3;
CreateMessagePipe(NULL, &h2, &h3); CreateMessagePipe(nullptr, &h2, &h3);
// Write a message to |h2|, before we send |h3|. // Write a message to |h2|, before we send |h3|.
const char kWorld[] = "world!"; const char kWorld[] = "world!";
...@@ -309,13 +309,13 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) { ...@@ -309,13 +309,13 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) {
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
WriteMessageRaw(h2.get(), WriteMessageRaw(h2.get(),
kWorld, kWorldSize, kWorld, kWorldSize,
NULL, 0, nullptr, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE)); MOJO_WRITE_MESSAGE_FLAG_NONE));
// And also a message to |h3|. // And also a message to |h3|.
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
WriteMessageRaw(h3.get(), WriteMessageRaw(h3.get(),
kWorld, kWorldSize, kWorld, kWorldSize,
NULL, 0, nullptr, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE)); MOJO_WRITE_MESSAGE_FLAG_NONE));
// Send |h3| over |h1| to |h0|. // Send |h3| over |h1| to |h0|.
...@@ -343,12 +343,12 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) { ...@@ -343,12 +343,12 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) {
{ {
ScopedMessagePipeHandle h0; ScopedMessagePipeHandle h0;
ScopedMessagePipeHandle h1; ScopedMessagePipeHandle h1;
CreateMessagePipe(NULL, &h0, &h1); CreateMessagePipe(nullptr, &h0, &h1);
// Send a handle over the previously-establish message pipe. // Send a handle over the previously-establish message pipe.
ScopedMessagePipeHandle h2; ScopedMessagePipeHandle h2;
ScopedMessagePipeHandle h3; ScopedMessagePipeHandle h3;
CreateMessagePipe(NULL, &h2, &h3); CreateMessagePipe(nullptr, &h2, &h3);
// Write a message to |h2|, before we send |h3|. // Write a message to |h2|, before we send |h3|.
const char kWorld[] = "world!"; const char kWorld[] = "world!";
...@@ -356,13 +356,13 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) { ...@@ -356,13 +356,13 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) {
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
WriteMessageRaw(h2.get(), WriteMessageRaw(h2.get(),
kWorld, kWorldSize, kWorld, kWorldSize,
NULL, 0, nullptr, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE)); MOJO_WRITE_MESSAGE_FLAG_NONE));
// And also a message to |h3|. // And also a message to |h3|.
EXPECT_EQ(MOJO_RESULT_OK, EXPECT_EQ(MOJO_RESULT_OK,
WriteMessageRaw(h3.get(), WriteMessageRaw(h3.get(),
kWorld, kWorldSize, kWorld, kWorldSize,
NULL, 0, nullptr, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE)); MOJO_WRITE_MESSAGE_FLAG_NONE));
// Send |h3| over |h1| to |h0|. // Send |h3| over |h1| to |h0|.
...@@ -388,11 +388,11 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) { ...@@ -388,11 +388,11 @@ TEST(CoreCppTest, TearDownWithMessagesEnqueued) {
TEST(CoreCppTest, ScopedHandleMoveCtor) { TEST(CoreCppTest, ScopedHandleMoveCtor) {
ScopedSharedBufferHandle buffer1; ScopedSharedBufferHandle buffer1;
EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(NULL, 1024, &buffer1)); EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(nullptr, 1024, &buffer1));
EXPECT_TRUE(buffer1.is_valid()); EXPECT_TRUE(buffer1.is_valid());
ScopedSharedBufferHandle buffer2; ScopedSharedBufferHandle buffer2;
EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(NULL, 1024, &buffer2)); EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(nullptr, 1024, &buffer2));
EXPECT_TRUE(buffer2.is_valid()); EXPECT_TRUE(buffer2.is_valid());
// If this fails to close buffer1, ScopedHandleBase::CloseIfNecessary() will // If this fails to close buffer1, ScopedHandleBase::CloseIfNecessary() will
...@@ -405,7 +405,7 @@ TEST(CoreCppTest, ScopedHandleMoveCtor) { ...@@ -405,7 +405,7 @@ TEST(CoreCppTest, ScopedHandleMoveCtor) {
TEST(CoreCppTest, ScopedHandleMoveCtorSelf) { TEST(CoreCppTest, ScopedHandleMoveCtorSelf) {
ScopedSharedBufferHandle buffer1; ScopedSharedBufferHandle buffer1;
EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(NULL, 1024, &buffer1)); EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(nullptr, 1024, &buffer1));
EXPECT_TRUE(buffer1.is_valid()); EXPECT_TRUE(buffer1.is_valid());
buffer1 = buffer1.Pass(); buffer1 = buffer1.Pass();
......
...@@ -14,7 +14,7 @@ std::vector<std::string> EnumerateSourceRootRelativeDirectory( ...@@ -14,7 +14,7 @@ std::vector<std::string> EnumerateSourceRootRelativeDirectory(
char** names = MojoTestSupportEnumerateSourceRootRelativeDirectory( char** names = MojoTestSupportEnumerateSourceRootRelativeDirectory(
relative_path.c_str()); relative_path.c_str());
std::vector<std::string> results; std::vector<std::string> results;
for (char** ptr = names; *ptr != NULL; ++ptr) { for (char** ptr = names; *ptr != nullptr; ++ptr) {
results.push_back(*ptr); results.push_back(*ptr);
free(*ptr); free(*ptr);
} }
......
...@@ -15,7 +15,7 @@ bool WriteTextMessage(const MessagePipeHandle& handle, ...@@ -15,7 +15,7 @@ bool WriteTextMessage(const MessagePipeHandle& handle,
MojoResult rv = WriteMessageRaw(handle, MojoResult rv = WriteMessageRaw(handle,
text.data(), text.data(),
static_cast<uint32_t>(text.size()), static_cast<uint32_t>(text.size()),
NULL, nullptr,
0, 0,
MOJO_WRITE_MESSAGE_FLAG_NONE); MOJO_WRITE_MESSAGE_FLAG_NONE);
return rv == MOJO_RESULT_OK; return rv == MOJO_RESULT_OK;
...@@ -28,9 +28,9 @@ bool ReadTextMessage(const MessagePipeHandle& handle, std::string* text) { ...@@ -28,9 +28,9 @@ bool ReadTextMessage(const MessagePipeHandle& handle, std::string* text) {
uint32_t num_bytes = 0, num_handles = 0; uint32_t num_bytes = 0, num_handles = 0;
for (;;) { for (;;) {
rv = ReadMessageRaw(handle, rv = ReadMessageRaw(handle,
NULL, nullptr,
&num_bytes, &num_bytes,
NULL, nullptr,
&num_handles, &num_handles,
MOJO_READ_MESSAGE_FLAG_NONE); MOJO_READ_MESSAGE_FLAG_NONE);
if (rv == MOJO_RESULT_SHOULD_WAIT) { if (rv == MOJO_RESULT_SHOULD_WAIT) {
...@@ -52,14 +52,14 @@ bool ReadTextMessage(const MessagePipeHandle& handle, std::string* text) { ...@@ -52,14 +52,14 @@ bool ReadTextMessage(const MessagePipeHandle& handle, std::string* text) {
rv = ReadMessageRaw(handle, rv = ReadMessageRaw(handle,
&text->at(0), &text->at(0),
&num_bytes, &num_bytes,
NULL, nullptr,
&num_handles, &num_handles,
MOJO_READ_MESSAGE_FLAG_NONE); MOJO_READ_MESSAGE_FLAG_NONE);
return rv == MOJO_RESULT_OK; return rv == MOJO_RESULT_OK;
} }
bool DiscardMessage(const MessagePipeHandle& handle) { bool DiscardMessage(const MessagePipeHandle& handle) {
MojoResult rv = ReadMessageRaw(handle, NULL, NULL, NULL, NULL, MojoResult rv = ReadMessageRaw(handle, nullptr, nullptr, nullptr, nullptr,
MOJO_READ_MESSAGE_FLAG_MAY_DISCARD); MOJO_READ_MESSAGE_FLAG_MAY_DISCARD);
return rv == MOJO_RESULT_OK; return rv == MOJO_RESULT_OK;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment