Commit 079c01be authored by kylechar's avatar kylechar Committed by Commit Bot

Fix scoped_refptr construction from NULL

This is a precursor to adding a new scoped_refptr(std::nullptr_t)
constructor. The implicit conversion from NULL to scoped_refptr<T>
causes a compilation error with the new constructor. Replace NULL with
nullptr in any files where this is a problem.

This CL was uploaded by git cl split.

R=garykac@chromium.org

Bug: 1018887
Change-Id: I4b920ec60b5a24237396d7cf14a47c8fcac7d786
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1884954
Auto-Submit: kylechar <kylechar@chromium.org>
Reviewed-by: default avatarGary Kacmarcik <garykac@chromium.org>
Commit-Queue: Gary Kacmarcik <garykac@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710054}
parent cafe822d
......@@ -101,7 +101,7 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithLoopAndComInitTypes(
#endif
AutoThread::AutoThread(const char* name)
: startup_data_(NULL),
: startup_data_(nullptr),
#if defined(OS_WIN)
com_init_type_(COM_INIT_NONE),
#endif
......@@ -112,7 +112,7 @@ AutoThread::AutoThread(const char* name)
}
AutoThread::AutoThread(const char* name, AutoThreadTaskRunner* joiner)
: startup_data_(NULL),
: startup_data_(nullptr),
#if defined(OS_WIN)
com_init_type_(COM_INIT_NONE),
#endif
......@@ -146,8 +146,8 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::StartWithType(
if (!base::PlatformThread::Create(0, this, &thread_)) {
DLOG(ERROR) << "failed to create thread";
startup_data_ = NULL;
return NULL;
startup_data_ = nullptr;
return nullptr;
}
// Wait for the thread to start and initialize single_thread_task_executor
......@@ -159,8 +159,8 @@ scoped_refptr<AutoThreadTaskRunner> AutoThread::StartWithType(
base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope allow_wait;
startup_data.event.Wait();
// set it to NULL so we don't keep a pointer to some object on the stack.
startup_data_ = NULL;
// set it to null so we don't keep a pointer to some object on the stack.
startup_data_ = nullptr;
DCHECK(startup_data.task_runner.get());
return startup_data.task_runner;
......
......@@ -34,7 +34,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::Generate() {
crypto::RSAPrivateKey::Create(2048));
if (!key) {
LOG(ERROR) << "Cannot generate private key.";
return NULL;
return nullptr;
}
return new RsaKeyPair(std::move(key));
}
......@@ -45,7 +45,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString(
std::string key_str;
if (!base::Base64Decode(key_base64, &key_str)) {
LOG(ERROR) << "Failed to decode private key.";
return NULL;
return nullptr;
}
std::vector<uint8_t> key_buf(key_str.begin(), key_str.end());
......@@ -53,7 +53,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString(
crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_buf));
if (!key) {
LOG(ERROR) << "Invalid private key.";
return NULL;
return nullptr;
}
return new RsaKeyPair(std::move(key));
......@@ -61,7 +61,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString(
std::string RsaKeyPair::ToString() const {
// Check that the key initialized.
DCHECK(key_.get() != NULL);
DCHECK(key_.get() != nullptr);
std::vector<uint8_t> key_buf;
CHECK(key_->ExportPrivateKey(&key_buf));
......
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