Run clang-tidy modernize-use-nullptr on //net
An instance of GetAddressOf() in url_security_manager_win.cc has also been updated to allow presubmit checks to pass.
This is a mechanical change.
See bugs for justification and details.
Bug: 776257, 778942
Change-Id: Ia8bb79e611be7a884227852224623043af8b850e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1512637
Reviewed-by: Bence Béky <bnc@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
Cr-Commit-Position: refs/heads/master@{#639546}
diff --git a/net/base/chunked_upload_data_stream.cc b/net/base/chunked_upload_data_stream.cc
index 2bae390..f7e2a66 100644
--- a/net/base/chunked_upload_data_stream.cc
+++ b/net/base/chunked_upload_data_stream.cc
@@ -58,7 +58,7 @@
int result = ReadChunk(read_buffer_.get(), read_buffer_len_);
// Shouldn't get an error or ERR_IO_PENDING.
DCHECK_GE(result, 0);
- read_buffer_ = NULL;
+ read_buffer_ = nullptr;
read_buffer_len_ = 0;
OnReadCompleted(result);
}
@@ -84,7 +84,7 @@
}
void ChunkedUploadDataStream::ResetInternal() {
- read_buffer_ = NULL;
+ read_buffer_ = nullptr;
read_buffer_len_ = 0;
read_index_ = 0;
read_offset_ = 0;
diff --git a/net/base/chunked_upload_data_stream_unittest.cc b/net/base/chunked_upload_data_stream_unittest.cc
index 8074e3cc..6f6a6dbeb 100644
--- a/net/base/chunked_upload_data_stream_unittest.cc
+++ b/net/base/chunked_upload_data_stream_unittest.cc
@@ -243,7 +243,7 @@
int result = stream.Read(buf.get(), kTestBufferSize, callback.callback());
ASSERT_THAT(result, IsError(ERR_IO_PENDING));
- stream.AppendData(NULL, 0, true);
+ stream.AppendData(nullptr, 0, true);
int read = callback.WaitForResult();
EXPECT_EQ(0, read);
EXPECT_EQ(0u, stream.position());
@@ -252,7 +252,7 @@
TEST(ChunkedUploadDataStreamTest, EmptyUploadEndedBeforeInit) {
ChunkedUploadDataStream stream(0);
- stream.AppendData(NULL, 0, true);
+ stream.AppendData(nullptr, 0, true);
ASSERT_THAT(
stream.Init(TestCompletionCallback().callback(), NetLogWithSource()),
diff --git a/net/base/data_url.cc b/net/base/data_url.cc
index c19e47f..e3c0e36 100644
--- a/net/base/data_url.cc
+++ b/net/base/data_url.cc
@@ -77,7 +77,7 @@
mime_type->assign("text/plain");
if (charset->empty())
charset->assign("US-ASCII");
- } else if (!ParseMimeTypeWithoutParameter(*mime_type, NULL, NULL)) {
+ } else if (!ParseMimeTypeWithoutParameter(*mime_type, nullptr, nullptr)) {
// Fallback to the default as recommended in RFC2045 when the mediatype
// value is invalid. For this case, we don't respect |charset| but force it
// set to "US-ASCII".
diff --git a/net/base/expiring_cache.h b/net/base/expiring_cache.h
index a22497b..8f79800 100644
--- a/net/base/expiring_cache.h
+++ b/net/base/expiring_cache.h
@@ -127,12 +127,12 @@
const ValueType* Get(const KeyType& key, const ExpirationType& now) {
typename EntryMap::iterator it = entries_.find(key);
if (it == entries_.end())
- return NULL;
+ return nullptr;
// Immediately remove expired entries.
if (!expiration_comp_(now, it->second.second)) {
Evict(it, now, true);
- return NULL;
+ return nullptr;
}
return &it->second.first;
diff --git a/net/base/file_stream_context_win.cc b/net/base/file_stream_context_win.cc
index 38571a4..7ded4baa 100644
--- a/net/base/file_stream_context_win.cc
+++ b/net/base/file_stream_context_win.cc
@@ -187,14 +187,14 @@
async_in_progress_ = false;
}
scoped_refptr<IOBuffer> temp_buf = in_flight_buf_;
- in_flight_buf_ = NULL;
+ in_flight_buf_ = nullptr;
std::move(callback_).Run(result_);
}
void FileStream::Context::DeleteOrphanedContext() {
async_in_progress_ = false;
callback_.Reset();
- in_flight_buf_ = NULL;
+ in_flight_buf_ = nullptr;
CloseAndDelete();
}
diff --git a/net/base/interval_test.cc b/net/base/interval_test.cc
index 5d440c59..2ee6dc1 100644
--- a/net/base/interval_test.cc
+++ b/net/base/interval_test.cc
@@ -157,15 +157,15 @@
Interval<int64_t> i;
EXPECT_TRUE(d.Intersects(d, &i) && d.Equals(i));
- EXPECT_TRUE(!empty.Intersects(d, NULL) && !d.Intersects(empty, NULL));
- EXPECT_TRUE(!d.Intersects(d1, NULL) && !d1.Intersects(d, NULL));
+ EXPECT_TRUE(!empty.Intersects(d, nullptr) && !d.Intersects(empty, nullptr));
+ EXPECT_TRUE(!d.Intersects(d1, nullptr) && !d1.Intersects(d, nullptr));
EXPECT_TRUE(d.Intersects(d2, &i) && i.Equals(Interval<int64_t>(100, 110)));
EXPECT_TRUE(d2.Intersects(d, &i) && i.Equals(Interval<int64_t>(100, 110)));
EXPECT_TRUE(d.Intersects(d3, &i) && i.Equals(d3));
EXPECT_TRUE(d3.Intersects(d, &i) && i.Equals(d3));
EXPECT_TRUE(d.Intersects(d4, &i) && i.Equals(Interval<int64_t>(180, 200)));
EXPECT_TRUE(d4.Intersects(d, &i) && i.Equals(Interval<int64_t>(180, 200)));
- EXPECT_TRUE(!d.Intersects(d5, NULL) && !d5.Intersects(d, NULL));
+ EXPECT_TRUE(!d.Intersects(d5, nullptr) && !d5.Intersects(d, nullptr));
EXPECT_TRUE(d.Intersects(d6, &i) && i.Equals(d6));
EXPECT_TRUE(d6.Intersects(d, &i) && i.Equals(d6));
EXPECT_TRUE(d.Intersects(d7, &i) && i.Equals(d7));
diff --git a/net/base/io_buffer.cc b/net/base/io_buffer.cc
index 7a4ab5b..6e2ea7a7 100644
--- a/net/base/io_buffer.cc
+++ b/net/base/io_buffer.cc
@@ -26,9 +26,7 @@
} // namespace
-IOBuffer::IOBuffer()
- : data_(NULL) {
-}
+IOBuffer::IOBuffer() : data_(nullptr) {}
IOBuffer::IOBuffer(int buffer_size) {
AssertValidBufferSize(buffer_size);
@@ -46,7 +44,7 @@
IOBuffer::~IOBuffer() {
delete[] data_;
- data_ = NULL;
+ data_ = nullptr;
}
IOBufferWithSize::IOBufferWithSize(int size)
@@ -73,14 +71,13 @@
IOBufferWithSize::~IOBufferWithSize() = default;
StringIOBuffer::StringIOBuffer(const std::string& s)
- : IOBuffer(static_cast<char*>(NULL)),
- string_data_(s) {
+ : IOBuffer(static_cast<char*>(nullptr)), string_data_(s) {
AssertValidBufferSize(s.size());
data_ = const_cast<char*>(string_data_.data());
}
StringIOBuffer::StringIOBuffer(std::unique_ptr<std::string> s)
- : IOBuffer(static_cast<char*>(NULL)) {
+ : IOBuffer(static_cast<char*>(nullptr)) {
AssertValidBufferSize(s->size());
string_data_.swap(*s.get());
data_ = const_cast<char*>(string_data_.data());
@@ -89,7 +86,7 @@
StringIOBuffer::~StringIOBuffer() {
// We haven't allocated the buffer, so remove it before the base class
// destructor tries to delete[] it.
- data_ = NULL;
+ data_ = nullptr;
}
DrainableIOBuffer::DrainableIOBuffer(scoped_refptr<IOBuffer> base, int size)
@@ -124,7 +121,7 @@
DrainableIOBuffer::~DrainableIOBuffer() {
// The buffer is owned by the |base_| instance.
- data_ = NULL;
+ data_ = nullptr;
}
GrowableIOBuffer::GrowableIOBuffer()
@@ -160,7 +157,7 @@
}
GrowableIOBuffer::~GrowableIOBuffer() {
- data_ = NULL;
+ data_ = nullptr;
}
PickledIOBuffer::PickledIOBuffer() : IOBuffer() {
@@ -171,7 +168,7 @@
}
PickledIOBuffer::~PickledIOBuffer() {
- data_ = NULL;
+ data_ = nullptr;
}
WrappedIOBuffer::WrappedIOBuffer(const char* data)
@@ -179,7 +176,7 @@
}
WrappedIOBuffer::~WrappedIOBuffer() {
- data_ = NULL;
+ data_ = nullptr;
}
} // namespace net
diff --git a/net/base/ip_endpoint_unittest.cc b/net/base/ip_endpoint_unittest.cc
index fa32dfa..a2220bf 100644
--- a/net/base/ip_endpoint_unittest.cc
+++ b/net/base/ip_endpoint_unittest.cc
@@ -38,7 +38,7 @@
return &sockaddr->sin6_port;
} else {
NOTREACHED();
- return NULL;
+ return nullptr;
}
}
diff --git a/net/base/layered_network_delegate_unittest.cc b/net/base/layered_network_delegate_unittest.cc
index d791f913..9ae629c7 100644
--- a/net/base/layered_network_delegate_unittest.cc
+++ b/net/base/layered_network_delegate_unittest.cc
@@ -189,25 +189,27 @@
ProxyRetryInfoMap proxy_retry_info;
EXPECT_EQ(OK, OnBeforeURLRequest(request.get(),
- completion_callback.callback(), NULL));
- EXPECT_EQ(OK, OnBeforeStartTransaction(NULL, completion_callback.callback(),
- request_headers.get()));
- OnBeforeSendHeaders(NULL, ProxyInfo(), proxy_retry_info,
+ completion_callback.callback(), nullptr));
+ EXPECT_EQ(OK,
+ OnBeforeStartTransaction(nullptr, completion_callback.callback(),
+ request_headers.get()));
+ OnBeforeSendHeaders(nullptr, ProxyInfo(), proxy_retry_info,
request_headers.get());
- OnStartTransaction(NULL, *request_headers);
+ OnStartTransaction(nullptr, *request_headers);
OnNetworkBytesSent(request.get(), 42);
- EXPECT_EQ(OK, OnHeadersReceived(NULL, completion_callback.callback(),
- response_headers.get(), NULL, NULL));
+ EXPECT_EQ(OK, OnHeadersReceived(nullptr, completion_callback.callback(),
+ response_headers.get(), nullptr, nullptr));
OnResponseStarted(request.get(), net::OK);
OnNetworkBytesReceived(request.get(), 42);
OnCompleted(request.get(), false, net::OK);
OnURLRequestDestroyed(request.get());
OnPACScriptError(0, base::string16());
- EXPECT_EQ(
- NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION,
- OnAuthRequired(request.get(), *auth_challenge, AuthCallback(), NULL));
+ EXPECT_EQ(NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION,
+ OnAuthRequired(request.get(), *auth_challenge, AuthCallback(),
+ nullptr));
EXPECT_FALSE(OnCanGetCookies(*request, CookieList(), true));
- EXPECT_FALSE(OnCanSetCookie(*request, net::CanonicalCookie(), NULL, true));
+ EXPECT_FALSE(
+ OnCanSetCookie(*request, net::CanonicalCookie(), nullptr, true));
EXPECT_FALSE(OnCanAccessFile(*request, base::FilePath(), base::FilePath()));
EXPECT_FALSE(OnForcePrivacyMode(GURL(), GURL()));
EXPECT_FALSE(OnCancelURLRequestWithPolicyViolatingReferrerHeader(
diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc
index 408cacc..6741cc8 100644
--- a/net/base/mime_sniffer.cc
+++ b/net/base/mime_sniffer.cc
@@ -325,7 +325,7 @@
// pretend the length is content_size.
const char* end = static_cast<const char*>(memchr(content, '\0', size));
const size_t content_strlen =
- (end != NULL) ? static_cast<size_t>(end - content) : size;
+ (end != nullptr) ? static_cast<size_t>(end - content) : size;
bool match = false;
if (magic_entry.is_string) {
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 112488e..a2ff77a 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -235,7 +235,7 @@
extensions += 1; // skip over comma
}
}
- return NULL;
+ return nullptr;
}
static base::FilePath::StringType StringToFilePathStringType(
diff --git a/net/base/mime_util_unittest.cc b/net/base/mime_util_unittest.cc
index 7474ce2e..49ce634 100644
--- a/net/base/mime_util_unittest.cc
+++ b/net/base/mime_util_unittest.cc
@@ -189,13 +189,13 @@
TEST(MimeUtilTest, TestParseMimeTypeWithoutParameter) {
std::string nonAscii("application/nonutf8");
- EXPECT_TRUE(ParseMimeTypeWithoutParameter(nonAscii, NULL, NULL));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter(nonAscii, nullptr, nullptr));
#if defined(OS_WIN)
nonAscii.append(base::WideToUTF8(L"\u2603"));
#else
nonAscii.append("\u2603"); // unicode snowman
#endif
- EXPECT_FALSE(ParseMimeTypeWithoutParameter(nonAscii, NULL, NULL));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter(nonAscii, nullptr, nullptr));
std::string top_level_type;
std::string subtype;
@@ -205,57 +205,64 @@
EXPECT_EQ("mime", subtype);
// Various allowed subtype forms.
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("application/json", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter(
- "application/x-suggestions+json", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("application/+json", NULL, NULL));
+ EXPECT_TRUE(
+ ParseMimeTypeWithoutParameter("application/json", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("application/x-suggestions+json",
+ nullptr, nullptr));
+ EXPECT_TRUE(
+ ParseMimeTypeWithoutParameter("application/+json", nullptr, nullptr));
// Upper case letters are allowed.
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/mime", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("TEXT/mime", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("Text/mime", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("TeXt/mime", NULL, NULL));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/mime", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("TEXT/mime", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("Text/mime", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("TeXt/mime", nullptr, nullptr));
// Experimental types are also considered to be valid.
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("x-video/mime", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("X-Video/mime", NULL, NULL));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("x-video/mime", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("X-Video/mime", nullptr, nullptr));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/ ", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("te(xt/ ", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/()plain", NULL, NULL));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/ ", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("te(xt/ ", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/()plain", nullptr, nullptr));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("x-video", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("x-video/", NULL, NULL));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("x-video", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("x-video/", nullptr, nullptr));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("application/a/b/c", NULL, NULL));
+ EXPECT_FALSE(
+ ParseMimeTypeWithoutParameter("application/a/b/c", nullptr, nullptr));
// Test leading and trailing whitespace
- EXPECT_TRUE(ParseMimeTypeWithoutParameter(" text/plain", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain ", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text /plain", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/ plain ", NULL, NULL));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter(" text/plain", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain ", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text /plain", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/ plain ", nullptr, nullptr));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("\ttext/plain", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain\t", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text\t/plain", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/\tplain ", NULL, NULL));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("\ttext/plain", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain\t", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text\t/plain", nullptr, nullptr));
+ EXPECT_FALSE(
+ ParseMimeTypeWithoutParameter("text/\tplain ", nullptr, nullptr));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("\vtext/plain", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain\v", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text\v/plain", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/\vplain ", NULL, NULL));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("\vtext/plain", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain\v", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text\v/plain", nullptr, nullptr));
+ EXPECT_FALSE(
+ ParseMimeTypeWithoutParameter("text/\vplain ", nullptr, nullptr));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("\rtext/plain", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain\r", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text\r/plain", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/\rplain ", NULL, NULL));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("\rtext/plain", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain\r", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text\r/plain", nullptr, nullptr));
+ EXPECT_FALSE(
+ ParseMimeTypeWithoutParameter("text/\rplain ", nullptr, nullptr));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("\ntext/plain", NULL, NULL));
- EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain\n", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text\n/plain", NULL, NULL));
- EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/\nplain ", NULL, NULL));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("\ntext/plain", nullptr, nullptr));
+ EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/plain\n", nullptr, nullptr));
+ EXPECT_FALSE(ParseMimeTypeWithoutParameter("text\n/plain", nullptr, nullptr));
+ EXPECT_FALSE(
+ ParseMimeTypeWithoutParameter("text/\nplain ", nullptr, nullptr));
//EXPECT_TRUE(ParseMimeTypeWithoutParameter("video/mime;parameter"));
}
@@ -293,18 +300,18 @@
const char* const contained_result;
bool no_matches;
} tests[] = {
- {"text/plain", 2, "txt"},
- {"text/pl", 0, NULL, true},
- {"*", 0, NULL},
- {"", 0, NULL, true},
- {"message/*", 1, "eml"},
- {"MeSsAge/*", 1, "eml"},
- {"message/", 0, NULL, true},
- {"image/bmp", 1, "bmp"},
- {"video/*", 6, "mp4"},
- {"video/*", 6, "mpeg"},
- {"audio/*", 6, "oga"},
- {"aUDIo/*", 6, "wav"},
+ {"text/plain", 2, "txt"},
+ {"text/pl", 0, nullptr, true},
+ {"*", 0, nullptr},
+ {"", 0, nullptr, true},
+ {"message/*", 1, "eml"},
+ {"MeSsAge/*", 1, "eml"},
+ {"message/", 0, nullptr, true},
+ {"image/bmp", 1, "bmp"},
+ {"video/*", 6, "mp4"},
+ {"video/*", 6, "mpeg"},
+ {"audio/*", 6, "oga"},
+ {"aUDIo/*", 6, "wav"},
};
for (const auto& test : tests) {
diff --git a/net/base/network_activity_monitor_unittest.cc b/net/base/network_activity_monitor_unittest.cc
index d7b6ceaa..e38e4dc 100644
--- a/net/base/network_activity_monitor_unittest.cc
+++ b/net/base/network_activity_monitor_unittest.cc
@@ -41,7 +41,7 @@
TEST_F(NetworkActivityMontiorTest, GetInstance) {
NetworkActivityMonitor* monitor = NetworkActivityMonitor::GetInstance();
- EXPECT_TRUE(monitor != NULL);
+ EXPECT_TRUE(monitor != nullptr);
EXPECT_TRUE(monitor == NetworkActivityMonitor::GetInstance());
}
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index 55772fc..b45a33be 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -47,10 +47,10 @@
// in ways that would require us to place locks around access to this object.
// (The prohibition on global non-POD objects makes it tricky to do such a thing
// anyway.)
-NetworkChangeNotifier* g_network_change_notifier = NULL;
+NetworkChangeNotifier* g_network_change_notifier = nullptr;
// Class factory singleton.
-NetworkChangeNotifierFactory* g_network_change_notifier_factory = NULL;
+NetworkChangeNotifierFactory* g_network_change_notifier_factory = nullptr;
class MockNetworkChangeNotifier : public NetworkChangeNotifier {
public:
@@ -183,7 +183,7 @@
NetworkChangeNotifier::~NetworkChangeNotifier() {
network_change_calculator_.reset();
DCHECK_EQ(this, g_network_change_notifier);
- g_network_change_notifier = NULL;
+ g_network_change_notifier = nullptr;
}
// static
@@ -864,7 +864,7 @@
NetworkChangeNotifier::DisableForTest::DisableForTest()
: network_change_notifier_(g_network_change_notifier) {
DCHECK(g_network_change_notifier);
- g_network_change_notifier = NULL;
+ g_network_change_notifier = nullptr;
}
NetworkChangeNotifier::DisableForTest::~DisableForTest() {
diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc
index 4031e87d..3393d9a 100644
--- a/net/base/network_change_notifier_win.cc
+++ b/net/base/network_change_notifier_win.cc
@@ -310,7 +310,7 @@
}
ResetEventIfSignaled(addr_overlapped_.hEvent);
- HANDLE handle = NULL;
+ HANDLE handle = nullptr;
DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_);
if (ret != ERROR_IO_PENDING)
return false;
diff --git a/net/base/network_interfaces_unittest.cc b/net/base/network_interfaces_unittest.cc
index 428eeec..843de293 100644
--- a/net/base/network_interfaces_unittest.cc
+++ b/net/base/network_interfaces_unittest.cc
@@ -68,7 +68,7 @@
// We can't check the result of GetWifiSSID() directly, since the result
// will differ across machines. Simply exercise the code path and hope that it
// doesn't crash.
- EXPECT_NE((const char*)NULL, GetWifiSSID().c_str());
+ EXPECT_NE((const char*)nullptr, GetWifiSSID().c_str());
}
TEST(NetworkInterfacesTest, GetHostName) {
diff --git a/net/base/network_interfaces_win.cc b/net/base/network_interfaces_win.cc
index 33b1adc..6c3dde1 100644
--- a/net/base/network_interfaces_win.cc
+++ b/net/base/network_interfaces_win.cc
@@ -55,16 +55,16 @@
if (result != ERROR_SUCCESS)
return wlan_connection_attributes;
- WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL;
+ WLAN_INTERFACE_INFO_LIST* interface_list_ptr = nullptr;
result =
- wlanapi.enum_interfaces_func(client.Get(), NULL, &interface_list_ptr);
+ wlanapi.enum_interfaces_func(client.Get(), nullptr, &interface_list_ptr);
if (result != ERROR_SUCCESS)
return wlan_connection_attributes;
std::unique_ptr<WLAN_INTERFACE_INFO_LIST, internal::WlanApiDeleter>
interface_list(interface_list_ptr);
// Assume at most one connected wifi interface.
- WLAN_INTERFACE_INFO* info = NULL;
+ WLAN_INTERFACE_INFO* info = nullptr;
for (unsigned i = 0; i < interface_list->dwNumberOfItems; ++i) {
if (interface_list->InterfaceInfo[i].isState ==
wlan_interface_state_connected) {
@@ -73,7 +73,7 @@
}
}
- if (info == NULL)
+ if (info == nullptr)
return wlan_connection_attributes;
WLAN_CONNECTION_ATTRIBUTES* conn_info_ptr = nullptr;
@@ -81,7 +81,7 @@
WLAN_OPCODE_VALUE_TYPE op_code;
result = wlanapi.query_interface_func(
client.Get(), &info->InterfaceGuid, wlan_intf_opcode_current_connection,
- NULL, &conn_info_size, reinterpret_cast<VOID**>(&conn_info_ptr),
+ nullptr, &conn_info_size, reinterpret_cast<VOID**>(&conn_info_ptr),
&op_code);
wlan_connection_attributes.reset(conn_info_ptr);
if (result == ERROR_SUCCESS)
@@ -107,7 +107,7 @@
static const wchar_t* const kDLL = L"%WINDIR%\\system32\\wlanapi.dll";
wchar_t path[MAX_PATH] = {0};
ExpandEnvironmentStrings(kDLL, path, base::size(path));
- module = ::LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+ module = ::LoadLibraryEx(path, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
if (!module)
return;
@@ -131,7 +131,7 @@
bool GetNetworkListImpl(NetworkInterfaceList* networks,
int policy,
const IP_ADAPTER_ADDRESSES* adapters) {
- for (const IP_ADAPTER_ADDRESSES* adapter = adapters; adapter != NULL;
+ for (const IP_ADAPTER_ADDRESSES* adapter = adapters; adapter != nullptr;
adapter = adapter->Next) {
// Ignore the loopback device.
if (adapter->IfType == IF_TYPE_SOFTWARE_LOOPBACK) {
@@ -147,7 +147,7 @@
// but don't ignore any GUEST side adapters with a description like:
// VMware Accelerated AMD PCNet Adapter #2
if ((policy & EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES) &&
- strstr(adapter->AdapterName, "VMnet") != NULL) {
+ strstr(adapter->AdapterName, "VMnet") != nullptr) {
continue;
}
@@ -289,8 +289,8 @@
if (result != ERROR_SUCCESS)
return;
- WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL;
- result = wlanapi.enum_interfaces_func(client_.Get(), NULL,
+ WLAN_INTERFACE_INFO_LIST* interface_list_ptr = nullptr;
+ result = wlanapi.enum_interfaces_func(client_.Get(), nullptr,
&interface_list_ptr);
if (result != ERROR_SUCCESS)
return;
@@ -301,21 +301,15 @@
WLAN_INTERFACE_INFO* info = &interface_list->InterfaceInfo[i];
if (options & WIFI_OPTIONS_DISABLE_SCAN) {
BOOL data = false;
- wlanapi.set_interface_func(client_.Get(),
- &info->InterfaceGuid,
+ wlanapi.set_interface_func(client_.Get(), &info->InterfaceGuid,
wlan_intf_opcode_background_scan_enabled,
- sizeof(data),
- &data,
- NULL);
+ sizeof(data), &data, nullptr);
}
if (options & WIFI_OPTIONS_MEDIA_STREAMING_MODE) {
BOOL data = true;
- wlanapi.set_interface_func(client_.Get(),
- &info->InterfaceGuid,
+ wlanapi.set_interface_func(client_.Get(), &info->InterfaceGuid,
wlan_intf_opcode_media_streaming_mode,
- sizeof(data),
- &data,
- NULL);
+ sizeof(data), &data, nullptr);
}
}
}
diff --git a/net/base/network_interfaces_win.h b/net/base/network_interfaces_win.h
index 5ca75c31..737f20e 100644
--- a/net/base/network_interfaces_win.h
+++ b/net/base/network_interfaces_win.h
@@ -38,8 +38,8 @@
template <typename T>
DWORD OpenHandle(DWORD client_version, DWORD* cur_version, T* handle) const {
HANDLE temp_handle;
- DWORD result = open_handle_func(client_version, NULL, cur_version,
- &temp_handle);
+ DWORD result =
+ open_handle_func(client_version, nullptr, cur_version, &temp_handle);
if (result != ERROR_SUCCESS)
return result;
handle->Set(temp_handle);
@@ -60,8 +60,8 @@
typedef HANDLE Handle;
static bool CloseHandle(HANDLE handle) {
- return WlanApi::GetInstance().close_handle_func(handle, NULL) ==
- ERROR_SUCCESS;
+ return WlanApi::GetInstance().close_handle_func(handle, nullptr) ==
+ ERROR_SUCCESS;
}
static bool IsHandleValid(HANDLE handle) {
return base::win::HandleTraits::IsHandleValid(handle);
diff --git a/net/base/network_interfaces_win_unittest.cc b/net/base/network_interfaces_win_unittest.cc
index 4d112f3b..5141718 100644
--- a/net/base/network_interfaces_win_unittest.cc
+++ b/net/base/network_interfaces_win_unittest.cc
@@ -211,9 +211,9 @@
if (result != ERROR_SUCCESS)
return -1;
- WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL;
+ WLAN_INTERFACE_INFO_LIST* interface_list_ptr = nullptr;
result =
- wlanapi.enum_interfaces_func(client.Get(), NULL, &interface_list_ptr);
+ wlanapi.enum_interfaces_func(client.Get(), nullptr, &interface_list_ptr);
if (result != ERROR_SUCCESS)
return -1;
std::unique_ptr<WLAN_INTERFACE_INFO_LIST, internal::WlanApiDeleter>
@@ -227,7 +227,7 @@
result =
wlanapi.query_interface_func(client.Get(), &info->InterfaceGuid,
wlan_intf_opcode_background_scan_enabled,
- NULL, &data_size, &data, NULL);
+ nullptr, &data_size, &data, nullptr);
if (result != ERROR_SUCCESS)
continue;
if (!read_int_or_bool(data_size, data)) {
@@ -237,7 +237,7 @@
result = wlanapi.query_interface_func(client.Get(), &info->InterfaceGuid,
wlan_intf_opcode_media_streaming_mode,
- NULL, &data_size, &data, NULL);
+ nullptr, &data_size, &data, nullptr);
if (result != ERROR_SUCCESS)
continue;
if (read_int_or_bool(data_size, data)) {
diff --git a/net/base/prioritized_dispatcher.cc b/net/base/prioritized_dispatcher.cc
index 747a454..79baa33 100644
--- a/net/base/prioritized_dispatcher.cc
+++ b/net/base/prioritized_dispatcher.cc
@@ -56,7 +56,7 @@
PrioritizedDispatcher::Job* PrioritizedDispatcher::EvictOldestLowest() {
Handle handle = queue_.FirstMin();
if (handle.is_null())
- return NULL;
+ return nullptr;
Job* job = handle.value();
Cancel(handle);
return job;
diff --git a/net/base/prioritized_dispatcher_unittest.cc b/net/base/prioritized_dispatcher_unittest.cc
index 3970ff4d..389d20db 100644
--- a/net/base/prioritized_dispatcher_unittest.cc
+++ b/net/base/prioritized_dispatcher_unittest.cc
@@ -406,7 +406,7 @@
TEST_F(PrioritizedDispatcherTest, EvictFromEmpty) {
PrioritizedDispatcher::Limits limits(NUM_PRIORITIES, 1);
Prepare(limits);
- EXPECT_TRUE(dispatcher_->EvictOldestLowest() == NULL);
+ EXPECT_TRUE(dispatcher_->EvictOldestLowest() == nullptr);
}
TEST_F(PrioritizedDispatcherTest, AddWhileZeroLimits) {
diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc
index 8ee06e0b1..b799d4b 100644
--- a/net/base/test_completion_callback_unittest.cc
+++ b/net/base/test_completion_callback_unittest.cc
@@ -84,7 +84,7 @@
// Drop the employer_'s reference to us. Do this before running the
// callback since the callback might result in the employer being
// destroyed.
- employer_->request_ = NULL;
+ employer_->request_ = nullptr;
std::move(callback_).Run(kMagicResult);
}
@@ -101,7 +101,7 @@
if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&ExampleWorker::DoWork, request_))) {
NOTREACHED();
- request_ = NULL;
+ request_ = nullptr;
return false;
}
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc
index bd7b8f7..193872e63 100644
--- a/net/base/upload_data_stream.cc
+++ b/net/base/upload_data_stream.cc
@@ -143,7 +143,7 @@
const std::vector<std::unique_ptr<UploadElementReader>>*
UploadDataStream::GetElementReaders() const {
- return NULL;
+ return nullptr;
}
void UploadDataStream::OnInitCompleted(int result) {
diff --git a/net/cert/cert_verify_proc.cc b/net/cert/cert_verify_proc.cc
index 3cd0f3d..9196b77 100644
--- a/net/cert/cert_verify_proc.cc
+++ b/net/cert/cert_verify_proc.cc
@@ -100,7 +100,7 @@
CertTypeToString(cert_type));
// Do not use UMA_HISTOGRAM_... macros here, as it caches the Histogram
// instance and thus only works if |histogram_name| is constant.
- base::HistogramBase* counter = NULL;
+ base::HistogramBase* counter = nullptr;
// Histogram buckets are contingent upon the underlying algorithm being used.
if (cert_type == X509Certificate::kPublicKeyTypeECDH ||
diff --git a/net/cert/cert_verify_proc_unittest.cc b/net/cert/cert_verify_proc_unittest.cc
index 237ad0e..aa87982 100644
--- a/net/cert/cert_verify_proc_unittest.cc
+++ b/net/cert/cert_verify_proc_unittest.cc
@@ -906,7 +906,7 @@
reinterpret_cast<const char*>(paypal_null_der),
sizeof(paypal_null_der)));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), paypal_null_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), paypal_null_cert.get());
EXPECT_EQ(paypal_null_fingerprint, X509Certificate::CalculateFingerprint256(
paypal_null_cert->cert_buffer()));
@@ -1097,7 +1097,7 @@
// Add the root that signed the intermediates for this test.
scoped_refptr<X509Certificate> root_cert =
ImportCertFromFile(certs_dir, "2048-rsa-root.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), root_cert.get());
ScopedTestRoot scoped_root(root_cert.get());
// Now test each chain.
@@ -1110,12 +1110,12 @@
SCOPED_TRACE(basename);
scoped_refptr<X509Certificate> ee_cert =
ImportCertFromFile(certs_dir, basename);
- ASSERT_NE(static_cast<X509Certificate*>(NULL), ee_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), ee_cert.get());
basename = *signer_type + "-intermediate.pem";
scoped_refptr<X509Certificate> intermediate =
ImportCertFromFile(certs_dir, basename);
- ASSERT_NE(static_cast<X509Certificate*>(NULL), intermediate.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), intermediate.get());
std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> intermediates;
intermediates.push_back(bssl::UpRef(intermediate->cert_buffer()));
@@ -1163,15 +1163,15 @@
scoped_refptr<X509Certificate> server_cert =
ImportCertFromFile(certs_dir, "cross-signed-leaf.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), server_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), server_cert.get());
scoped_refptr<X509Certificate> extra_cert =
ImportCertFromFile(certs_dir, "cross-signed-root-md5.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), extra_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), extra_cert.get());
scoped_refptr<X509Certificate> root_cert =
ImportCertFromFile(certs_dir, "cross-signed-root-sha256.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), root_cert.get());
ScopedTestRoot scoped_root(root_cert.get());
@@ -1204,11 +1204,11 @@
scoped_refptr<X509Certificate> server_cert =
ImportCertFromFile(certs_dir, "google_diginotar.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), server_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), server_cert.get());
scoped_refptr<X509Certificate> intermediate_cert =
ImportCertFromFile(certs_dir, "diginotar_public_ca_2025.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), intermediate_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), intermediate_cert.get());
std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> intermediates;
intermediates.push_back(bssl::UpRef(intermediate_cert->cert_buffer()));
@@ -1767,7 +1767,7 @@
scoped_refptr<X509Certificate> server_cert =
ImportCertFromFile(certs_dir, "invalid_key_usage_cert.der");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), server_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), server_cert.get());
int flags = 0;
CertVerifyResult verify_result;
@@ -1860,17 +1860,17 @@
scoped_refptr<X509Certificate> google_full_chain =
X509Certificate::CreateFromBuffer(bssl::UpRef(certs[0]->cert_buffer()),
std::move(intermediates));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), google_full_chain.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), google_full_chain.get());
ASSERT_EQ(2U, google_full_chain->intermediate_buffers().size());
CertVerifyResult verify_result;
- EXPECT_EQ(static_cast<X509Certificate*>(NULL),
+ EXPECT_EQ(static_cast<X509Certificate*>(nullptr),
verify_result.verified_cert.get());
int error =
Verify(google_full_chain.get(), "127.0.0.1", 0,
CRLSet::BuiltinCRLSet().get(), CertificateList(), &verify_result);
EXPECT_THAT(error, IsOk());
- ASSERT_NE(static_cast<X509Certificate*>(NULL),
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr),
verify_result.verified_cert.get());
EXPECT_NE(google_full_chain, verify_result.verified_cert);
@@ -2121,8 +2121,10 @@
ImportCertFromFile(certs_dir, "duplicate_cn_1.pem");
scoped_refptr<X509Certificate> unrelated_certificate2 =
ImportCertFromFile(certs_dir, "aia-cert.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), unrelated_certificate.get());
- ASSERT_NE(static_cast<X509Certificate*>(NULL), unrelated_certificate2.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr),
+ unrelated_certificate.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr),
+ unrelated_certificate2.get());
// Interject unrelated certificates into the list of intermediates.
std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> intermediates;
@@ -3263,11 +3265,11 @@
// unable to distinguish that this is an intermediate and not a trust anchor, so
// this intermediate is treated like a trust anchor.
const WeakDigestTestData kVerifyIncompleteIntermediateTestData[] = {
- {NULL, "weak_digest_md5_intermediate.pem", "weak_digest_sha1_ee.pem",
+ {nullptr, "weak_digest_md5_intermediate.pem", "weak_digest_sha1_ee.pem",
/*EXPECT_MD5 |*/ EXPECT_SHA1 | EXPECT_SHA1_LEAF},
- {NULL, "weak_digest_md4_intermediate.pem", "weak_digest_sha1_ee.pem",
+ {nullptr, "weak_digest_md4_intermediate.pem", "weak_digest_sha1_ee.pem",
/*EXPECT_MD4 |*/ EXPECT_SHA1 | EXPECT_SHA1_LEAF},
- {NULL, "weak_digest_md2_intermediate.pem", "weak_digest_sha1_ee.pem",
+ {nullptr, "weak_digest_md2_intermediate.pem", "weak_digest_sha1_ee.pem",
/*EXPECT_MD2 |*/ EXPECT_SHA1 | EXPECT_SHA1_LEAF},
};
@@ -3282,11 +3284,11 @@
// this is an intermediate and not a trust anchor, so this intermediate is
// treated like a trust anchor.
const WeakDigestTestData kVerifyIncompleteEETestData[] = {
- {NULL, "weak_digest_sha1_intermediate.pem", "weak_digest_md5_ee.pem",
+ {nullptr, "weak_digest_sha1_intermediate.pem", "weak_digest_md5_ee.pem",
/*EXPECT_SHA1 |*/ EXPECT_MD5},
- {NULL, "weak_digest_sha1_intermediate.pem", "weak_digest_md4_ee.pem",
+ {nullptr, "weak_digest_sha1_intermediate.pem", "weak_digest_md4_ee.pem",
/*EXPECT_SHA1 |*/ EXPECT_MD4},
- {NULL, "weak_digest_sha1_intermediate.pem", "weak_digest_md2_ee.pem",
+ {nullptr, "weak_digest_sha1_intermediate.pem", "weak_digest_md2_ee.pem",
/*EXPECT_SHA1 |*/ EXPECT_MD2},
};
@@ -3312,10 +3314,10 @@
// The EE is a trusted certificate. Even though it uses weak hashes, these
// should not be reported.
const WeakDigestTestData kVerifyTrustedEETestData[] = {
- {NULL, NULL, "weak_digest_md5_ee.pem", 0},
- {NULL, NULL, "weak_digest_md4_ee.pem", 0},
- {NULL, NULL, "weak_digest_md2_ee.pem", 0},
- {NULL, NULL, "weak_digest_sha1_ee.pem", 0},
+ {nullptr, nullptr, "weak_digest_md5_ee.pem", 0},
+ {nullptr, nullptr, "weak_digest_md4_ee.pem", 0},
+ {nullptr, nullptr, "weak_digest_md2_ee.pem", 0},
+ {nullptr, nullptr, "weak_digest_sha1_ee.pem", 0},
};
INSTANTIATE_TEST_SUITE_P(VerifyTrustedEE,
diff --git a/net/cert/cert_verify_proc_win.cc b/net/cert/cert_verify_proc_win.cc
index 03f2e60..95cfda8 100644
--- a/net/cert/cert_verify_proc_win.cc
+++ b/net/cert/cert_verify_proc_win.cc
@@ -183,7 +183,7 @@
decode_para.cbSize = sizeof(decode_para);
decode_para.pfnAlloc = crypto::CryptAlloc;
decode_para.pfnFree = crypto::CryptFree;
- CERT_NAME_INFO* name_info = NULL;
+ CERT_NAME_INFO* name_info = nullptr;
DWORD name_info_size = 0;
BOOL rv;
rv = CryptDecodeObjectEx(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
@@ -279,7 +279,7 @@
DWORD num_elements = first_chain->cElement;
PCERT_CHAIN_ELEMENT* element = first_chain->rgpElement;
- PCCERT_CONTEXT verified_cert = NULL;
+ PCCERT_CONTEXT verified_cert = nullptr;
std::vector<PCCERT_CONTEXT> verified_chain;
bool has_root_ca = num_elements > 1 &&
@@ -335,7 +335,7 @@
decode_para.cbSize = sizeof(decode_para);
decode_para.pfnAlloc = crypto::CryptAlloc;
decode_para.pfnFree = crypto::CryptFree;
- CERT_POLICIES_INFO* policies_info = NULL;
+ CERT_POLICIES_INFO* policies_info = nullptr;
DWORD policies_info_size = 0;
BOOL rv;
rv = CryptDecodeObjectEx(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
@@ -628,7 +628,7 @@
reinterpret_cast<void*>(&CertDllVerifyRevocationWithCRLSet)},
};
BOOL ok = CryptInstallOIDFunctionAddress(
- NULL, X509_ASN_ENCODING, CRYPT_OID_VERIFY_REVOCATION_FUNC,
+ nullptr, X509_ASN_ENCODING, CRYPT_OID_VERIFY_REVOCATION_FUNC,
base::size(kInterceptFunction), kInterceptFunction,
CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG);
DCHECK(ok);
@@ -882,7 +882,7 @@
// Get the certificatePolicies extension of the certificate.
std::unique_ptr<CERT_POLICIES_INFO, base::FreeDeleter> policies_info;
- LPSTR ev_policy_oid = NULL;
+ LPSTR ev_policy_oid = nullptr;
GetCertPoliciesInfo(cert_list.get(), &policies_info);
if (policies_info) {
EVRootCAMetadata* metadata = EVRootCAMetadata::GetInstance();
@@ -982,9 +982,9 @@
// calls will use the fallback path.
BOOL chain_result =
CertGetCertificateChain(chain_engine, cert_list.get(),
- NULL, // current system time
+ nullptr, // current system time
cert_list->hCertStore, &chain_para, chain_flags,
- NULL, // reserved
+ nullptr, // reserved
&chain_context);
if (chain_result && chain_context &&
(chain_context->TrustStatus.dwErrorStatus &
@@ -999,9 +999,9 @@
chain_para.dwStrongSignFlags = 0;
chain_result =
CertGetCertificateChain(chain_engine, cert_list.get(),
- NULL, // current system time
+ nullptr, // current system time
cert_list->hCertStore, &chain_para, chain_flags,
- NULL, // reserved
+ nullptr, // reserved
&chain_context);
}
@@ -1028,15 +1028,12 @@
verify_result->cert_status |= CERT_STATUS_REV_CHECKING_ENABLED;
CertFreeCertificateChain(chain_context);
- if (!CertGetCertificateChain(
- chain_engine,
- cert_list.get(),
- NULL, // current system time
- cert_list->hCertStore,
- &chain_para,
- chain_flags,
- NULL, // reserved
- &chain_context)) {
+ if (!CertGetCertificateChain(chain_engine, cert_list.get(),
+ nullptr, // current system time
+ cert_list->hCertStore, &chain_para,
+ chain_flags,
+ nullptr, // reserved
+ &chain_context)) {
verify_result->cert_status |= CERT_STATUS_INVALID;
return MapSecurityError(GetLastError());
}
@@ -1044,19 +1041,16 @@
if (chain_context->TrustStatus.dwErrorStatus &
CERT_TRUST_IS_NOT_VALID_FOR_USAGE) {
- ev_policy_oid = NULL;
+ ev_policy_oid = nullptr;
chain_para.RequestedIssuancePolicy.Usage.cUsageIdentifier = 0;
- chain_para.RequestedIssuancePolicy.Usage.rgpszUsageIdentifier = NULL;
+ chain_para.RequestedIssuancePolicy.Usage.rgpszUsageIdentifier = nullptr;
CertFreeCertificateChain(chain_context);
- if (!CertGetCertificateChain(
- chain_engine,
- cert_list.get(),
- NULL, // current system time
- cert_list->hCertStore,
- &chain_para,
- chain_flags,
- NULL, // reserved
- &chain_context)) {
+ if (!CertGetCertificateChain(chain_engine, cert_list.get(),
+ nullptr, // current system time
+ cert_list->hCertStore, &chain_para,
+ chain_flags,
+ nullptr, // reserved
+ &chain_context)) {
verify_result->cert_status |= CERT_STATUS_INVALID;
return MapSecurityError(GetLastError());
}
@@ -1073,15 +1067,12 @@
chain_flags &= ~CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY;
CertFreeCertificateChain(chain_context);
- if (!CertGetCertificateChain(
- chain_engine,
- cert_list.get(),
- NULL, // current system time
- cert_list->hCertStore,
- &chain_para,
- chain_flags,
- NULL, // reserved
- &chain_context)) {
+ if (!CertGetCertificateChain(chain_engine, cert_list.get(),
+ nullptr, // current system time
+ cert_list->hCertStore, &chain_para,
+ chain_flags,
+ nullptr, // reserved
+ &chain_context)) {
verify_result->cert_status |= CERT_STATUS_INVALID;
return MapSecurityError(GetLastError());
}
diff --git a/net/cert/cert_verify_result.cc b/net/cert/cert_verify_result.cc
index 7c4ecfa..cbbfb02 100644
--- a/net/cert/cert_verify_result.cc
+++ b/net/cert/cert_verify_result.cc
@@ -19,7 +19,7 @@
CertVerifyResult::~CertVerifyResult() = default;
void CertVerifyResult::Reset() {
- verified_cert = NULL;
+ verified_cert = nullptr;
cert_status = 0;
has_md2 = false;
has_md4 = false;
diff --git a/net/cert/crl_set_unittest.cc b/net/cert/crl_set_unittest.cc
index b9c89e6..a549950f 100644
--- a/net/cert/crl_set_unittest.cc
+++ b/net/cert/crl_set_unittest.cc
@@ -82,7 +82,7 @@
sizeof(kGIACRLSet));
scoped_refptr<CRLSet> set;
EXPECT_TRUE(CRLSet::Parse(s, &set));
- ASSERT_TRUE(set.get() != NULL);
+ ASSERT_TRUE(set.get() != nullptr);
const CRLSet::CRLList& crls = set->CrlsForTesting();
ASSERT_EQ(1u, crls.size());
@@ -113,7 +113,7 @@
sizeof(kBlockedSPKICRLSet));
scoped_refptr<CRLSet> set;
EXPECT_TRUE(CRLSet::Parse(s, &set));
- ASSERT_TRUE(set.get() != NULL);
+ ASSERT_TRUE(set.get() != nullptr);
const uint8_t spki_hash[] = {
227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36,
@@ -140,7 +140,7 @@
static const char* const kDigiNotarFilenames[] = {
"diginotar_root_ca.pem", "diginotar_cyber_ca.pem",
"diginotar_services_1024_ca.pem", "diginotar_pkioverheid.pem",
- "diginotar_pkioverheid_g2.pem", NULL,
+ "diginotar_pkioverheid_g2.pem", nullptr,
};
base::FilePath certs_dir = GetTestCertsDirectory();
@@ -170,7 +170,7 @@
&crl_set_bytes));
scoped_refptr<CRLSet> set;
EXPECT_TRUE(CRLSet::Parse(crl_set_bytes, &set));
- ASSERT_TRUE(set.get() != NULL);
+ ASSERT_TRUE(set.get() != nullptr);
scoped_refptr<X509Certificate> root = CreateCertificateChainFromFile(
GetTestCertsDirectory(), "root_ca_cert.pem",
@@ -212,7 +212,7 @@
sizeof(kExpiredCRLSet));
scoped_refptr<CRLSet> set;
EXPECT_TRUE(CRLSet::Parse(s, &set));
- ASSERT_TRUE(set.get() != NULL);
+ ASSERT_TRUE(set.get() != nullptr);
EXPECT_TRUE(set->IsExpired());
}
diff --git a/net/cert/ct_log_response_parser.cc b/net/cert/ct_log_response_parser.cc
index 81e0f0a..eea2167 100644
--- a/net/cert/ct_log_response_parser.cc
+++ b/net/cert/ct_log_response_parser.cc
@@ -162,7 +162,7 @@
return false;
}
- const base::DictionaryValue* dict_value = NULL;
+ const base::DictionaryValue* dict_value = nullptr;
if (!json_consistency_proof.GetAsDictionary(&dict_value) ||
!dict_value->HasKey("consistency")) {
DVLOG(1) << "Missing consistency field.";
diff --git a/net/cert/ct_log_verifier.cc b/net/cert/ct_log_verifier.cc
index ea79f5c7..f82649a 100644
--- a/net/cert/ct_log_verifier.cc
+++ b/net/cert/ct_log_verifier.cc
@@ -50,7 +50,7 @@
case ct::DigitallySigned::HASH_ALGO_NONE:
default:
NOTREACHED();
- return NULL;
+ return nullptr;
}
}
@@ -73,7 +73,7 @@
dns_domain_(std::move(dns_domain)),
hash_algorithm_(ct::DigitallySigned::HASH_ALGO_NONE),
signature_algorithm_(ct::DigitallySigned::SIG_ALGO_ANONYMOUS),
- public_key_(NULL) {
+ public_key_(nullptr) {
DCHECK(!dns_domain_.empty());
}
@@ -345,11 +345,12 @@
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
const EVP_MD* hash_alg = GetEvpAlg(hash_algorithm_);
- if (hash_alg == NULL)
+ if (hash_alg == nullptr)
return false;
bssl::ScopedEVP_MD_CTX ctx;
- return EVP_DigestVerifyInit(ctx.get(), NULL, hash_alg, NULL, public_key_) &&
+ return EVP_DigestVerifyInit(ctx.get(), nullptr, hash_alg, nullptr,
+ public_key_) &&
EVP_DigestVerifyUpdate(ctx.get(), data_to_sign.data(),
data_to_sign.size()) &&
EVP_DigestVerifyFinal(
diff --git a/net/cert/jwk_serializer.cc b/net/cert/jwk_serializer.cc
index 0faab40..870099e 100644
--- a/net/cert/jwk_serializer.cc
+++ b/net/cert/jwk_serializer.cc
@@ -52,7 +52,7 @@
bssl::UniquePtr<BIGNUM> x(BN_new());
bssl::UniquePtr<BIGNUM> y(BN_new());
if (!EC_POINT_get_affine_coordinates_GFp(ec_group, ec_point, x.get(), y.get(),
- NULL)) {
+ nullptr)) {
return false;
}
diff --git a/net/cert/multi_log_ct_verifier_unittest.cc b/net/cert/multi_log_ct_verifier_unittest.cc
index d1a50c3c..e3e43f1 100644
--- a/net/cert/multi_log_ct_verifier_unittest.cc
+++ b/net/cert/multi_log_ct_verifier_unittest.cc
@@ -141,7 +141,7 @@
base::Histogram* histogram = static_cast<base::Histogram*>(
base::StatisticsRecorder::FindHistogram(histogram_name));
- if (histogram == NULL)
+ if (histogram == nullptr)
return 0;
std::unique_ptr<base::HistogramSamples> samples =
diff --git a/net/cert/multi_threaded_cert_verifier_unittest.cc b/net/cert/multi_threaded_cert_verifier_unittest.cc
index 29c383f..5506984 100644
--- a/net/cert/multi_threaded_cert_verifier_unittest.cc
+++ b/net/cert/multi_threaded_cert_verifier_unittest.cc
@@ -94,7 +94,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> test_cert(
ImportCertFromFile(certs_dir, "ok_cert.pem"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), test_cert.get());
int error;
CertVerifyResult verify_result;
@@ -129,7 +129,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> test_cert(
ImportCertFromFile(certs_dir, "ok_cert.pem"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), test_cert.get());
int error;
CertVerifyResult verify_result;
@@ -163,7 +163,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> test_cert(
ImportCertFromFile(certs_dir, "ok_cert.pem"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), test_cert.get());
int error;
CertVerifyResult verify_result;
diff --git a/net/cert/signed_certificate_timestamp.cc b/net/cert/signed_certificate_timestamp.cc
index 3fff518..4b2567b 100644
--- a/net/cert/signed_certificate_timestamp.cc
+++ b/net/cert/signed_certificate_timestamp.cc
@@ -65,7 +65,7 @@
iter->ReadString(&sct->signature.signature_data) &&
iter->ReadInt(&origin) &&
iter->ReadString(&sct->log_description))) {
- return NULL;
+ return nullptr;
}
// Now set the rest of the member variables:
sct->version = static_cast<Version>(version);
diff --git a/net/cert/test_root_certs.cc b/net/cert/test_root_certs.cc
index cd07674c..f455d18f 100644
--- a/net/cert/test_root_certs.cc
+++ b/net/cert/test_root_certs.cc
@@ -64,7 +64,7 @@
}
ScopedTestRoot::~ScopedTestRoot() {
- Reset(NULL);
+ Reset(nullptr);
}
void ScopedTestRoot::Reset(X509Certificate* cert) {
diff --git a/net/cert/test_root_certs_unittest.cc b/net/cert/test_root_certs_unittest.cc
index ef68752..db9b092c 100644
--- a/net/cert/test_root_certs_unittest.cc
+++ b/net/cert/test_root_certs_unittest.cc
@@ -41,10 +41,10 @@
TEST(TestRootCertsTest, AddFromPointer) {
scoped_refptr<X509Certificate> root_cert =
ImportCertFromFile(GetTestCertsDirectory(), kRootCertificateFile);
- ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), root_cert.get());
TestRootCerts* test_roots = TestRootCerts::GetInstance();
- ASSERT_NE(static_cast<TestRootCerts*>(NULL), test_roots);
+ ASSERT_NE(static_cast<TestRootCerts*>(nullptr), test_roots);
EXPECT_TRUE(test_roots->IsEmpty());
EXPECT_TRUE(test_roots->Add(root_cert.get()));
@@ -58,7 +58,7 @@
// behave the same as when adding from an existing certificate.
TEST(TestRootCertsTest, AddFromFile) {
TestRootCerts* test_roots = TestRootCerts::GetInstance();
- ASSERT_NE(static_cast<TestRootCerts*>(NULL), test_roots);
+ ASSERT_NE(static_cast<TestRootCerts*>(nullptr), test_roots);
EXPECT_TRUE(test_roots->IsEmpty());
base::FilePath cert_path =
@@ -77,12 +77,12 @@
// is properly being set and cleared.
TEST(TestRootCertsTest, OverrideTrust) {
TestRootCerts* test_roots = TestRootCerts::GetInstance();
- ASSERT_NE(static_cast<TestRootCerts*>(NULL), test_roots);
+ ASSERT_NE(static_cast<TestRootCerts*>(nullptr), test_roots);
EXPECT_TRUE(test_roots->IsEmpty());
scoped_refptr<X509Certificate> test_cert =
ImportCertFromFile(GetTestCertsDirectory(), kGoodCertificateFile);
- ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), test_cert.get());
// Test that the good certificate fails verification, because the root
// certificate should not yet be trusted.
diff --git a/net/cert/test_root_certs_win.cc b/net/cert/test_root_certs_win.cc
index 72240c7..d581099a 100644
--- a/net/cert/test_root_certs_win.cc
+++ b/net/cert/test_root_certs_win.cc
@@ -45,9 +45,7 @@
private:
friend struct base::LazyInstanceTraitsBase<CryptoAPIInjector>;
- CryptoAPIInjector()
- : original_function(NULL),
- original_handle(NULL) {
+ CryptoAPIInjector() : original_function(nullptr), original_handle(nullptr) {
HCRYPTOIDFUNCSET registered_functions =
CryptInitOIDFunctionSet(CRYPT_OID_OPEN_STORE_PROV_FUNC, 0);
@@ -72,10 +70,9 @@
// Inject kFunctionToIntercept at the front of the linked list that
// crypt32 uses when CertOpenStore is called, replacing the existing
// registered function.
- ok = CryptInstallOIDFunctionAddress(NULL, 0,
- CRYPT_OID_OPEN_STORE_PROV_FUNC, 1,
- &kFunctionToIntercept,
- CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG);
+ ok = CryptInstallOIDFunctionAddress(
+ nullptr, 0, CRYPT_OID_OPEN_STORE_PROV_FUNC, 1, &kFunctionToIntercept,
+ CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG);
DCHECK(ok);
}
@@ -84,7 +81,7 @@
// may still be running when ~AtExitManager is called, so the LazyInstance
// must be leaky.
~CryptoAPIInjector() {
- original_function = NULL;
+ original_function = nullptr;
CryptFreeOIDFunctionAddress(original_handle, NULL);
}
};
@@ -150,7 +147,7 @@
reinterpret_cast<const BYTE*>(
CRYPTO_BUFFER_data(certificate->cert_buffer())),
base::checked_cast<DWORD>(CRYPTO_BUFFER_len(certificate->cert_buffer())),
- CERT_STORE_ADD_NEW, NULL);
+ CERT_STORE_ADD_NEW, nullptr);
if (!ok) {
// If the certificate is already added, return successfully.
return GetLastError() == static_cast<DWORD>(CRYPT_E_EXISTS);
@@ -164,9 +161,9 @@
empty_ = true;
for (PCCERT_CONTEXT prev_cert =
- CertEnumCertificatesInStore(temporary_roots_, NULL);
+ CertEnumCertificatesInStore(temporary_roots_, nullptr);
prev_cert;
- prev_cert = CertEnumCertificatesInStore(temporary_roots_, NULL))
+ prev_cert = CertEnumCertificatesInStore(temporary_roots_, nullptr))
CertDeleteCertificateFromStore(prev_cert);
}
@@ -176,7 +173,7 @@
HCERTCHAINENGINE TestRootCerts::GetChainEngine() const {
if (IsEmpty())
- return NULL; // Default chain engine will suffice.
+ return nullptr; // Default chain engine will suffice.
// Windows versions before 8 don't accept the struct size for later versions.
// We report the size of the old struct since we don't need the new members.
@@ -197,7 +194,7 @@
engine_config.dwFlags =
CERT_CHAIN_ENABLE_CACHE_AUTO_UPDATE |
CERT_CHAIN_ENABLE_SHARE_STORE;
- HCERTCHAINENGINE chain_engine = NULL;
+ HCERTCHAINENGINE chain_engine = nullptr;
BOOL ok = CertCreateCertificateChainEngine(&engine_config, &chain_engine);
DCHECK(ok);
return chain_engine;
@@ -209,9 +206,9 @@
void TestRootCerts::Init() {
empty_ = true;
- temporary_roots_ = CertOpenStore(
- CERT_STORE_PROV_MEMORY, 0, NULL,
- CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL);
+ temporary_roots_ =
+ CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL,
+ CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, nullptr);
DCHECK(temporary_roots_);
}
diff --git a/net/cert/x509_certificate.cc b/net/cert/x509_certificate.cc
index 22b64a6..0f7df41 100644
--- a/net/cert/x509_certificate.cc
+++ b/net/cert/x509_certificate.cc
@@ -248,7 +248,7 @@
bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer =
CreateCertBufferFromBytes(data, length);
if (!cert_buffer)
- return NULL;
+ return nullptr;
scoped_refptr<X509Certificate> cert =
CreateFromBufferUnsafeOptions(std::move(cert_buffer), {}, options);
diff --git a/net/cert/x509_certificate_unittest.cc b/net/cert/x509_certificate_unittest.cc
index 3922cf94..007e437 100644
--- a/net/cert/x509_certificate_unittest.cc
+++ b/net/cert/x509_certificate_unittest.cc
@@ -72,7 +72,7 @@
const SHA256HashValue& expected_fingerprint,
double valid_from,
double valid_to) {
- ASSERT_NE(static_cast<X509Certificate*>(NULL), google_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), google_cert.get());
const CertPrincipal& subject = google_cert->subject();
EXPECT_EQ("www.google.com", subject.common_name);
@@ -122,7 +122,7 @@
scoped_refptr<X509Certificate> webkit_cert(X509Certificate::CreateFromBytes(
reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), webkit_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), webkit_cert.get());
const CertPrincipal& subject = webkit_cert->subject();
EXPECT_EQ("Cupertino", subject.locality_name);
@@ -173,7 +173,7 @@
scoped_refptr<X509Certificate> thawte_cert(X509Certificate::CreateFromBytes(
reinterpret_cast<const char*>(thawte_der), sizeof(thawte_der)));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), thawte_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), thawte_cert.get());
const CertPrincipal& subject = thawte_cert->subject();
EXPECT_EQ("www.thawte.com", subject.common_name);
@@ -216,7 +216,7 @@
scoped_refptr<X509Certificate> multivalue_rdn_cert =
ImportCertFromFile(certs_dir, "multivalue_rdn.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), multivalue_rdn_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), multivalue_rdn_cert.get());
const CertPrincipal& subject = multivalue_rdn_cert->subject();
EXPECT_EQ("Multivalue RDN Test", subject.common_name);
@@ -240,7 +240,7 @@
scoped_refptr<X509Certificate> unescaped_cert =
ImportCertFromFile(certs_dir, "unescaped.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), unescaped_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), unescaped_cert.get());
const CertPrincipal& subject = unescaped_cert->subject();
EXPECT_EQ("127.0.0.1", subject.common_name);
@@ -457,15 +457,15 @@
scoped_refptr<X509Certificate> server_cert =
ImportCertFromFile(certs_dir, "salesforce_com_test.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), server_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), server_cert.get());
scoped_refptr<X509Certificate> intermediate_cert1 =
ImportCertFromFile(certs_dir, "verisign_intermediate_ca_2011.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), intermediate_cert1.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), intermediate_cert1.get());
scoped_refptr<X509Certificate> intermediate_cert2 =
ImportCertFromFile(certs_dir, "verisign_intermediate_ca_2016.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), intermediate_cert2.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), intermediate_cert2.get());
std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> intermediates;
intermediates.push_back(bssl::UpRef(intermediate_cert1->cert_buffer()));
@@ -513,7 +513,7 @@
scoped_refptr<X509Certificate> san_cert =
ImportCertFromFile(certs_dir, "subjectAltName_sanity_check.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), san_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), san_cert.get());
// Ensure that testing for SAN without using it is accepted.
EXPECT_TRUE(san_cert->GetSubjectAltName(nullptr, nullptr));
@@ -554,7 +554,7 @@
scoped_refptr<X509Certificate> no_san_cert =
ImportCertFromFile(certs_dir, "salesforce_com_test.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), no_san_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), no_san_cert.get());
EXPECT_NE(0u, dns_names.size());
EXPECT_NE(0u, ip_addresses.size());
@@ -567,7 +567,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> cert =
ImportCertFromFile(certs_dir, "nist.der");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), cert.get());
base::StringPiece spkiBytes;
EXPECT_TRUE(asn1::ExtractSPKIFromDERCert(
@@ -584,7 +584,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> cert =
ImportCertFromFile(certs_dir, "tls_feature_extension.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), cert.get());
EXPECT_TRUE(asn1::HasTLSFeatureExtension(
x509_util::CryptoBufferAsStringPiece(cert->cert_buffer())));
@@ -594,7 +594,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> cert =
ImportCertFromFile(certs_dir, "ok_cert.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), cert.get());
EXPECT_FALSE(asn1::HasTLSFeatureExtension(
x509_util::CryptoBufferAsStringPiece(cert->cert_buffer())));
@@ -604,7 +604,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> cert = ImportCertFromFile(
certs_dir, "can_sign_http_exchanges_draft_extension.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), cert.get());
EXPECT_TRUE(asn1::HasCanSignHttpExchangesDraftExtension(
x509_util::CryptoBufferAsStringPiece(cert->cert_buffer())));
@@ -614,7 +614,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> cert = ImportCertFromFile(
certs_dir, "can_sign_http_exchanges_draft_extension_invalid.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), cert.get());
EXPECT_FALSE(asn1::HasCanSignHttpExchangesDraftExtension(
x509_util::CryptoBufferAsStringPiece(cert->cert_buffer())));
@@ -624,7 +624,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> cert =
ImportCertFromFile(certs_dir, "ok_cert.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), cert.get());
EXPECT_FALSE(asn1::HasCanSignHttpExchangesDraftExtension(
x509_util::CryptoBufferAsStringPiece(cert->cert_buffer())));
@@ -634,7 +634,7 @@
base::FilePath certs_dir = GetTestCertsDirectory();
scoped_refptr<X509Certificate> cert =
ImportCertFromFile(certs_dir, "ok_cert.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), cert.get());
static constexpr uint8_t kBasicConstraintsOID[] = {0x55, 0x1d, 0x13};
bool present, critical;
@@ -882,7 +882,7 @@
// Test a client certificate from MIT.
scoped_refptr<X509Certificate> mit_davidben_cert(
ImportCertFromFile(certs_dir, "mit.davidben.der"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), mit_davidben_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), mit_davidben_cert.get());
std::string mit_issuer(reinterpret_cast<const char*>(MITDN),
sizeof(MITDN));
@@ -890,7 +890,7 @@
// Test a certificate from Google, issued by Thawte
scoped_refptr<X509Certificate> google_cert(
ImportCertFromFile(certs_dir, "google.single.der"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), google_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), google_cert.get());
std::string thawte_issuer(reinterpret_cast<const char*>(ThawteDN),
sizeof(ThawteDN));
@@ -923,22 +923,22 @@
scoped_refptr<X509Certificate> cert(
ImportCertFromFile(certs_dir, "mit.davidben.der"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), cert.get());
EXPECT_FALSE(X509Certificate::IsSelfSigned(cert->cert_buffer()));
scoped_refptr<X509Certificate> self_signed(
ImportCertFromFile(certs_dir, "aia-root.pem"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), self_signed.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), self_signed.get());
EXPECT_TRUE(X509Certificate::IsSelfSigned(self_signed->cert_buffer()));
scoped_refptr<X509Certificate> bad_name(
ImportCertFromFile(certs_dir, "self-signed-invalid-name.pem"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), bad_name.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), bad_name.get());
EXPECT_FALSE(X509Certificate::IsSelfSigned(bad_name->cert_buffer()));
scoped_refptr<X509Certificate> bad_sig(
ImportCertFromFile(certs_dir, "self-signed-invalid-sig.pem"));
- ASSERT_NE(static_cast<X509Certificate*>(NULL), bad_sig.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), bad_sig.get());
EXPECT_FALSE(X509Certificate::IsSelfSigned(bad_sig->cert_buffer()));
}
@@ -1014,79 +1014,100 @@
{"google.single.der",
X509Certificate::FORMAT_SINGLE_CERTIFICATE,
{
- &google_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ nullptr,
}},
// DER parsing - single certificate, PEM encoded
{"google.single.pem",
X509Certificate::FORMAT_SINGLE_CERTIFICATE,
{
- &google_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ nullptr,
}},
// PEM parsing - single certificate, PEM encoded with a PEB of
// "CERTIFICATE"
{"google.single.pem",
X509Certificate::FORMAT_PEM_CERT_SEQUENCE,
{
- &google_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ nullptr,
}},
// PEM parsing - sequence of certificates, PEM encoded with a PEB of
// "CERTIFICATE"
{"google.chain.pem",
X509Certificate::FORMAT_PEM_CERT_SEQUENCE,
{
- &google_parse_fingerprint, &thawte_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ &thawte_parse_fingerprint,
+ nullptr,
}},
// PKCS#7 parsing - "degenerate" SignedData collection of certificates, DER
// encoding
{"google.binary.p7b",
X509Certificate::FORMAT_PKCS7,
{
- &google_parse_fingerprint, &thawte_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ &thawte_parse_fingerprint,
+ nullptr,
}},
// PKCS#7 parsing - "degenerate" SignedData collection of certificates, PEM
// encoded with a PEM PEB of "CERTIFICATE"
{"google.pem_cert.p7b",
X509Certificate::FORMAT_PKCS7,
{
- &google_parse_fingerprint, &thawte_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ &thawte_parse_fingerprint,
+ nullptr,
}},
// PKCS#7 parsing - "degenerate" SignedData collection of certificates, PEM
// encoded with a PEM PEB of "PKCS7"
{"google.pem_pkcs7.p7b",
X509Certificate::FORMAT_PKCS7,
{
- &google_parse_fingerprint, &thawte_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ &thawte_parse_fingerprint,
+ nullptr,
}},
// All of the above, this time using auto-detection
{"google.single.der",
X509Certificate::FORMAT_AUTO,
{
- &google_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ nullptr,
}},
{"google.single.pem",
X509Certificate::FORMAT_AUTO,
{
- &google_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ nullptr,
}},
{"google.chain.pem",
X509Certificate::FORMAT_AUTO,
{
- &google_parse_fingerprint, &thawte_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ &thawte_parse_fingerprint,
+ nullptr,
}},
{"google.binary.p7b",
X509Certificate::FORMAT_AUTO,
{
- &google_parse_fingerprint, &thawte_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ &thawte_parse_fingerprint,
+ nullptr,
}},
{"google.pem_cert.p7b",
X509Certificate::FORMAT_AUTO,
{
- &google_parse_fingerprint, &thawte_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ &thawte_parse_fingerprint,
+ nullptr,
}},
{"google.pem_pkcs7.p7b",
X509Certificate::FORMAT_AUTO,
{
- &google_parse_fingerprint, &thawte_parse_fingerprint, NULL,
+ &google_parse_fingerprint,
+ &thawte_parse_fingerprint,
+ nullptr,
}},
};
diff --git a/net/cert/x509_util_win.cc b/net/cert/x509_util_win.cc
index 827ab4d8..f28a007 100644
--- a/net/cert/x509_util_win.cc
+++ b/net/cert/x509_util_win.cc
@@ -71,7 +71,7 @@
// PCCERT_CONTEXT, and will not be freed until the PCCERT_CONTEXT is freed.
ScopedHCERTSTORE store(
CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL,
- CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL));
+ CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, nullptr));
if (!store.get())
return nullptr;
@@ -89,7 +89,7 @@
ok = CertAddEncodedCertificateToStore(
store.get(), X509_ASN_ENCODING, CRYPTO_BUFFER_data(intermediate.get()),
base::checked_cast<DWORD>(CRYPTO_BUFFER_len(intermediate.get())),
- CERT_STORE_ADD_ALWAYS, NULL);
+ CERT_STORE_ADD_ALWAYS, nullptr);
if (!ok) {
if (invalid_intermediate_behavior == InvalidIntermediateBehavior::kFail)
return nullptr;
@@ -103,7 +103,7 @@
}
SHA256HashValue CalculateFingerprint256(PCCERT_CONTEXT cert) {
- DCHECK(NULL != cert->pbCertEncoded);
+ DCHECK(nullptr != cert->pbCertEncoded);
DCHECK_NE(0u, cert->cbCertEncoded);
SHA256HashValue sha256;
@@ -123,7 +123,8 @@
NULL, X509_ASN_ENCODING, CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT,
reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)),
CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT,
- reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), 0, NULL);
+ reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), 0,
+ nullptr);
if (!valid_signature)
return false;
return !!CertCompareCertificateName(X509_ASN_ENCODING,
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index 4fa8571..83f285e 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -611,7 +611,7 @@
// Note that this does not prune cookies to be below our limits (if we've
// exceeded them) the way that calling GarbageCollect() would.
GarbageCollectExpired(
- Time::Now(), CookieMapItPair(cookies_.begin(), cookies_.end()), NULL);
+ Time::Now(), CookieMapItPair(cookies_.begin(), cookies_.end()), nullptr);
// Copy the CanonicalCookie pointers from the map so that we can use the same
// sorter as elsewhere, then copy the result out.
diff --git a/net/cookies/cookie_store_test_callbacks.cc b/net/cookies/cookie_store_test_callbacks.cc
index 58a9c25..0cc18870 100644
--- a/net/cookies/cookie_store_test_callbacks.cc
+++ b/net/cookies/cookie_store_test_callbacks.cc
@@ -17,7 +17,7 @@
: run_in_thread_(run_in_thread) {}
CookieCallback::CookieCallback()
- : run_in_thread_(NULL),
+ : run_in_thread_(nullptr),
run_in_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
CookieCallback::~CookieCallback() = default;
diff --git a/net/cookies/parsed_cookie.cc b/net/cookies/parsed_cookie.cc
index 9cc4c82..ce7f8b6 100644
--- a/net/cookies/parsed_cookie.cc
+++ b/net/cookies/parsed_cookie.cc
@@ -69,7 +69,7 @@
// Returns true if |c| occurs in |chars|
// TODO(erikwright): maybe make this take an iterator, could check for end also?
inline bool CharIsA(const char c, const char* chars) {
- return strchr(chars, c) != NULL;
+ return strchr(chars, c) != nullptr;
}
// Seek the iterator to the first occurrence of a character in |chars|.
// Returns true if it hit the end, false otherwise.
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 417123de..824dea7 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -89,7 +89,7 @@
if (cb.GetResult(rv) != net::OK)
return std::unique_ptr<disk_cache::BackendImpl>();
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
rv = cache->CreateEntry(kExistingEntryKey, net::HIGHEST, &entry,
cb.callback());
if (cb.GetResult(rv) != net::OK)
@@ -242,9 +242,9 @@
// This must be greater than MemEntryImpl::kMaxSparseEntrySize.
const int kOffset = 10 + 1024 * 1024;
- disk_cache::Entry* entry0 = NULL;
- disk_cache::Entry* entry1 = NULL;
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry0 = nullptr;
+ disk_cache::Entry* entry1 = nullptr;
+ disk_cache::Entry* entry2 = nullptr;
scoped_refptr<net::IOBuffer> buffer =
base::MakeRefCounted<net::IOBuffer>(kSize);
@@ -282,8 +282,8 @@
// Order in rankings list:
// third_part1, fourth_part1, third_part2, fourth_part2
- disk_cache::Entry* entry3 = NULL;
- disk_cache::Entry* entry4 = NULL;
+ disk_cache::Entry* entry3 = nullptr;
+ disk_cache::Entry* entry4 = nullptr;
ASSERT_THAT(CreateEntry("third", &entry3), IsOk());
ASSERT_EQ(kSize, WriteSparseData(entry3, 0, buffer.get(), kSize));
ASSERT_THAT(CreateEntry("fourth", &entry4), IsOk());
@@ -365,29 +365,29 @@
void DiskCacheBackendTest::BackendBasics() {
InitCache();
- disk_cache::Entry *entry1 = NULL, *entry2 = NULL;
+ disk_cache::Entry *entry1 = nullptr, *entry2 = nullptr;
EXPECT_NE(net::OK, OpenEntry("the first key", &entry1));
ASSERT_THAT(CreateEntry("the first key", &entry1), IsOk());
- ASSERT_TRUE(NULL != entry1);
+ ASSERT_TRUE(nullptr != entry1);
entry1->Close();
- entry1 = NULL;
+ entry1 = nullptr;
ASSERT_THAT(OpenEntry("the first key", &entry1), IsOk());
- ASSERT_TRUE(NULL != entry1);
+ ASSERT_TRUE(nullptr != entry1);
entry1->Close();
- entry1 = NULL;
+ entry1 = nullptr;
EXPECT_NE(net::OK, CreateEntry("the first key", &entry1));
ASSERT_THAT(OpenEntry("the first key", &entry1), IsOk());
EXPECT_NE(net::OK, OpenEntry("some other key", &entry2));
ASSERT_THAT(CreateEntry("some other key", &entry2), IsOk());
- ASSERT_TRUE(NULL != entry1);
- ASSERT_TRUE(NULL != entry2);
+ ASSERT_TRUE(nullptr != entry1);
+ ASSERT_TRUE(nullptr != entry2);
EXPECT_EQ(2, cache_->GetEntryCount());
- disk_cache::Entry* entry3 = NULL;
+ disk_cache::Entry* entry3 = nullptr;
ASSERT_THAT(OpenEntry("some other key", &entry3), IsOk());
- ASSERT_TRUE(NULL != entry3);
+ ASSERT_TRUE(nullptr != entry3);
EXPECT_TRUE(entry2 == entry3);
EXPECT_THAT(DoomEntry("some other key"), IsOk());
@@ -505,21 +505,21 @@
// Test the private factory method(s).
std::unique_ptr<disk_cache::Backend> cache;
- cache = disk_cache::MemBackendImpl::CreateBackend(0, NULL);
+ cache = disk_cache::MemBackendImpl::CreateBackend(0, nullptr);
ASSERT_TRUE(cache.get());
cache.reset();
// Now test the public API.
int rv = disk_cache::CreateCacheBackend(
net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, cache_path_, 0, false,
- NULL, &cache, cb.callback());
+ nullptr, &cache, cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
ASSERT_TRUE(cache.get());
cache.reset();
rv = disk_cache::CreateCacheBackend(
net::MEMORY_CACHE, net::CACHE_BACKEND_DEFAULT, base::FilePath(), 0,
- false, NULL, &cache, cb.callback());
+ false, nullptr, &cache, cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
ASSERT_TRUE(cache.get());
cache.reset();
@@ -925,7 +925,7 @@
net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, store.GetPath(), 0, false,
/* net_log = */ nullptr, &extra_cache, cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
- ASSERT_TRUE(extra_cache.get() != NULL);
+ ASSERT_TRUE(extra_cache.get() != nullptr);
ASSERT_TRUE(CleanupCacheDir());
SetNewEviction(); // Match the expected behavior for integrity verification.
@@ -1634,7 +1634,7 @@
Time last_modified[kNumEntries];
Time last_used[kNumEntries];
while (iter->OpenNextEntry(&entry) == net::OK) {
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
if (count < kNumEntries) {
last_modified[count] = entry->GetLastModified();
last_used[count] = entry->GetLastUsed();
@@ -1651,7 +1651,7 @@
count = 0;
// The previous enumeration should not have changed the timestamps.
while (iter->OpenNextEntry(&entry) == net::OK) {
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
if (count < kNumEntries) {
EXPECT_TRUE(last_modified[count] == entry->GetLastModified());
EXPECT_TRUE(last_used[count] == entry->GetLastUsed());
@@ -1717,7 +1717,7 @@
// Modify the oldest entry and get the newest element.
ASSERT_THAT(OpenEntry(first, &entry1), IsOk());
- EXPECT_EQ(0, WriteData(entry1, 0, 200, NULL, 0, false));
+ EXPECT_EQ(0, WriteData(entry1, 0, 200, nullptr, 0, false));
ASSERT_THAT(iter->OpenNextEntry(&entry2), IsOk());
if (type_ == net::APP_CACHE) {
// The list is not updated.
@@ -1878,7 +1878,7 @@
std::unique_ptr<TestIterator> iter = CreateIterator();
int count = 0;
while (iter->OpenNextEntry(&entry) == net::OK) {
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
EXPECT_EQ(key2, entry->GetKey());
entry->Close();
count++;
@@ -1920,26 +1920,26 @@
std::unique_ptr<TestIterator> iter1 = CreateIterator(),
iter2 = CreateIterator();
ASSERT_THAT(iter1->OpenNextEntry(&entry1), IsOk());
- ASSERT_TRUE(NULL != entry1);
+ ASSERT_TRUE(nullptr != entry1);
entry1->Close();
- entry1 = NULL;
+ entry1 = nullptr;
// Let's go to the middle of the list.
for (int i = 0; i < kNumEntries / 2; i++) {
if (entry1)
entry1->Close();
ASSERT_THAT(iter1->OpenNextEntry(&entry1), IsOk());
- ASSERT_TRUE(NULL != entry1);
+ ASSERT_TRUE(nullptr != entry1);
ASSERT_THAT(iter2->OpenNextEntry(&entry2), IsOk());
- ASSERT_TRUE(NULL != entry2);
+ ASSERT_TRUE(nullptr != entry2);
entry2->Close();
}
// Messing up with entry1 will modify entry2->next.
entry1->Doom();
ASSERT_THAT(iter2->OpenNextEntry(&entry2), IsOk());
- ASSERT_TRUE(NULL != entry2);
+ ASSERT_TRUE(nullptr != entry2);
// The link entry2->entry1 should be broken.
EXPECT_NE(entry2->GetKey(), entry1->GetKey());
@@ -1948,7 +1948,7 @@
// And the second iterator should keep working.
ASSERT_THAT(iter2->OpenNextEntry(&entry2), IsOk());
- ASSERT_TRUE(NULL != entry2);
+ ASSERT_TRUE(nullptr != entry2);
entry2->Close();
}
@@ -2011,14 +2011,14 @@
TEST_F(DiskCacheBackendTest, MemoryOnlyDoomEntriesSinceSparse) {
SetMemoryOnlyMode();
base::Time start;
- InitSparseCache(&start, NULL);
+ InitSparseCache(&start, nullptr);
DoomEntriesSince(start);
EXPECT_EQ(1, cache_->GetEntryCount());
}
TEST_F(DiskCacheBackendTest, DoomEntriesSinceSparse) {
base::Time start;
- InitSparseCache(&start, NULL);
+ InitSparseCache(&start, nullptr);
DoomEntriesSince(start);
// NOTE: BackendImpl counts child entries in its GetEntryCount(), while
// MemBackendImpl does not. Thats why expected value differs here from
@@ -2028,13 +2028,13 @@
TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAllSparse) {
SetMemoryOnlyMode();
- InitSparseCache(NULL, NULL);
+ InitSparseCache(nullptr, nullptr);
EXPECT_THAT(DoomAllEntries(), IsOk());
EXPECT_EQ(0, cache_->GetEntryCount());
}
TEST_F(DiskCacheBackendTest, DoomAllSparse) {
- InitSparseCache(NULL, NULL);
+ InitSparseCache(nullptr, nullptr);
EXPECT_THAT(DoomAllEntries(), IsOk());
EXPECT_EQ(0, cache_->GetEntryCount());
}
@@ -2346,7 +2346,7 @@
}
cache_.reset();
- cache_impl_ = NULL;
+ cache_impl_ = nullptr;
ASSERT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, MaxSize(), mask));
success_ = true;
@@ -2500,8 +2500,8 @@
net::TestCompletionCallback cb;
std::unique_ptr<disk_cache::Backend> base_cache;
int rv = disk_cache::CreateCacheBackend(
- net::DISK_CACHE, net::CACHE_BACKEND_BLOCKFILE, cache_path_, 0, true, NULL,
- &base_cache, cb.callback());
+ net::DISK_CACHE, net::CACHE_BACKEND_BLOCKFILE, cache_path_, 0, true,
+ nullptr, &base_cache, cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
EXPECT_EQ(0, base_cache->GetEntryCount());
}
@@ -2531,7 +2531,7 @@
ASSERT_THAT(cb.GetResult(rv), IsOk());
EXPECT_EQ(1, cache->GetEntryCount());
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
rv = cache->OpenEntry(kExistingEntryKey, net::HIGHEST, &entry,
cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
@@ -2572,7 +2572,7 @@
ASSERT_THAT(cb.GetResult(rv), IsOk());
EXPECT_EQ(1, cache->GetEntryCount());
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
rv = cache->OpenEntry(kExistingEntryKey, net::HIGHEST, &entry,
cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
@@ -2592,9 +2592,9 @@
net::TestCompletionCallback cb;
bool prev = base::ThreadRestrictions::SetIOAllowed(false);
base::FilePath path(cache_path_);
- int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE,
- net::CACHE_BACKEND_BLOCKFILE, path, 0,
- true, NULL, &cache_, cb.callback());
+ int rv = disk_cache::CreateCacheBackend(
+ net::DISK_CACHE, net::CACHE_BACKEND_BLOCKFILE, path, 0, true, nullptr,
+ &cache_, cb.callback());
path.clear(); // Make sure path was captured by the previous call.
ASSERT_THAT(cb.GetResult(rv), IsOk());
base::ThreadRestrictions::SetIOAllowed(prev);
@@ -2921,7 +2921,7 @@
ASSERT_THAT(CreateEntry(first, &entry), IsOk());
entry->Close();
ASSERT_THAT(OpenEntry(first, &entry), IsOk());
- EXPECT_EQ(0, WriteData(entry, 0, 200, NULL, 0, false));
+ EXPECT_EQ(0, WriteData(entry, 0, 200, nullptr, 0, false));
entry->Close();
ASSERT_THAT(CreateEntry(second, &entry), IsOk());
@@ -2984,12 +2984,12 @@
ASSERT_THAT(CreateEntry(first, &entry), IsOk());
entry->Close();
ASSERT_THAT(OpenEntry(first, &entry), IsOk());
- EXPECT_EQ(0, WriteData(entry, 0, 200, NULL, 0, false));
+ EXPECT_EQ(0, WriteData(entry, 0, 200, nullptr, 0, false));
entry->Close();
ASSERT_THAT(CreateEntry(second, &entry), IsOk());
entry->Close();
ASSERT_THAT(OpenEntry(second, &entry), IsOk());
- EXPECT_EQ(0, WriteData(entry, 0, 200, NULL, 0, false));
+ EXPECT_EQ(0, WriteData(entry, 0, 200, nullptr, 0, false));
// Corrupt this entry.
disk_cache::EntryImpl* entry_impl =
@@ -3206,7 +3206,7 @@
std::unique_ptr<TestIterator> iter = CreateIterator();
int count = 0;
while (iter->OpenNextEntry(&entry) == net::OK) {
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
entry->Close();
count++;
ASSERT_LT(count, 9);
@@ -3413,7 +3413,7 @@
std::string key_prefix("prefix");
for (int i = 0; i < kWriteEntryCount; ++i) {
AddDelay();
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key_prefix + base::NumberToString(i), &entry),
IsOk());
disk_cache::ScopedEntryPtr entry_closer(entry);
@@ -3527,7 +3527,7 @@
std::unique_ptr<disk_cache::BackendImpl> cache(
std::make_unique<disk_cache::BackendImpl>(
cache_path_, nullptr, base::ThreadTaskRunnerHandle::Get(), nullptr));
- ASSERT_TRUE(NULL != cache.get());
+ ASSERT_TRUE(nullptr != cache.get());
cache->SetUnitTestMode();
ASSERT_THAT(cache->SyncInit(), IsOk());
@@ -3543,11 +3543,11 @@
std::unique_ptr<disk_cache::BackendImpl> cache(
std::make_unique<disk_cache::BackendImpl>(
cache_path_, nullptr, base::ThreadTaskRunnerHandle::Get(), nullptr));
- ASSERT_TRUE(NULL != cache.get());
+ ASSERT_TRUE(nullptr != cache.get());
cache->SetUnitTestMode();
ASSERT_NE(net::OK, cache->SyncInit());
- ASSERT_TRUE(NULL == cache->GetTimerForTest());
+ ASSERT_TRUE(nullptr == cache->GetTimerForTest());
DisableIntegrityCheck();
}
@@ -3700,7 +3700,7 @@
nullptr, &cache[1], cb.callback());
ASSERT_THAT(cb.GetResult(rv), IsOk());
- ASSERT_TRUE(cache[0].get() != NULL && cache[1].get() != NULL);
+ ASSERT_TRUE(cache[0].get() != nullptr && cache[1].get() != nullptr);
std::string key("the first key");
disk_cache::Entry* entry;
@@ -3846,13 +3846,13 @@
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
DWORD access = GENERIC_READ | GENERIC_WRITE;
base::win::ScopedHandle file2(CreateFile(base::as_wcstr(name.value()), access,
- sharing, NULL, OPEN_EXISTING, 0,
- NULL));
+ sharing, nullptr, OPEN_EXISTING, 0,
+ nullptr));
EXPECT_FALSE(file2.IsValid());
sharing |= FILE_SHARE_DELETE;
- file2.Set(CreateFile(base::as_wcstr(name.value()), access, sharing, NULL,
- OPEN_EXISTING, 0, NULL));
+ file2.Set(CreateFile(base::as_wcstr(name.value()), access, sharing, nullptr,
+ OPEN_EXISTING, 0, nullptr));
EXPECT_TRUE(file2.IsValid());
#endif
@@ -3998,19 +3998,19 @@
InitCache();
const char key[] = "the first key";
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
- ASSERT_TRUE(entry != NULL);
+ ASSERT_TRUE(entry != nullptr);
entry->Close();
- entry = NULL;
+ entry = nullptr;
// To make sure the file creation completed we need to call open again so that
// we block until it actually created the files.
ASSERT_THAT(OpenEntry(key, &entry), IsOk());
- ASSERT_TRUE(entry != NULL);
+ ASSERT_TRUE(entry != nullptr);
entry->Close();
- entry = NULL;
+ entry = nullptr;
// Delete one of the files in the entry.
base::FilePath to_delete_file = cache_path_.AppendASCII(
@@ -4034,20 +4034,20 @@
InitCache();
const char key[] = "the first key";
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
ASSERT_NE(null, entry);
entry->Close();
- entry = NULL;
+ entry = nullptr;
// To make sure the file creation completed we need to call open again so that
// we block until it actually created the files.
ASSERT_THAT(OpenEntry(key, &entry), IsOk());
ASSERT_NE(null, entry);
entry->Close();
- entry = NULL;
+ entry = nullptr;
// The entry is being closed on the Simple Cache worker pool
disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting();
@@ -4234,7 +4234,7 @@
ASSERT_TRUE(CreateSetOfRandomEntries(&key_pool));
std::unique_ptr<TestIterator> iter = CreateIterator();
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(iter->OpenNextEntry(&entry), IsOk());
EXPECT_TRUE(entry);
disk_cache::ScopedEntryPtr entry_closer(entry);
@@ -4436,7 +4436,7 @@
disk_cache::SimpleSynchronousEntry::kInitialHeaderRead + 10;
std::string long_key(long_key_length, 'X');
key_pool.insert(long_key);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(long_key.c_str(), &entry), IsOk());
entry->Close();
diff --git a/net/disk_cache/blockfile/backend_impl.cc b/net/disk_cache/blockfile/backend_impl.cc
index bcb65ee..a7e54f9 100644
--- a/net/disk_cache/blockfile/backend_impl.cc
+++ b/net/disk_cache/blockfile/backend_impl.cc
@@ -364,7 +364,7 @@
}
block_files_.CloseFiles();
FlushIndex();
- index_ = NULL;
+ index_ = nullptr;
ptr_factory_.InvalidateWeakPtrs();
done_.Signal();
}
@@ -441,7 +441,7 @@
node->GetLastUsed() < end_time) {
node->DoomImpl();
} else if (node->GetLastUsed() < initial_time) {
- next = NULL;
+ next = nullptr;
SyncEndEnumeration(std::move(iterator));
}
}
@@ -509,7 +509,7 @@
scoped_refptr<EntryImpl> BackendImpl::OpenEntryImpl(const std::string& key) {
if (disabled_)
- return NULL;
+ return nullptr;
TimeTicks start = TimeTicks::Now();
uint32_t hash = base::Hash(key);
@@ -520,7 +520,7 @@
MatchEntry(key, hash, false, Addr(), &error);
if (cache_entry && ENTRY_NORMAL != cache_entry->entry()->Data()->state) {
// The entry was already evicted.
- cache_entry = NULL;
+ cache_entry = nullptr;
web_fonts_histogram::RecordEvictedEntry(key);
} else if (!cache_entry) {
web_fonts_histogram::RecordCacheMiss(key);
@@ -533,7 +533,7 @@
if (!cache_entry) {
stats_.OnEvent(Stats::OPEN_MISS);
- return NULL;
+ return nullptr;
}
eviction_.OnOpenEntry(cache_entry.get());
@@ -554,7 +554,7 @@
scoped_refptr<EntryImpl> BackendImpl::CreateEntryImpl(const std::string& key) {
if (disabled_ || key.empty())
- return NULL;
+ return nullptr;
TimeTicks start = TimeTicks::Now();
uint32_t hash = base::Hash(key);
@@ -576,7 +576,7 @@
if (!parent && data_->table[hash & mask_]) {
// We should have corrected the problem.
NOTREACHED();
- return NULL;
+ return nullptr;
}
}
@@ -597,7 +597,7 @@
if (!block_files_.CreateBlock(BLOCK_256, num_blocks, &entry_address)) {
LOG(ERROR) << "Create entry failed " << key.c_str();
stats_.OnEvent(Stats::CREATE_ERROR);
- return NULL;
+ return nullptr;
}
Addr node_address(0);
@@ -605,7 +605,7 @@
block_files_.DeleteBlock(entry_address, false);
LOG(ERROR) << "Create entry failed " << key.c_str();
stats_.OnEvent(Stats::CREATE_ERROR);
- return NULL;
+ return nullptr;
}
scoped_refptr<EntryImpl> cache_entry(
@@ -617,7 +617,7 @@
block_files_.DeleteBlock(node_address, false);
LOG(ERROR) << "Create entry failed " << key.c_str();
stats_.OnEvent(Stats::CREATE_ERROR);
- return NULL;
+ return nullptr;
}
cache_entry->BeginLogging(net_log_, true);
@@ -651,7 +651,7 @@
scoped_refptr<EntryImpl> BackendImpl::OpenNextEntryImpl(
Rankings::Iterator* iterator) {
if (disabled_)
- return NULL;
+ return nullptr;
const int kListsToSearch = 3;
scoped_refptr<EntryImpl> entries[kListsToSearch];
@@ -666,7 +666,7 @@
}
if (!ret) {
iterator->Reset();
- return NULL;
+ return nullptr;
}
} else {
// Get the next entry from the last list, and the actual entries for the
@@ -702,7 +702,7 @@
if (newest < 0 || oldest < 0) {
iterator->Reset();
- return NULL;
+ return nullptr;
}
scoped_refptr<EntryImpl> next_entry = entries[newest];
@@ -747,7 +747,7 @@
MappedFile* BackendImpl::File(Addr address) {
if (disabled_)
- return NULL;
+ return nullptr;
return block_files_.GetFile(address);
}
@@ -935,7 +935,7 @@
return it->second;
}
- return NULL;
+ return nullptr;
}
int32_t BackendImpl::GetCurrentEntryId() const {
@@ -1434,7 +1434,7 @@
if (*file_created)
ret = CreateBackingStore(file.get());
- file = NULL;
+ file = nullptr;
if (!ret)
return false;
@@ -1496,7 +1496,7 @@
return false;
data_->header.stats = address.value();
- return stats_.Init(NULL, 0, address);
+ return stats_.Init(nullptr, 0, address);
}
if (!address.is_block_file()) {
@@ -1579,8 +1579,8 @@
disabled_ = true;
data_->header.crash = 0;
index_->Flush();
- index_ = NULL;
- data_ = NULL;
+ index_ = nullptr;
+ data_ = nullptr;
block_files_.CloseFiles();
rankings_.Reset();
init_ = false;
@@ -1606,7 +1606,7 @@
scoped_refptr<EntryImpl> cache_entry(
new EntryImpl(this, address, read_only_));
IncreaseNumRefs();
- *entry = NULL;
+ *entry = nullptr;
TimeTicks start = TimeTicks::Now();
if (!cache_entry->entry()->Load())
@@ -1702,7 +1702,7 @@
if (parent_entry.get()) {
parent_entry->SetNextAddress(child);
- parent_entry = NULL;
+ parent_entry = nullptr;
} else {
data_->table[hash & mask_] = child.value();
}
@@ -1714,7 +1714,7 @@
// It is important to call DestroyInvalidEntry after removing this
// entry from the table.
DestroyInvalidEntry(cache_entry.get());
- cache_entry = NULL;
+ cache_entry = nullptr;
} else {
Trace("NewEntry failed on MatchEntry 0x%x", address.value());
}
@@ -1728,19 +1728,19 @@
DCHECK_EQ(hash & mask_, cache_entry->entry()->Data()->hash & mask_);
if (cache_entry->IsSameEntry(key, hash)) {
if (!cache_entry->Update())
- cache_entry = NULL;
+ cache_entry = nullptr;
found = true;
if (find_parent && entry_addr.value() != address.value()) {
Trace("Entry not on the index 0x%x", address.value());
*match_error = true;
- parent_entry = NULL;
+ parent_entry = nullptr;
}
break;
}
if (!cache_entry->Update())
- cache_entry = NULL;
+ cache_entry = nullptr;
parent_entry = cache_entry;
- cache_entry = NULL;
+ cache_entry = nullptr;
if (!parent_entry.get())
break;
@@ -1748,15 +1748,15 @@
}
if (parent_entry.get() && (!find_parent || !found))
- parent_entry = NULL;
+ parent_entry = nullptr;
if (find_parent && entry_addr.is_initialized() && !cache_entry.get()) {
*match_error = true;
- parent_entry = NULL;
+ parent_entry = nullptr;
}
if (cache_entry.get() && (find_parent || !found))
- cache_entry = NULL;
+ cache_entry = nullptr;
FlushIndex();
@@ -1776,7 +1776,7 @@
Rankings::ScopedRankingsBlock rankings(&rankings_, *from_entry);
CacheRankingsBlock* next_block = rankings_.GetNext(rankings.get(), list);
Rankings::ScopedRankingsBlock next(&rankings_, next_block);
- *from_entry = NULL;
+ *from_entry = nullptr;
*next_entry = GetEnumeratedEntry(next.get(), list);
if (!*next_entry)
@@ -1790,7 +1790,7 @@
CacheRankingsBlock* next,
Rankings::List list) {
if (!next || disabled_)
- return NULL;
+ return nullptr;
scoped_refptr<EntryImpl> entry;
int rv = NewEntry(Addr(next->Data()->contents), &entry);
@@ -1801,18 +1801,18 @@
// There is nothing linked from the index. Delete the rankings node.
DeleteBlock(next->address(), true);
}
- return NULL;
+ return nullptr;
}
if (entry->dirty()) {
// We cannot trust this entry.
InternalDoomEntry(entry.get());
- return NULL;
+ return nullptr;
}
if (!entry->Update()) {
STRESS_NOTREACHED();
- return NULL;
+ return nullptr;
}
// Note that it is unfortunate (but possible) for this entry to be clean, but
@@ -1835,7 +1835,7 @@
deleted_entry = nullptr;
stats_.OnEvent(Stats::CREATE_MISS);
Trace("create entry miss ");
- return NULL;
+ return nullptr;
}
// We are attempting to create an entry and found out that the entry was
diff --git a/net/disk_cache/blockfile/bitmap.h b/net/disk_cache/blockfile/bitmap.h
index 59a987a..bc9af80 100644
--- a/net/disk_cache/blockfile/bitmap.h
+++ b/net/disk_cache/blockfile/bitmap.h
@@ -16,7 +16,7 @@
// This class provides support for simple maps of bits.
class NET_EXPORT_PRIVATE Bitmap {
public:
- Bitmap() : map_(NULL), num_bits_(0), array_size_(0), alloc_(false) {}
+ Bitmap() : map_(nullptr), num_bits_(0), array_size_(0), alloc_(false) {}
// This constructor will allocate on a uint32_t boundary. If |clear_bits| is
// false, the bitmap bits will not be initialized.
diff --git a/net/disk_cache/blockfile/bitmap_unittest.cc b/net/disk_cache/blockfile/bitmap_unittest.cc
index 29d8739..c77aedf 100644
--- a/net/disk_cache/blockfile/bitmap_unittest.cc
+++ b/net/disk_cache/blockfile/bitmap_unittest.cc
@@ -19,7 +19,7 @@
disk_cache::Bitmap map;
EXPECT_EQ(0, map.Size());
EXPECT_EQ(0, map.ArraySize());
- EXPECT_TRUE(NULL == map.GetMap());
+ EXPECT_TRUE(nullptr == map.GetMap());
}
TEST(BitmapTest, Basics) {
diff --git a/net/disk_cache/blockfile/block_files.cc b/net/disk_cache/blockfile/block_files.cc
index eac68fb..f245308 100644
--- a/net/disk_cache/blockfile/block_files.cc
+++ b/net/disk_cache/blockfile/block_files.cc
@@ -39,8 +39,7 @@
namespace disk_cache {
-BlockHeader::BlockHeader() : header_(NULL) {
-}
+BlockHeader::BlockHeader() : header_(nullptr) {}
BlockHeader::BlockHeader(BlockFileHeader* header) : header_(header) {
}
@@ -262,8 +261,7 @@
// ------------------------------------------------------------------------
BlockFiles::BlockFiles(const base::FilePath& path)
- : init_(false), zero_buffer_(NULL), path_(path) {
-}
+ : init_(false), zero_buffer_(nullptr), path_(path) {}
BlockFiles::~BlockFiles() {
if (zero_buffer_)
@@ -302,14 +300,14 @@
static_cast<size_t>(kFirstAdditionalBlockFile));
DCHECK(address.is_block_file() || !address.is_initialized());
if (!address.is_initialized())
- return NULL;
+ return nullptr;
int file_index = address.FileNumber();
if (static_cast<unsigned int>(file_index) >= block_files_.size() ||
!block_files_[file_index]) {
// We need to open the file
if (!OpenBlockFile(file_index))
- return NULL;
+ return nullptr;
}
DCHECK_GE(block_files_.size(), static_cast<unsigned int>(file_index));
return block_files_[file_index].get();
@@ -551,13 +549,13 @@
if (kMaxBlocks == file_header.Header()->max_entries) {
file = NextFile(file);
if (!file)
- return NULL;
+ return nullptr;
file_header = BlockHeader(file);
continue;
}
if (!GrowBlockFile(file, file_header.Header()))
- return NULL;
+ return nullptr;
break;
}
LOCAL_HISTOGRAM_TIMES("DiskCache.GetFileForNewBlock",
@@ -578,7 +576,7 @@
new_file = CreateNextBlockFile(type);
if (!new_file)
- return NULL;
+ return nullptr;
FileLock lock(header);
header->next_file = new_file;
@@ -625,7 +623,7 @@
base::FilePath name = Name(file_index);
scoped_refptr<File> this_file(new File(false));
this_file->Init(name);
- block_files_[file_index] = NULL;
+ block_files_[file_index] = nullptr;
int failure = DeleteCacheFile(name) ? 0 : 1;
UMA_HISTOGRAM_COUNTS_1M("DiskCache.DeleteFailed2", failure);
diff --git a/net/disk_cache/blockfile/block_files_unittest.cc b/net/disk_cache/blockfile/block_files_unittest.cc
index ca1e019..b9572d1 100644
--- a/net/disk_cache/blockfile/block_files_unittest.cc
+++ b/net/disk_cache/blockfile/block_files_unittest.cc
@@ -115,11 +115,11 @@
Addr address(entries[kNumEntries / 2]);
MappedFile* file = files.GetFile(address);
- ASSERT_TRUE(NULL != file);
+ ASSERT_TRUE(nullptr != file);
BlockFileHeader* header =
reinterpret_cast<BlockFileHeader*>(file->buffer());
- ASSERT_TRUE(NULL != header);
+ ASSERT_TRUE(nullptr != header);
ASSERT_EQ(0, header->updating);
@@ -140,10 +140,10 @@
// The file must have been fixed.
file = files.GetFile(address);
- ASSERT_TRUE(NULL != file);
+ ASSERT_TRUE(nullptr != file);
header = reinterpret_cast<BlockFileHeader*>(file->buffer());
- ASSERT_TRUE(NULL != header);
+ ASSERT_TRUE(nullptr != header);
ASSERT_EQ(0, header->updating);
@@ -211,10 +211,10 @@
EXPECT_TRUE(files.CreateBlock(RANKINGS, 2, &address));
MappedFile* file = files.GetFile(address);
- ASSERT_TRUE(NULL != file);
+ ASSERT_TRUE(nullptr != file);
BlockFileHeader* header = reinterpret_cast<BlockFileHeader*>(file->buffer());
- ASSERT_TRUE(NULL != header);
+ ASSERT_TRUE(nullptr != header);
ASSERT_EQ(0, header->updating);
// Alter the counters so that the free space doesn't add up.
@@ -223,9 +223,9 @@
ASSERT_TRUE(files.Init(false));
file = files.GetFile(address);
- ASSERT_TRUE(NULL != file);
+ ASSERT_TRUE(nullptr != file);
header = reinterpret_cast<BlockFileHeader*>(file->buffer());
- ASSERT_TRUE(NULL != header);
+ ASSERT_TRUE(nullptr != header);
// The file must have been fixed.
ASSERT_EQ(0, header->empty[2]);
@@ -237,9 +237,9 @@
ASSERT_TRUE(files.Init(false));
file = files.GetFile(address);
- ASSERT_TRUE(NULL != file);
+ ASSERT_TRUE(nullptr != file);
header = reinterpret_cast<BlockFileHeader*>(file->buffer());
- ASSERT_TRUE(NULL != header);
+ ASSERT_TRUE(nullptr != header);
// The file must have been "fixed".
ASSERT_EQ(2, header->num_entries);
@@ -263,7 +263,7 @@
// Let's access block 10 of file 5. (There is no file).
Addr addr(BLOCK_256, 1, 5, 10);
- EXPECT_TRUE(NULL == files.GetFile(addr));
+ EXPECT_TRUE(nullptr == files.GetFile(addr));
// Let's create an invalid file.
base::FilePath filename(files.Name(5));
@@ -272,10 +272,10 @@
EXPECT_EQ(kBlockHeaderSize,
base::WriteFile(filename, header, kBlockHeaderSize));
- EXPECT_TRUE(NULL == files.GetFile(addr));
+ EXPECT_TRUE(nullptr == files.GetFile(addr));
// The file should not have been changed (it is still invalid).
- EXPECT_TRUE(NULL == files.GetFile(addr));
+ EXPECT_TRUE(nullptr == files.GetFile(addr));
}
// Tests that we generate the correct file stats.
diff --git a/net/disk_cache/blockfile/entry_impl.cc b/net/disk_cache/blockfile/entry_impl.cc
index 97dd597..dc96b82 100644
--- a/net/disk_cache/blockfile/entry_impl.cc
+++ b/net/disk_cache/blockfile/entry_impl.cc
@@ -75,7 +75,7 @@
disk_cache::CreateNetLogReadWriteCompleteCallback(bytes_copied));
}
entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_);
- buf_ = NULL; // Release the buffer before invoking the callback.
+ buf_ = nullptr; // Release the buffer before invoking the callback.
std::move(callback_).Run(bytes_copied);
}
delete this;
@@ -83,7 +83,7 @@
void SyncCallback::Discard() {
callback_.Reset();
- buf_ = NULL;
+ buf_ = nullptr;
OnFileIOComplete(0);
}
@@ -130,7 +130,7 @@
// Prepare this buffer for reuse.
void Reset();
- char* Data() { return buffer_.size() ? &buffer_[0] : NULL; }
+ char* Data() { return buffer_.size() ? &buffer_[0] : nullptr; }
int Size() { return static_cast<int>(buffer_.size()); }
int Start() { return offset_; }
int End() { return offset_ + Size(); }
@@ -302,8 +302,11 @@
// ------------------------------------------------------------------------
EntryImpl::EntryImpl(BackendImpl* backend, Addr address, bool read_only)
- : entry_(NULL, Addr(0)), node_(NULL, Addr(0)),
- backend_(backend->GetWeakPtr()), doomed_(false), read_only_(read_only),
+ : entry_(nullptr, Addr(0)),
+ node_(nullptr, Addr(0)),
+ backend_(backend->GetWeakPtr()),
+ doomed_(false),
+ read_only_(read_only),
dirty_(false) {
entry_.LazyInit(backend->File(address), address);
for (int i = 0; i < kNumStreams; i++) {
@@ -1070,7 +1073,7 @@
kBlockHeaderSize;
}
- SyncCallback* io_callback = NULL;
+ SyncCallback* io_callback = nullptr;
bool null_callback = callback.is_null();
if (!null_callback) {
io_callback =
@@ -1178,7 +1181,7 @@
if (!buf_len)
return 0;
- SyncCallback* io_callback = NULL;
+ SyncCallback* io_callback = nullptr;
bool null_callback = callback.is_null();
if (!null_callback) {
io_callback = new SyncCallback(this, buf, std::move(callback),
@@ -1257,7 +1260,7 @@
backend_->GetFileName(address).value() << " from the cache.";
}
if (files_[index].get())
- files_[index] = NULL; // Releases the object.
+ files_[index] = nullptr; // Releases the object.
} else {
backend_->DeleteBlock(address, true);
}
@@ -1282,7 +1285,7 @@
File* EntryImpl::GetBackingFile(Addr address, int index) {
if (!backend_.get())
- return NULL;
+ return nullptr;
File* file;
if (address.is_separate_file())
@@ -1410,7 +1413,7 @@
int len = std::min(entry_.Data()->data_size[index], kMaxBlockSize);
user_buffers_[index].reset(new UserBuffer(backend_.get()));
- user_buffers_[index]->Write(len, NULL, 0);
+ user_buffers_[index]->Write(len, nullptr, 0);
File* file = GetBackingFile(address, index);
int offset = 0;
@@ -1418,8 +1421,8 @@
if (address.is_block_file())
offset = address.start_block() * address.BlockSize() + kBlockHeaderSize;
- if (!file ||
- !file->Read(user_buffers_[index]->Data(), len, offset, NULL, NULL)) {
+ if (!file || !file->Read(user_buffers_[index]->Data(), len, offset, nullptr,
+ nullptr)) {
user_buffers_[index].reset();
return false;
}
@@ -1516,7 +1519,7 @@
if (!file)
return false;
- if (!file->Write(user_buffers_[index]->Data(), len, offset, NULL, NULL))
+ if (!file->Write(user_buffers_[index]->Data(), len, offset, nullptr, nullptr))
return false;
user_buffers_[index]->Reset();
@@ -1570,7 +1573,7 @@
// Bad news: we'd have to read the info from disk so instead we'll just tell
// the caller where to read from.
- *buffer = NULL;
+ *buffer = nullptr;
address->set_value(entry_.Data()->data_addr[index]);
if (address->is_initialized()) {
// Prevent us from deleting the block from the backing store.
diff --git a/net/disk_cache/blockfile/eviction.cc b/net/disk_cache/blockfile/eviction.cc
index be71609..2608c7a 100644
--- a/net/disk_cache/blockfile/eviction.cc
+++ b/net/disk_cache/blockfile/eviction.cc
@@ -79,11 +79,7 @@
// The real initialization happens during Init(), init_ is the only member that
// has to be initialized here.
-Eviction::Eviction()
- : backend_(NULL),
- init_(false),
- ptr_factory_(this) {
-}
+Eviction::Eviction() : backend_(nullptr), init_(false), ptr_factory_(this) {}
Eviction::~Eviction() = default;
@@ -331,7 +327,7 @@
next[i].set_rankings(rankings_);
if (done)
continue;
- next[i].reset(rankings_->GetPrev(NULL, static_cast<Rankings::List>(i)));
+ next[i].reset(rankings_->GetPrev(nullptr, static_cast<Rankings::List>(i)));
if (!empty && NodeIsOldEnough(next[i].get(), i)) {
list = static_cast<Rankings::List>(i);
done = true;
@@ -577,14 +573,14 @@
if (!new_eviction_)
return;
- Rankings::ScopedRankingsBlock last1(rankings_,
- rankings_->GetPrev(NULL, Rankings::NO_USE));
- Rankings::ScopedRankingsBlock last2(rankings_,
- rankings_->GetPrev(NULL, Rankings::LOW_USE));
- Rankings::ScopedRankingsBlock last3(rankings_,
- rankings_->GetPrev(NULL, Rankings::HIGH_USE));
- Rankings::ScopedRankingsBlock last4(rankings_,
- rankings_->GetPrev(NULL, Rankings::DELETED));
+ Rankings::ScopedRankingsBlock last1(
+ rankings_, rankings_->GetPrev(nullptr, Rankings::NO_USE));
+ Rankings::ScopedRankingsBlock last2(
+ rankings_, rankings_->GetPrev(nullptr, Rankings::LOW_USE));
+ Rankings::ScopedRankingsBlock last3(
+ rankings_, rankings_->GetPrev(nullptr, Rankings::HIGH_USE));
+ Rankings::ScopedRankingsBlock last4(
+ rankings_, rankings_->GetPrev(nullptr, Rankings::DELETED));
if (last1.get())
CACHE_UMA(AGE, "NoUseAge", 0,
diff --git a/net/disk_cache/blockfile/file_win.cc b/net/disk_cache/blockfile/file_win.cc
index 1bf43d1..2225c16d 100644
--- a/net/disk_cache/blockfile/file_win.cc
+++ b/net/disk_cache/blockfile/file_win.cc
@@ -115,9 +115,9 @@
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
DWORD access = GENERIC_READ | GENERIC_WRITE | DELETE;
- base_file_ =
- base::File(CreateFile(base::as_wcstr(name.value()), access, sharing, NULL,
- OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL));
+ base_file_ = base::File(CreateFile(base::as_wcstr(name.value()), access,
+ sharing, nullptr, OPEN_EXISTING,
+ FILE_FLAG_OVERLAPPED, nullptr));
if (!base_file_.IsValid())
return false;
@@ -127,8 +127,8 @@
init_ = true;
sync_base_file_ =
- base::File(CreateFile(base::as_wcstr(name.value()), access, sharing, NULL,
- OPEN_EXISTING, 0, NULL));
+ base::File(CreateFile(base::as_wcstr(name.value()), access, sharing,
+ nullptr, OPEN_EXISTING, 0, nullptr));
if (!sync_base_file_.IsValid())
return false;
@@ -193,8 +193,8 @@
// The operation completed already. We'll be called back anyway.
*completed = (actual == size);
DCHECK_EQ(size, actual);
- data->callback_ = NULL;
- data->file_ = NULL; // There is no reason to hold on to this anymore.
+ data->callback_ = nullptr;
+ data->file_ = nullptr; // There is no reason to hold on to this anymore.
return *completed;
}
@@ -243,8 +243,8 @@
// The operation completed already. We'll be called back anyway.
*completed = (actual == size);
DCHECK_EQ(size, actual);
- data->callback_ = NULL;
- data->file_ = NULL; // There is no reason to hold on to this anymore.
+ data->callback_ = nullptr;
+ data->file_ = nullptr; // There is no reason to hold on to this anymore.
return *completed;
}
@@ -255,7 +255,8 @@
DWORD size = static_cast<DWORD>(length);
HANDLE file = platform_file();
- if (INVALID_SET_FILE_POINTER == SetFilePointer(file, size, NULL, FILE_BEGIN))
+ if (INVALID_SET_FILE_POINTER ==
+ SetFilePointer(file, size, nullptr, FILE_BEGIN))
return false;
return TRUE == SetEndOfFile(file);
diff --git a/net/disk_cache/blockfile/in_flight_backend_io.cc b/net/disk_cache/blockfile/in_flight_backend_io.cc
index 552b8416..32895a5 100644
--- a/net/disk_cache/blockfile/in_flight_backend_io.cc
+++ b/net/disk_cache/blockfile/in_flight_backend_io.cc
@@ -41,16 +41,16 @@
backend_(backend),
callback_(std::move(callback)),
operation_(OP_NONE),
- entry_ptr_(NULL),
- entry_with_opened_ptr_(NULL),
- iterator_(NULL),
- entry_(NULL),
+ entry_ptr_(nullptr),
+ entry_with_opened_ptr_(nullptr),
+ iterator_(nullptr),
+ entry_(nullptr),
index_(0),
offset_(0),
buf_len_(0),
truncate_(false),
offset64_(0),
- start_(NULL) {
+ start_(nullptr) {
start_time_ = base::TimeTicks::Now();
}
@@ -388,7 +388,7 @@
NOTREACHED() << "Invalid Operation";
result_ = net::ERR_UNEXPECTED;
}
- buf_ = NULL;
+ buf_ = nullptr;
if (result_ != net::ERR_IO_PENDING)
NotifyController();
}
diff --git a/net/disk_cache/blockfile/in_flight_io.cc b/net/disk_cache/blockfile/in_flight_io.cc
index e32a6b49..893108d 100644
--- a/net/disk_cache/blockfile/in_flight_io.cc
+++ b/net/disk_cache/blockfile/in_flight_io.cc
@@ -29,7 +29,7 @@
// controller_ may be in use from the background thread at this time.
base::AutoLock lock(controller_lock_);
DCHECK(controller_);
- controller_ = NULL;
+ controller_ = nullptr;
}
BackgroundIO::~BackgroundIO() = default;
diff --git a/net/disk_cache/blockfile/mapped_file_win.cc b/net/disk_cache/blockfile/mapped_file_win.cc
index 706ae09..1490212 100644
--- a/net/disk_cache/blockfile/mapped_file_win.cc
+++ b/net/disk_cache/blockfile/mapped_file_win.cc
@@ -17,14 +17,14 @@
void* MappedFile::Init(const base::FilePath& name, size_t size) {
DCHECK(!init_);
if (init_ || !File::Init(name))
- return NULL;
+ return nullptr;
- buffer_ = NULL;
+ buffer_ = nullptr;
init_ = true;
- section_ = CreateFileMapping(platform_file(), NULL, PAGE_READWRITE, 0,
- static_cast<DWORD>(size), NULL);
+ section_ = CreateFileMapping(platform_file(), nullptr, PAGE_READWRITE, 0,
+ static_cast<DWORD>(size), nullptr);
if (!section_)
- return NULL;
+ return nullptr;
buffer_ = MapViewOfFile(section_, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, size);
DCHECK(buffer_);
@@ -34,7 +34,7 @@
size_t temp_len = size ? size : 4096;
std::unique_ptr<char[]> temp(new char[temp_len]);
if (!Read(temp.get(), temp_len, 0))
- return NULL;
+ return nullptr;
return buffer_;
}
diff --git a/net/disk_cache/blockfile/rankings.cc b/net/disk_cache/blockfile/rankings.cc
index 6ce0438..978b8d9 100644
--- a/net/disk_cache/blockfile/rankings.cc
+++ b/net/disk_cache/blockfile/rankings.cc
@@ -192,7 +192,7 @@
namespace disk_cache {
-Rankings::ScopedRankingsBlock::ScopedRankingsBlock() : rankings_(NULL) {}
+Rankings::ScopedRankingsBlock::ScopedRankingsBlock() : rankings_(nullptr) {}
Rankings::ScopedRankingsBlock::ScopedRankingsBlock(Rankings* rankings)
: rankings_(rankings) {}
@@ -242,7 +242,7 @@
heads_[i].set_value(0);
tails_[i].set_value(0);
}
- control_data_ = NULL;
+ control_data_ = nullptr;
}
void Rankings::Insert(CacheRankingsBlock* node, bool modified, List list) {
@@ -420,30 +420,30 @@
if (!node) {
Addr& my_head = heads_[list];
if (!my_head.is_initialized())
- return NULL;
+ return nullptr;
next.reset(new CacheRankingsBlock(backend_->File(my_head), my_head));
} else {
if (!node->HasData())
node->Load();
Addr& my_tail = tails_[list];
if (!my_tail.is_initialized())
- return NULL;
+ return nullptr;
if (my_tail.value() == node->address().value())
- return NULL;
+ return nullptr;
Addr address(node->Data()->next);
if (address.value() == node->address().value())
- return NULL; // Another tail? fail it.
+ return nullptr; // Another tail? fail it.
next.reset(new CacheRankingsBlock(backend_->File(address), address));
}
TrackRankingsBlock(next.get(), true);
if (!GetRanking(next.get()))
- return NULL;
+ return nullptr;
ConvertToLongLived(next.get());
if (node && !CheckSingleLink(node, next.get()))
- return NULL;
+ return nullptr;
return next.release();
}
@@ -453,30 +453,30 @@
if (!node) {
Addr& my_tail = tails_[list];
if (!my_tail.is_initialized())
- return NULL;
+ return nullptr;
prev.reset(new CacheRankingsBlock(backend_->File(my_tail), my_tail));
} else {
if (!node->HasData())
node->Load();
Addr& my_head = heads_[list];
if (!my_head.is_initialized())
- return NULL;
+ return nullptr;
if (my_head.value() == node->address().value())
- return NULL;
+ return nullptr;
Addr address(node->Data()->prev);
if (address.value() == node->address().value())
- return NULL; // Another head? fail it.
+ return nullptr; // Another head? fail it.
prev.reset(new CacheRankingsBlock(backend_->File(address), address));
}
TrackRankingsBlock(prev.get(), true);
if (!GetRanking(prev.get()))
- return NULL;
+ return nullptr;
ConvertToLongLived(prev.get());
if (node && !CheckSingleLink(prev.get(), node))
- return NULL;
+ return nullptr;
return prev.release();
}
@@ -627,7 +627,7 @@
// We cannot return a shared node because we are not keeping a reference
// to the entry that owns the buffer. Make this node a copy of the one that
// we have, and let the iterator logic update it when the entry changes.
- CacheRankingsBlock temp(NULL, Addr(0));
+ CacheRankingsBlock temp(nullptr, Addr(0));
*temp.Data() = *rankings->Data();
rankings->StopSharingData();
*rankings->Data() = *temp.Data();
diff --git a/net/disk_cache/blockfile/rankings.h b/net/disk_cache/blockfile/rankings.h
index 66ba7b8..c55c0a2 100644
--- a/net/disk_cache/blockfile/rankings.h
+++ b/net/disk_cache/blockfile/rankings.h
@@ -81,7 +81,7 @@
}
// scoped_ptr::reset will delete the object.
- void reset(CacheRankingsBlock* p = NULL) {
+ void reset(CacheRankingsBlock* p = nullptr) {
if (p != get())
rankings_->FreeRankingsBlock(get());
std::unique_ptr<CacheRankingsBlock>::reset(p);
diff --git a/net/disk_cache/blockfile/sparse_control.cc b/net/disk_cache/blockfile/sparse_control.cc
index 105ce54..f064890 100644
--- a/net/disk_cache/blockfile/sparse_control.cc
+++ b/net/disk_cache/blockfile/sparse_control.cc
@@ -196,7 +196,7 @@
SparseControl::SparseControl(EntryImpl* entry)
: entry_(entry),
- child_(NULL),
+ child_(nullptr),
operation_(kNoOperation),
pending_(false),
finished_(false),
@@ -279,8 +279,8 @@
// Copy the operation parameters.
operation_ = op;
offset_ = offset;
- user_buf_ =
- buf ? base::MakeRefCounted<net::DrainableIOBuffer>(buf, buf_len) : NULL;
+ user_buf_ = buf ? base::MakeRefCounted<net::DrainableIOBuffer>(buf, buf_len)
+ : nullptr;
buf_len_ = buf_len;
user_callback_ = std::move(callback);
@@ -299,7 +299,7 @@
if (!pending_) {
// Everything was done synchronously.
operation_ = kNoOperation;
- user_buf_ = NULL;
+ user_buf_ = nullptr;
user_callback_.Reset();
return result_;
}
@@ -316,8 +316,8 @@
DCHECK(start);
range_found_ = false;
- int result =
- StartIO(kGetRangeOperation, offset, NULL, len, CompletionOnceCallback());
+ int result = StartIO(kGetRangeOperation, offset, nullptr, len,
+ CompletionOnceCallback());
if (range_found_) {
*start = offset_;
return result;
@@ -515,7 +515,7 @@
CompletionOnceCallback(), false);
if (rv != sizeof(child_data_))
DLOG(ERROR) << "Failed to save child data";
- child_ = NULL;
+ child_ = nullptr;
}
std::string SparseControl::GenerateChildKey() {
@@ -527,7 +527,7 @@
bool SparseControl::KillChildAndContinue(const std::string& key, bool fatal) {
SetChildBit(false);
child_->DoomImpl();
- child_ = NULL;
+ child_ = nullptr;
if (fatal) {
result_ = net::ERR_CACHE_READ_FAILURE;
return false;
@@ -547,7 +547,7 @@
child_ = entry_->backend_->CreateEntryImpl(key);
if (!child_) {
- child_ = NULL;
+ child_ = nullptr;
result_ = net::ERR_CACHE_READ_FAILURE;
return false;
}
@@ -901,7 +901,7 @@
void SparseControl::DoUserCallback() {
DCHECK(!user_callback_.is_null());
CompletionOnceCallback cb = std::move(user_callback_);
- user_buf_ = NULL;
+ user_buf_ = nullptr;
pending_ = false;
operation_ = kNoOperation;
int rv = result_;
diff --git a/net/disk_cache/blockfile/storage_block-inl.h b/net/disk_cache/blockfile/storage_block-inl.h
index 828df3a..784463e 100644
--- a/net/disk_cache/blockfile/storage_block-inl.h
+++ b/net/disk_cache/blockfile/storage_block-inl.h
@@ -16,10 +16,14 @@
namespace disk_cache {
-template<typename T> StorageBlock<T>::StorageBlock(MappedFile* file,
- Addr address)
- : data_(NULL), file_(file), address_(address), modified_(false),
- own_data_(false), extended_(false) {
+template <typename T>
+StorageBlock<T>::StorageBlock(MappedFile* file, Addr address)
+ : data_(nullptr),
+ file_(file),
+ address_(address),
+ modified_(false),
+ own_data_(false),
+ extended_(false) {
if (address.num_blocks() > 1)
extended_ = true;
DCHECK(!address.is_initialized() || sizeof(*data_) == address.BlockSize());
@@ -74,7 +78,7 @@
return;
}
DeleteData();
- data_ = NULL;
+ data_ = nullptr;
modified_ = false;
extended_ = false;
}
@@ -83,7 +87,7 @@
if (!data_ || own_data_)
return;
DCHECK(!modified_);
- data_ = NULL;
+ data_ = nullptr;
}
template<typename T> void StorageBlock<T>::set_modified() {
@@ -102,7 +106,7 @@
}
template<typename T> bool StorageBlock<T>::HasData() const {
- return (NULL != data_);
+ return (nullptr != data_);
}
template<typename T> bool StorageBlock<T>::VerifyHash() const {
diff --git a/net/disk_cache/blockfile/storage_block_unittest.cc b/net/disk_cache/blockfile/storage_block_unittest.cc
index 0ed528e..9992edc 100644
--- a/net/disk_cache/blockfile/storage_block_unittest.cc
+++ b/net/disk_cache/blockfile/storage_block_unittest.cc
@@ -43,7 +43,7 @@
CacheEntryBlock entry2(file.get(), disk_cache::Addr(0xa0010002));
EXPECT_TRUE(entry2.Load());
- EXPECT_TRUE(entry2.Data() != NULL);
+ EXPECT_TRUE(entry2.Data() != nullptr);
EXPECT_TRUE(0 == entry2.Data()->hash);
EXPECT_TRUE(entry2.Data() != entry1.Data());
diff --git a/net/disk_cache/blockfile/trace.cc b/net/disk_cache/blockfile/trace.cc
index cea0eba..0b451be 100644
--- a/net/disk_cache/blockfile/trace.cc
+++ b/net/disk_cache/blockfile/trace.cc
@@ -59,7 +59,7 @@
// s_trace_buffer and s_trace_object are not singletons because I want the
// buffer to be destroyed and re-created when the last user goes away, and it
// must be straightforward to access the buffer from the debugger.
-static TraceObject* s_trace_object = NULL;
+static TraceObject* s_trace_object = nullptr;
// Static.
TraceObject* TraceObject::GetTraceObject() {
@@ -87,7 +87,7 @@
#if ENABLE_TRACING
-static TraceBuffer* s_trace_buffer = NULL;
+static TraceBuffer* s_trace_buffer = nullptr;
void InitTrace(void) {
s_trace_enabled = true;
@@ -102,8 +102,8 @@
base::AutoLock lock(s_lock.Get());
delete s_trace_buffer;
- s_trace_buffer = NULL;
- s_trace_object = NULL;
+ s_trace_buffer = nullptr;
+ s_trace_object = nullptr;
}
void Trace(const char* format, ...) {
diff --git a/net/disk_cache/blockfile/webfonts_histogram.cc b/net/disk_cache/blockfile/webfonts_histogram.cc
index a92d942..95f54af 100644
--- a/net/disk_cache/blockfile/webfonts_histogram.cc
+++ b/net/disk_cache/blockfile/webfonts_histogram.cc
@@ -48,7 +48,7 @@
return kOthers;
}
}
- return NULL;
+ return nullptr;
}
std::string HistogramName(const char* prefix, const char* label) {
diff --git a/net/disk_cache/cache_util_unittest.cc b/net/disk_cache/cache_util_unittest.cc
index d7b4caa..598d59ff 100644
--- a/net/disk_cache/cache_util_unittest.cc
+++ b/net/disk_cache/cache_util_unittest.cc
@@ -27,14 +27,14 @@
file3_ = base::FilePath(dir1_.Append(FILE_PATH_LITERAL("file03")));
ASSERT_TRUE(base::CreateDirectory(cache_dir_));
FILE *fp = base::OpenFile(file1_, "w");
- ASSERT_TRUE(fp != NULL);
+ ASSERT_TRUE(fp != nullptr);
base::CloseFile(fp);
fp = base::OpenFile(file2_, "w");
- ASSERT_TRUE(fp != NULL);
+ ASSERT_TRUE(fp != nullptr);
base::CloseFile(fp);
ASSERT_TRUE(base::CreateDirectory(dir1_));
fp = base::OpenFile(file3_, "w");
- ASSERT_TRUE(fp != NULL);
+ ASSERT_TRUE(fp != nullptr);
base::CloseFile(fp);
dest_dir_ = tmp_dir_.GetPath().Append(FILE_PATH_LITERAL("old_Cache_001"));
dest_file1_ = base::FilePath(dest_dir_.Append(FILE_PATH_LITERAL("file01")));
diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc
index 83353d7c..1bd12e5b 100644
--- a/net/disk_cache/cache_util_win.cc
+++ b/net/disk_cache/cache_util_win.cc
@@ -35,8 +35,8 @@
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
DWORD access = SYNCHRONIZE;
base::win::ScopedHandle file(CreateFile(base::as_wcstr(name.value()),
- access, sharing, NULL,
- OPEN_EXISTING, 0, NULL));
+ access, sharing, nullptr,
+ OPEN_EXISTING, 0, nullptr));
if (file.IsValid())
return false;
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc
index c83e0f50..f7ca9b2a 100644
--- a/net/disk_cache/disk_cache_test_base.cc
+++ b/net/disk_cache/disk_cache_test_base.cc
@@ -74,9 +74,9 @@
}
DiskCacheTestWithCache::DiskCacheTestWithCache()
- : cache_impl_(NULL),
- simple_cache_impl_(NULL),
- mem_cache_(NULL),
+ : cache_impl_(nullptr),
+ simple_cache_impl_(nullptr),
+ mem_cache_(nullptr),
mask_(0),
size_(0),
type_(net::DISK_CACHE),
@@ -97,7 +97,7 @@
else
InitDiskCache();
- ASSERT_TRUE(NULL != cache_);
+ ASSERT_TRUE(nullptr != cache_);
if (first_cleanup_)
ASSERT_EQ(0, cache_->GetEntryCount());
}
@@ -321,7 +321,7 @@
}
void DiskCacheTestWithCache::InitMemoryCache() {
- mem_cache_ = new disk_cache::MemBackendImpl(NULL);
+ mem_cache_ = new disk_cache::MemBackendImpl(nullptr);
cache_.reset(mem_cache_);
ASSERT_TRUE(cache_);
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc
index 7382adaa..57741417 100644
--- a/net/disk_cache/disk_cache_test_util.cc
+++ b/net/disk_cache/disk_cache_test_util.cc
@@ -64,7 +64,7 @@
int max_size,
uint32_t mask) {
std::unique_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(
- path, mask, base::ThreadTaskRunnerHandle::Get(), NULL));
+ path, mask, base::ThreadTaskRunnerHandle::Get(), nullptr));
if (max_size)
cache->SetMaxSize(max_size);
if (!cache.get())
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index c309f1b..41f9713 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -141,10 +141,10 @@
EXPECT_EQ(8192, entry->GetDataSize(1));
// We need to delete the memory buffer on this thread.
- EXPECT_EQ(
- 0, entry->WriteData(0, 0, NULL, 0, net::CompletionOnceCallback(), true));
- EXPECT_EQ(
- 0, entry->WriteData(1, 0, NULL, 0, net::CompletionOnceCallback(), true));
+ EXPECT_EQ(0, entry->WriteData(0, 0, nullptr, 0, net::CompletionOnceCallback(),
+ true));
+ EXPECT_EQ(0, entry->WriteData(1, 0, nullptr, 0, net::CompletionOnceCallback(),
+ true));
}
// We need to support synchronous IO even though it is not a supported operation
@@ -152,9 +152,9 @@
// it internally, not just by a few tests, but as part of the implementation
// (see sparse_control.cc, for example).
void DiskCacheEntryTest::InternalSyncIO() {
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry("the first key", &entry), IsOk());
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
// The bulk of the test runs from within the callback, on the cache thread.
RunTaskForTest(base::Bind(&DiskCacheEntryTest::InternalSyncIOBackground,
@@ -180,17 +180,17 @@
}
void DiskCacheEntryTest::InternalAsyncIO() {
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry("the first key", &entry), IsOk());
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
// Avoid using internal buffers for the test. We have to write something to
// the entry and close it so that we flush the internal buffer to disk. After
// that, IO operations will be really hitting the disk. We don't care about
// the content, so just extending the entry is enough (all extensions zero-
// fill any holes).
- EXPECT_EQ(0, WriteData(entry, 0, 15 * 1024, NULL, 0, false));
- EXPECT_EQ(0, WriteData(entry, 1, 15 * 1024, NULL, 0, false));
+ EXPECT_EQ(0, WriteData(entry, 0, 15 * 1024, nullptr, 0, false));
+ EXPECT_EQ(0, WriteData(entry, 1, 15 * 1024, nullptr, 0, false));
entry->Close();
ASSERT_THAT(OpenEntry("the first key", &entry), IsOk());
@@ -422,10 +422,10 @@
EXPECT_EQ(37000, entry->GetDataSize(1));
// We need to delete the memory buffer on this thread.
- EXPECT_EQ(
- 0, entry->WriteData(0, 0, NULL, 0, net::CompletionOnceCallback(), true));
- EXPECT_EQ(
- 0, entry->WriteData(1, 0, NULL, 0, net::CompletionOnceCallback(), true));
+ EXPECT_EQ(0, entry->WriteData(0, 0, nullptr, 0, net::CompletionOnceCallback(),
+ true));
+ EXPECT_EQ(0, entry->WriteData(1, 0, nullptr, 0, net::CompletionOnceCallback(),
+ true));
}
void DiskCacheEntryTest::ExternalSyncIO() {
@@ -631,9 +631,9 @@
// Tests that IOBuffers are not referenced after IO completes.
void DiskCacheEntryTest::ReleaseBuffer(int stream_index) {
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry("the first key", &entry), IsOk());
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
const int kBufferSize = 1024;
scoped_refptr<net::IOBuffer> buffer =
@@ -660,9 +660,9 @@
}
void DiskCacheEntryTest::StreamAccess() {
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry("the first key", &entry), IsOk());
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
const int kBufferSize = 1024;
const int kNumStreams = 3;
@@ -688,7 +688,7 @@
// Open the entry and read it in chunks, including a read past the end.
ASSERT_THAT(OpenEntry("the first key", &entry), IsOk());
- ASSERT_TRUE(NULL != entry);
+ ASSERT_TRUE(nullptr != entry);
const int kReadBufferSize = 600;
const int kFinalReadSize = kBufferSize - kReadBufferSize;
static_assert(kFinalReadSize < kReadBufferSize,
@@ -793,7 +793,7 @@
AddDelay();
Time t2 = Time::Now();
EXPECT_TRUE(t2 > t1);
- EXPECT_EQ(0, WriteData(entry, stream_index, 200, NULL, 0, false));
+ EXPECT_EQ(0, WriteData(entry, stream_index, 200, nullptr, 0, false));
if (type_ == net::APP_CACHE) {
EXPECT_TRUE(entry->GetLastModified() < t2);
} else {
@@ -1022,17 +1022,17 @@
disk_cache::Entry* entry;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
- EXPECT_EQ(0, ReadData(entry, stream_index, 0, NULL, 0));
- EXPECT_EQ(0, WriteData(entry, stream_index, 0, NULL, 0, false));
+ EXPECT_EQ(0, ReadData(entry, stream_index, 0, nullptr, 0));
+ EXPECT_EQ(0, WriteData(entry, stream_index, 0, nullptr, 0, false));
// This write should extend the entry.
- EXPECT_EQ(0, WriteData(entry, stream_index, 1000, NULL, 0, false));
- EXPECT_EQ(0, ReadData(entry, stream_index, 500, NULL, 0));
- EXPECT_EQ(0, ReadData(entry, stream_index, 2000, NULL, 0));
+ EXPECT_EQ(0, WriteData(entry, stream_index, 1000, nullptr, 0, false));
+ EXPECT_EQ(0, ReadData(entry, stream_index, 500, nullptr, 0));
+ EXPECT_EQ(0, ReadData(entry, stream_index, 2000, nullptr, 0));
EXPECT_EQ(1000, entry->GetDataSize(stream_index));
- EXPECT_EQ(0, WriteData(entry, stream_index, 100000, NULL, 0, true));
- EXPECT_EQ(0, ReadData(entry, stream_index, 50000, NULL, 0));
+ EXPECT_EQ(0, WriteData(entry, stream_index, 100000, nullptr, 0, true));
+ EXPECT_EQ(0, ReadData(entry, stream_index, 50000, nullptr, 0));
EXPECT_EQ(100000, entry->GetDataSize(stream_index));
// Let's verify the actual content.
@@ -1459,7 +1459,7 @@
stream_index, 0, buffer.get(), kSize, cb.callback(), false));
// Release our reference to the buffer.
- buffer = NULL;
+ buffer = nullptr;
EXPECT_EQ(kSize, cb.WaitForResult());
// And now test with a Read().
@@ -1469,7 +1469,7 @@
EXPECT_EQ(
net::ERR_IO_PENDING,
entry->ReadData(stream_index, 0, buffer.get(), kSize, cb.callback()));
- buffer = NULL;
+ buffer = nullptr;
EXPECT_EQ(kSize, cb.WaitForResult());
entry->Close();
@@ -1657,10 +1657,10 @@
// Perform the enumerations.
std::unique_ptr<TestIterator> iter = CreateIterator();
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
int count = 0;
while (iter->OpenNextEntry(&entry) == net::OK) {
- ASSERT_TRUE(entry != NULL);
+ ASSERT_TRUE(entry != nullptr);
++count;
disk_cache::MemEntryImpl* mem_entry =
reinterpret_cast<disk_cache::MemEntryImpl*>(entry);
@@ -2491,7 +2491,7 @@
int count = 0;
std::string child_key[2];
while (iter->OpenNextEntry(&entry) == net::OK) {
- ASSERT_TRUE(entry != NULL);
+ ASSERT_TRUE(entry != nullptr);
// Writing to an entry will alter the LRU list and invalidate the iterator.
if (entry->GetKey() != key && count < 2)
child_key[count++] = entry->GetKey();
@@ -2795,7 +2795,7 @@
// Requires SimpleCacheMode.
bool DiskCacheEntryTest::SimpleCacheMakeBadChecksumEntry(const std::string& key,
int data_size) {
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
if (CreateEntry(key, &entry) != net::OK || !entry) {
LOG(ERROR) << "Could not create entry";
@@ -2808,7 +2808,7 @@
EXPECT_EQ(data_size, WriteData(entry, 1, 0, buffer.get(), data_size, false));
entry->Close();
- entry = NULL;
+ entry = nullptr;
// Corrupt the last byte of the data.
base::FilePath entry_file0_path = cache_path_.AppendASCII(
@@ -2833,7 +2833,7 @@
const int kLargeSize = 50000;
ASSERT_TRUE(SimpleCacheMakeBadChecksumEntry(key, kLargeSize));
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
// Open the entry. Can't spot the checksum that quickly with it so
// huge.
@@ -2860,7 +2860,7 @@
const int kLargeSize = 50000;
ASSERT_TRUE(SimpleCacheMakeBadChecksumEntry(key, kLargeSize));
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
// Open the entry, forcing an IO error.
ASSERT_THAT(OpenEntry(key, &entry), IsOk());
@@ -3015,18 +3015,18 @@
const std::string key("the first key");
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
EXPECT_NE(null, entry);
entry->Close();
- entry = NULL;
+ entry = nullptr;
// Force the entry to flush to disk, so subsequent platform file operations
// succed.
ASSERT_THAT(OpenEntry(key, &entry), IsOk());
entry->Close();
- entry = NULL;
+ entry = nullptr;
// Truncate the file such that the length isn't sufficient to have an EOF
// record.
@@ -3046,9 +3046,9 @@
SetCacheType(net::APP_CACHE); // APP_CACHE doesn't use optimistic operations.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* const null_entry = NULL;
+ disk_cache::Entry* const null_entry = nullptr;
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
EXPECT_THAT(CreateEntry("my key", &entry), IsOk());
ASSERT_NE(null_entry, entry);
ScopedEntryPtr entry_closer(entry);
@@ -3073,7 +3073,7 @@
SetCacheType(net::APP_CACHE); // APP_CACHE doesn't use optimistic operations.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* const null_entry = NULL;
+ disk_cache::Entry* const null_entry = nullptr;
MessageLoopHelper helper;
CallbackTest create_callback(&helper, false);
@@ -3083,7 +3083,7 @@
scoped_refptr<net::IOBufferWithSize> write_buffer =
base::MakeRefCounted<net::IOBufferWithSize>(kBufferSize);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
EXPECT_THAT(CreateEntry("my key", &entry), IsOk());
ASSERT_NE(null_entry, entry);
ScopedEntryPtr entry_closer(entry);
@@ -3108,10 +3108,10 @@
SetCacheType(net::APP_CACHE); // APP_CACHE doesn't use optimistic operations.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* const null_entry = NULL;
+ disk_cache::Entry* const null_entry = nullptr;
MessageLoopHelper helper;
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
// Note that |entry| is only set once CreateEntry() completed which is why we
// have to wait (i.e. use the helper CreateEntry() function).
EXPECT_THAT(CreateEntry("my key", &entry), IsOk());
@@ -3157,7 +3157,7 @@
// Create, Write, Read, Write, Read, Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
MessageLoopHelper helper;
@@ -3181,7 +3181,7 @@
CacheTestFillBuffer(buffer1->data(), kSize1, false);
CacheTestFillBuffer(buffer2->data(), kSize2, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
// Create is optimistic, must return OK.
ASSERT_EQ(net::OK,
cache_->CreateEntry(
@@ -3251,14 +3251,14 @@
// Create, Open, Close, Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
MessageLoopHelper helper;
CallbackTest callback1(&helper, false);
CallbackTest callback2(&helper, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_EQ(net::OK,
cache_->CreateEntry(
key, net::HIGHEST, &entry,
@@ -3266,7 +3266,7 @@
EXPECT_NE(null, entry);
ScopedEntryPtr entry_closer(entry);
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_EQ(net::ERR_IO_PENDING,
cache_->OpenEntry(
key, net::HIGHEST, &entry2,
@@ -3289,17 +3289,17 @@
// Create, Close, Open, Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_EQ(net::OK, cache_->CreateEntry(key, net::HIGHEST, &entry,
net::CompletionOnceCallback()));
EXPECT_NE(null, entry);
entry->Close();
net::TestCompletionCallback cb;
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_EQ(net::ERR_IO_PENDING,
cache_->OpenEntry(key, net::HIGHEST, &entry2, cb.callback()));
ASSERT_THAT(cb.GetResult(net::ERR_IO_PENDING), IsOk());
@@ -3318,7 +3318,7 @@
// Create, Close, Write, Open, Open, Close, Write, Read, Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
net::TestCompletionCallback cb;
@@ -3326,7 +3326,7 @@
scoped_refptr<net::IOBuffer> buffer1 =
base::MakeRefCounted<net::IOBuffer>(kSize1);
CacheTestFillBuffer(buffer1->data(), kSize1, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_EQ(net::OK, cache_->CreateEntry(key, net::HIGHEST, &entry,
net::CompletionOnceCallback()));
@@ -3346,13 +3346,13 @@
// At this point the |entry| must have been destroyed, and called
// RemoveSelfFromBackend().
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_EQ(net::ERR_IO_PENDING,
cache_->OpenEntry(key, net::HIGHEST, &entry2, cb.callback()));
ASSERT_THAT(cb.GetResult(net::ERR_IO_PENDING), IsOk());
EXPECT_NE(null, entry2);
- disk_cache::Entry* entry3 = NULL;
+ disk_cache::Entry* entry3 = nullptr;
ASSERT_EQ(net::ERR_IO_PENDING,
cache_->OpenEntry(key, net::HIGHEST, &entry3, cb.callback()));
ASSERT_THAT(cb.GetResult(net::ERR_IO_PENDING), IsOk());
@@ -3384,7 +3384,7 @@
// Create, Doom, Write, Read, Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
net::TestCompletionCallback cb;
@@ -3392,7 +3392,7 @@
scoped_refptr<net::IOBuffer> buffer1 =
base::MakeRefCounted<net::IOBuffer>(kSize1);
CacheTestFillBuffer(buffer1->data(), kSize1, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_EQ(net::OK, cache_->CreateEntry(key, net::HIGHEST, &entry,
net::CompletionOnceCallback()));
@@ -3419,7 +3419,7 @@
// Create, Write, Doom, Doom, Read, Doom, Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
net::TestCompletionCallback cb;
@@ -3429,7 +3429,7 @@
scoped_refptr<net::IOBuffer> buffer1_read =
base::MakeRefCounted<net::IOBuffer>(kSize1);
CacheTestFillBuffer(buffer1->data(), kSize1, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_EQ(net::OK, cache_->CreateEntry(key, net::HIGHEST, &entry,
net::CompletionOnceCallback()));
@@ -3460,7 +3460,7 @@
InitCache();
const char key[] = "the first key";
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
// First, an optimistic create.
ASSERT_EQ(net::OK, cache_->CreateEntry(key, net::HIGHEST, &entry,
@@ -3493,7 +3493,7 @@
// Create, Doom, Write, Close, Check files are not on disk anymore.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
net::TestCompletionCallback cb;
@@ -3501,7 +3501,7 @@
scoped_refptr<net::IOBuffer> buffer1 =
base::MakeRefCounted<net::IOBuffer>(kSize1);
CacheTestFillBuffer(buffer1->data(), kSize1, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_EQ(net::OK, cache_->CreateEntry(key, net::HIGHEST, &entry,
net::CompletionOnceCallback()));
@@ -3536,12 +3536,12 @@
SetCacheType(net::APP_CACHE);
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
net::TestCompletionCallback create_callback;
- disk_cache::Entry* entry1 = NULL;
+ disk_cache::Entry* entry1 = nullptr;
ASSERT_EQ(net::OK,
create_callback.GetResult(cache_->CreateEntry(
key, net::HIGHEST, &entry1, create_callback.callback())));
@@ -3552,7 +3552,7 @@
EXPECT_EQ(net::ERR_IO_PENDING,
cache_->DoomEntry(key, net::HIGHEST, doom_callback.callback()));
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_EQ(net::OK,
create_callback.GetResult(cache_->CreateEntry(
key, net::HIGHEST, &entry2, create_callback.callback())));
@@ -3667,18 +3667,18 @@
// Create, Doom, Create, Doom (1st entry), Open.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
- disk_cache::Entry* entry1 = NULL;
+ disk_cache::Entry* entry1 = nullptr;
ASSERT_THAT(CreateEntry(key, &entry1), IsOk());
ScopedEntryPtr entry1_closer(entry1);
EXPECT_NE(null, entry1);
EXPECT_THAT(DoomEntry(key), IsOk());
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_THAT(CreateEntry(key, &entry2), IsOk());
ScopedEntryPtr entry2_closer(entry2);
EXPECT_NE(null, entry2);
@@ -3690,7 +3690,7 @@
EXPECT_EQ(net::OK,
cb.GetResult(simple_entry1->DoomEntry(cb.callback())));
- disk_cache::Entry* entry3 = NULL;
+ disk_cache::Entry* entry3 = nullptr;
ASSERT_THAT(OpenEntry(key, &entry3), IsOk());
ScopedEntryPtr entry3_closer(entry3);
EXPECT_NE(null, entry3);
@@ -3702,18 +3702,18 @@
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
- disk_cache::Entry* entry1 = NULL;
+ disk_cache::Entry* entry1 = nullptr;
ASSERT_THAT(CreateEntry(key, &entry1), IsOk());
ScopedEntryPtr entry1_closer(entry1);
EXPECT_NE(null, entry1);
entry1->Doom();
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_THAT(CreateEntry(key, &entry2), IsOk());
ScopedEntryPtr entry2_closer(entry2);
EXPECT_NE(null, entry2);
@@ -3728,28 +3728,28 @@
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "this is a key";
- disk_cache::Entry* entry1 = NULL;
+ disk_cache::Entry* entry1 = nullptr;
ASSERT_THAT(CreateEntry(key, &entry1), IsOk());
ScopedEntryPtr entry1_closer(entry1);
EXPECT_NE(null, entry1);
entry1->Doom();
entry1_closer.reset();
- entry1 = NULL;
+ entry1 = nullptr;
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_THAT(CreateEntry(key, &entry2), IsOk());
ScopedEntryPtr entry2_closer(entry2);
EXPECT_NE(null, entry2);
entry2_closer.reset();
- entry2 = NULL;
+ entry2 = nullptr;
- disk_cache::Entry* entry3 = NULL;
+ disk_cache::Entry* entry3 = nullptr;
ASSERT_THAT(OpenEntry(key, &entry3), IsOk());
ScopedEntryPtr entry3_closer(entry3);
EXPECT_NE(null, entry3);
@@ -3764,8 +3764,8 @@
// initially succeed, but realize later that creation failed.
const std::string key = "the key";
net::TestCompletionCallback cb;
- disk_cache::Entry* entry = NULL;
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry = nullptr;
+ disk_cache::Entry* entry2 = nullptr;
EXPECT_TRUE(disk_cache::simple_util::CreateCorruptFileForTests(
key, cache_path_));
@@ -3852,13 +3852,13 @@
base::MakeRefCounted<net::IOBuffer>(kBufferSize);
CacheTestFillBuffer(write_buffer->data(), kBufferSize, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
EXPECT_EQ(kBufferSize,
WriteData(entry, 1, 0, write_buffer.get(), kBufferSize, false));
entry->Close();
- entry = NULL;
+ entry = nullptr;
ASSERT_THAT(OpenEntry(key, &entry), IsOk());
ScopedEntryPtr entry_closer(entry);
@@ -3912,7 +3912,7 @@
InitCache();
const char key[] = "the first key";
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_EQ(net::OK, cache_->CreateEntry(key, net::HIGHEST, &entry,
net::CompletionOnceCallback()));
ScopedEntryPtr entry_closer(entry);
@@ -3999,13 +3999,13 @@
base::MakeRefCounted<net::IOBuffer>(size);
// Advance the first reader a little.
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(OpenEntry(key, &entry), IsOk());
ScopedEntryPtr entry_closer(entry);
EXPECT_EQ(1, ReadData(entry, 1, 0, read_buffer1.get(), 1));
// Advance the 2nd reader by the same amount.
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
EXPECT_THAT(OpenEntry(key, &entry2), IsOk());
ScopedEntryPtr entry2_closer(entry2);
EXPECT_EQ(1, ReadData(entry2, 1, 0, read_buffer2.get(), 1));
@@ -4026,7 +4026,7 @@
// Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
const int kHalfSize = 200;
@@ -4034,7 +4034,7 @@
scoped_refptr<net::IOBuffer> buffer1 =
base::MakeRefCounted<net::IOBuffer>(kSize);
CacheTestFillBuffer(buffer1->data(), kSize, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
EXPECT_NE(null, entry);
@@ -4042,7 +4042,7 @@
EXPECT_EQ(kSize, WriteData(entry, 1, 0, buffer1.get(), kSize, false));
entry->Close();
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_THAT(OpenEntry(key, &entry2), IsOk());
EXPECT_EQ(entry, entry2);
@@ -4068,7 +4068,7 @@
EXPECT_TRUE(
static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef());
entry->Close();
- entry = NULL;
+ entry = nullptr;
}
// Test if we can write the data not in sequence and read correctly. In
@@ -4079,7 +4079,7 @@
// Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
const int kHalfSize = 200;
@@ -4092,7 +4092,7 @@
char* buffer1_data = buffer1->data() + kHalfSize;
memcpy(buffer2->data(), buffer1_data, kHalfSize);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
entry->Close();
for (int i = 0; i < disk_cache::kSimpleEntryStreamCount; ++i) {
@@ -4128,7 +4128,7 @@
TEST_F(DiskCacheEntryTest, SimpleCacheStream1SizeChanges) {
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
const std::string key("the key");
const int kSize = 100;
scoped_refptr<net::IOBuffer> buffer =
@@ -4194,7 +4194,7 @@
EXPECT_EQ(kSize, ReadData(entry, 0, 0, buffer_read.get(), kSize));
EXPECT_EQ(0, memcmp(buffer->data(), buffer_read->data(), kSize));
entry->Close();
- entry = NULL;
+ entry = nullptr;
}
// Test that writing within the range for which the crc has already been
@@ -4205,7 +4205,7 @@
// Open, Read (all), Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
const int kHalfSize = 200;
@@ -4217,7 +4217,7 @@
CacheTestFillBuffer(buffer1->data(), kSize, false);
CacheTestFillBuffer(buffer2->data(), kHalfSize, false);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
EXPECT_NE(null, entry);
entry->Close();
@@ -4296,7 +4296,7 @@
}
void DiskCacheEntryTest::UseAfterBackendDestruction() {
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry("the first key", &entry), IsOk());
cache_.reset();
@@ -4466,7 +4466,7 @@
// Open, Close.
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "the first key";
const int kSize = 200;
@@ -4480,12 +4480,12 @@
// The race only happens on stream 1 and stream 2.
for (int i = 0; i < disk_cache::kSimpleEntryStreamCount; ++i) {
ASSERT_THAT(DoomAllEntries(), IsOk());
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
EXPECT_NE(null, entry);
entry->Close();
- entry = NULL;
+ entry = nullptr;
ASSERT_THAT(DoomAllEntries(), IsOk());
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
@@ -4507,7 +4507,7 @@
EXPECT_NE(null, entry);
entry->Close();
- entry = NULL;
+ entry = nullptr;
}
}
@@ -4517,17 +4517,17 @@
SetSimpleCacheMode();
InitCache();
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
const char key[] = "this is a key";
- disk_cache::Entry* entry1 = NULL;
+ disk_cache::Entry* entry1 = nullptr;
ASSERT_THAT(CreateEntry(key, &entry1), IsOk());
ScopedEntryPtr entry1_closer(entry1);
EXPECT_NE(null, entry1);
entry1->Doom();
- disk_cache::Entry* entry2 = NULL;
+ disk_cache::Entry* entry2 = nullptr;
ASSERT_THAT(CreateEntry(key, &entry2), IsOk());
ScopedEntryPtr entry2_closer(entry2);
EXPECT_NE(null, entry2);
@@ -4535,7 +4535,7 @@
// Closing then reopening entry2 insures that entry2 is serialized, and so
// it can be opened from files without error.
- entry2 = NULL;
+ entry2 = nullptr;
ASSERT_THAT(OpenEntry(key, &entry2), IsOk());
EXPECT_NE(null, entry2);
entry2_closer.reset(entry2);
@@ -4547,7 +4547,7 @@
// the backend's |active_entries_| while |entry2| is still alive and its
// files are still on disk.
entry1_closer.reset();
- entry1 = NULL;
+ entry1 = nullptr;
// Close does not have a callback. However, we need to be sure the close is
// finished before we continue the test. We can take advantage of how the ref
@@ -4561,11 +4561,11 @@
base::PlatformThread::YieldCurrentThread();
base::RunLoop().RunUntilIdle();
}
- entry1_refptr = NULL;
+ entry1_refptr = nullptr;
// In the bug case, this new entry ends up being a duplicate object pointing
// at the same underlying files.
- disk_cache::Entry* entry3 = NULL;
+ disk_cache::Entry* entry3 = nullptr;
EXPECT_THAT(OpenEntry(key, &entry3), IsOk());
ScopedEntryPtr entry3_closer(entry3);
EXPECT_NE(null, entry3);
@@ -4621,7 +4621,7 @@
InitCache();
const char key[] = "key";
- disk_cache::Entry* null = NULL;
+ disk_cache::Entry* null = nullptr;
disk_cache::Entry* entry;
ASSERT_THAT(CreateEntry(key, &entry), IsOk());
EXPECT_NE(null, entry);
@@ -5245,7 +5245,7 @@
}
void TryRead(const std::string& key) {
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(OpenEntry(key, &entry), IsOk());
scoped_refptr<net::IOBuffer> read_buf =
base::MakeRefCounted<net::IOBuffer>(kEntrySize);
@@ -5297,7 +5297,7 @@
const char kKey[] = "a key";
InitCacheAndCreateEntry(kKey);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(OpenEntry(kKey, &entry), IsOk());
entry->Close();
@@ -5322,7 +5322,7 @@
const char key[] = "the first key";
ASSERT_TRUE(SimpleCacheMakeBadChecksumEntry(key, 10));
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
// Open the entry. Since we made a small entry, we will detect the CRC
// problem at open.
@@ -5401,7 +5401,7 @@
const char kKey[] = "a key";
InitCacheAndCreateEntry(kKey);
- disk_cache::Entry* entry = NULL;
+ disk_cache::Entry* entry = nullptr;
ASSERT_THAT(OpenEntry(kKey, &entry), IsOk());
scoped_refptr<net::IOBuffer> read_buf =
base::MakeRefCounted<net::IOBuffer>(kEntrySize);
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc
index 34cc653..d57fb5c 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -629,7 +629,7 @@
uint64_t entry_hash = hashes_to_enumerate_->back();
hashes_to_enumerate_->pop_back();
if (backend_->index()->Has(entry_hash)) {
- *next_entry = NULL;
+ *next_entry = nullptr;
CompletionOnceCallback continue_iteration = base::BindOnce(
&SimpleIterator::CheckIterationReturnValue,
weak_factory_.GetWeakPtr(), next_entry, copyable_callback);
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
index 34cd1a925..2d74e4a 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -951,7 +951,7 @@
results.get());
OnceClosure reply = base::BindOnce(&SimpleEntryImpl::CloseOperationComplete,
this, base::Passed(&results));
- synchronous_entry_ = NULL;
+ synchronous_entry_ = nullptr;
prioritized_task_runner_->PostTaskAndReply(
FROM_HERE, std::move(task), std::move(reply), entry_priority_);
diff --git a/net/disk_cache/simple/simple_entry_operation.cc b/net/disk_cache/simple/simple_entry_operation.cc
index d3461e49..6e64021 100644
--- a/net/disk_cache/simple/simple_entry_operation.cc
+++ b/net/disk_cache/simple/simple_entry_operation.cc
@@ -24,9 +24,9 @@
OpenEntryIndexEnum index_state,
net::CompletionOnceCallback callback,
Entry** out_entry) {
- return SimpleEntryOperation(entry, NULL, std::move(callback), out_entry,
- nullptr, 0, 0, 0, NULL, TYPE_OPEN, index_state, 0,
- false, false);
+ return SimpleEntryOperation(entry, nullptr, std::move(callback), out_entry,
+ nullptr, 0, 0, 0, nullptr, TYPE_OPEN, index_state,
+ 0, false, false);
}
// static
@@ -35,9 +35,9 @@
OpenEntryIndexEnum index_state,
net::CompletionOnceCallback callback,
Entry** out_entry) {
- return SimpleEntryOperation(entry, NULL, std::move(callback), out_entry,
- nullptr, 0, 0, 0, NULL, TYPE_CREATE, index_state,
- 0, false, false);
+ return SimpleEntryOperation(entry, nullptr, std::move(callback), out_entry,
+ nullptr, 0, 0, 0, nullptr, TYPE_CREATE,
+ index_state, 0, false, false);
}
// static
@@ -46,17 +46,17 @@
OpenEntryIndexEnum index_state,
net::CompletionOnceCallback callback,
EntryWithOpened* entry_struct) {
- return SimpleEntryOperation(entry, NULL, std::move(callback), nullptr,
- entry_struct, 0, 0, 0, NULL, TYPE_OPEN_OR_CREATE,
- index_state, 0, false, false);
+ return SimpleEntryOperation(
+ entry, nullptr, std::move(callback), nullptr, entry_struct, 0, 0, 0,
+ nullptr, TYPE_OPEN_OR_CREATE, index_state, 0, false, false);
}
// static
SimpleEntryOperation SimpleEntryOperation::CloseOperation(
SimpleEntryImpl* entry) {
- return SimpleEntryOperation(entry, NULL, CompletionOnceCallback(), nullptr,
- nullptr, 0, 0, 0, NULL, TYPE_CLOSE, INDEX_NOEXIST,
- 0, false, false);
+ return SimpleEntryOperation(entry, nullptr, CompletionOnceCallback(), nullptr,
+ nullptr, 0, 0, 0, nullptr, TYPE_CLOSE,
+ INDEX_NOEXIST, 0, false, false);
}
// static
@@ -68,8 +68,8 @@
net::IOBuffer* buf,
CompletionOnceCallback callback) {
return SimpleEntryOperation(entry, buf, std::move(callback), nullptr, nullptr,
- offset, 0, length, NULL, TYPE_READ, INDEX_NOEXIST,
- index, false, false);
+ offset, 0, length, nullptr, TYPE_READ,
+ INDEX_NOEXIST, index, false, false);
}
// static
@@ -83,7 +83,7 @@
bool optimistic,
CompletionOnceCallback callback) {
return SimpleEntryOperation(entry, buf, std::move(callback), nullptr, nullptr,
- offset, 0, length, NULL, TYPE_WRITE,
+ offset, 0, length, nullptr, TYPE_WRITE,
INDEX_NOEXIST, index, truncate, optimistic);
}
@@ -95,8 +95,8 @@
net::IOBuffer* buf,
CompletionOnceCallback callback) {
return SimpleEntryOperation(entry, buf, std::move(callback), nullptr, nullptr,
- 0, sparse_offset, length, NULL, TYPE_READ_SPARSE,
- INDEX_NOEXIST, 0, false, false);
+ 0, sparse_offset, length, nullptr,
+ TYPE_READ_SPARSE, INDEX_NOEXIST, 0, false, false);
}
// static
@@ -106,9 +106,9 @@
int length,
net::IOBuffer* buf,
CompletionOnceCallback callback) {
- return SimpleEntryOperation(entry, buf, std::move(callback), nullptr, nullptr,
- 0, sparse_offset, length, NULL, TYPE_WRITE_SPARSE,
- INDEX_NOEXIST, 0, false, false);
+ return SimpleEntryOperation(
+ entry, buf, std::move(callback), nullptr, nullptr, 0, sparse_offset,
+ length, nullptr, TYPE_WRITE_SPARSE, INDEX_NOEXIST, 0, false, false);
}
// static
@@ -118,7 +118,7 @@
int length,
int64_t* out_start,
CompletionOnceCallback callback) {
- return SimpleEntryOperation(entry, NULL, std::move(callback), nullptr,
+ return SimpleEntryOperation(entry, nullptr, std::move(callback), nullptr,
nullptr, 0, sparse_offset, length, out_start,
TYPE_GET_AVAILABLE_RANGE, INDEX_NOEXIST, 0, false,
false);
@@ -128,13 +128,13 @@
SimpleEntryOperation SimpleEntryOperation::DoomOperation(
SimpleEntryImpl* entry,
net::CompletionOnceCallback callback) {
- net::IOBuffer* const buf = NULL;
- Entry** const out_entry = NULL;
+ net::IOBuffer* const buf = nullptr;
+ Entry** const out_entry = nullptr;
EntryWithOpened* out_entry_struct = nullptr;
const int offset = 0;
const int64_t sparse_offset = 0;
const int length = 0;
- int64_t* const out_start = NULL;
+ int64_t* const out_start = nullptr;
const OpenEntryIndexEnum index_state = INDEX_NOEXIST;
const int index = 0;
const bool truncate = false;
diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc
index f377c41..d6bfe32 100644
--- a/net/disk_cache/simple/simple_index_file.cc
+++ b/net/disk_cache/simple/simple_index_file.cc
@@ -329,7 +329,7 @@
}
// Atomically rename the temporary index file to become the real one.
- if (!base::ReplaceFile(temp_index_filename, index_filename, NULL))
+ if (!base::ReplaceFile(temp_index_filename, index_filename, nullptr))
return;
if (app_on_background) {
diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc
index fb1d903..001a9af 100644
--- a/net/disk_cache/simple/simple_index_file_unittest.cc
+++ b/net/disk_cache/simple/simple_index_file_unittest.cc
@@ -213,7 +213,7 @@
std::unique_ptr<base::Pickle> pickle = WrappedSimpleIndexFile::Serialize(
net::DISK_CACHE, index_metadata, entries);
- EXPECT_TRUE(pickle.get() != NULL);
+ EXPECT_TRUE(pickle.get() != nullptr);
base::Time now = base::Time::Now();
WrappedSimpleIndexFile::SerializeFinalData(now, pickle.get());
base::Time when_index_last_saw_cache;
@@ -253,7 +253,7 @@
std::unique_ptr<base::Pickle> pickle = WrappedSimpleIndexFile::Serialize(
net::APP_CACHE, index_metadata, entries);
- EXPECT_TRUE(pickle.get() != NULL);
+ EXPECT_TRUE(pickle.get() != nullptr);
base::Time now = base::Time::Now();
WrappedSimpleIndexFile::SerializeFinalData(now, pickle.get());
base::Time when_index_last_saw_cache;
@@ -295,7 +295,7 @@
}
std::unique_ptr<base::Pickle> pickle =
WrappedSimpleIndexFile::Serialize(net::DISK_CACHE, v7_metadata, entries);
- ASSERT_TRUE(pickle.get() != NULL);
+ ASSERT_TRUE(pickle.get() != nullptr);
base::Time now = base::Time::Now();
WrappedSimpleIndexFile::SerializeFinalData(now, pickle.get());
@@ -338,7 +338,7 @@
}
std::unique_ptr<base::Pickle> pickle =
WrappedSimpleIndexFile::Serialize(net::DISK_CACHE, v8_metadata, entries);
- ASSERT_TRUE(pickle.get() != NULL);
+ ASSERT_TRUE(pickle.get() != nullptr);
base::Time now = base::Time::Now();
WrappedSimpleIndexFile::SerializeFinalData(now, pickle.get());
@@ -381,7 +381,7 @@
}
std::unique_ptr<base::Pickle> pickle =
WrappedSimpleIndexFile::Serialize(net::DISK_CACHE, v8_metadata, entries);
- ASSERT_TRUE(pickle.get() != NULL);
+ ASSERT_TRUE(pickle.get() != nullptr);
base::Time now = base::Time::Now();
WrappedSimpleIndexFile::SerializeFinalData(now, pickle.get());
diff --git a/net/disk_cache/simple/simple_synchronous_entry.cc b/net/disk_cache/simple/simple_synchronous_entry.cc
index a45ceca..fcaaa9e 100644
--- a/net/disk_cache/simple/simple_synchronous_entry.cc
+++ b/net/disk_cache/simple/simple_synchronous_entry.cc
@@ -299,7 +299,7 @@
SimpleEntryCreationResults::SimpleEntryCreationResults(
SimpleEntryStat entry_stat)
- : sync_entry(NULL),
+ : sync_entry(nullptr),
entry_stat(entry_stat),
result(net::OK),
created(false) {}
@@ -366,7 +366,7 @@
if (out_results->result != net::OK) {
sync_entry->Doom();
delete sync_entry;
- out_results->sync_entry = NULL;
+ out_results->sync_entry = nullptr;
out_results->stream_prefetch_data[0].data = nullptr;
out_results->stream_prefetch_data[1].data = nullptr;
return;
@@ -401,7 +401,7 @@
if (out_results->result != net::ERR_FILE_EXISTS)
sync_entry->Doom();
delete sync_entry;
- out_results->sync_entry = NULL;
+ out_results->sync_entry = nullptr;
return;
}
out_results->sync_entry = sync_entry;
diff --git a/net/disk_cache/simple/simple_version_upgrade.cc b/net/disk_cache/simple/simple_version_upgrade.cc
index 86ac278..49a4aa8 100644
--- a/net/disk_cache/simple/simple_version_upgrade.cc
+++ b/net/disk_cache/simple/simple_version_upgrade.cc
@@ -228,7 +228,7 @@
LogMessageFailedUpgradeFromVersion(file_header.version);
return SimpleCacheConsistencyResult::kWriteFakeIndexFileFailed;
}
- if (!base::ReplaceFile(temp_fake_index, fake_index, NULL)) {
+ if (!base::ReplaceFile(temp_fake_index, fake_index, nullptr)) {
LOG(ERROR) << "Failed to replace the fake index.";
LogMessageFailedUpgradeFromVersion(file_header.version);
return SimpleCacheConsistencyResult::kReplaceFileFailed;
diff --git a/net/dns/address_sorter_win.cc b/net/dns/address_sorter_win.cc
index a64f361..18f0abf 100644
--- a/net/dns/address_sorter_win.cc
+++ b/net/dns/address_sorter_win.cc
@@ -96,7 +96,7 @@
DWORD result_size = 0;
int result = WSAIoctl(sock, SIO_ADDRESS_LIST_SORT, input_buffer_.get(),
buffer_size_, output_buffer_.get(), buffer_size_,
- &result_size, NULL, NULL);
+ &result_size, nullptr, nullptr);
if (result == SOCKET_ERROR) {
LOG(ERROR) << "SIO_ADDRESS_LIST_SORT failed " << WSAGetLastError();
} else {
diff --git a/net/dns/dns_client.cc b/net/dns/dns_client.cc
index c230b32..7de02c7 100644
--- a/net/dns/dns_client.cc
+++ b/net/dns/dns_client.cc
@@ -45,11 +45,11 @@
}
const DnsConfig* GetConfig() const override {
- return session_.get() ? &session_->config() : NULL;
+ return session_.get() ? &session_->config() : nullptr;
}
DnsTransactionFactory* GetTransactionFactory() override {
- return session_.get() ? factory_.get() : NULL;
+ return session_.get() ? factory_.get() : nullptr;
}
AddressSorter* GetAddressSorter() override { return address_sorter_.get(); }
diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc
index e4a6885b..12bbb2ee 100644
--- a/net/dns/dns_config_service_win.cc
+++ b/net/dns/dns_config_service_win.cc
@@ -132,7 +132,7 @@
tries++) {
out.reset(static_cast<PIP_ADAPTER_ADDRESSES>(malloc(len)));
memset(out.get(), 0, len);
- rv = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, out.get(), &len);
+ rv = GetAdaptersAddresses(AF_UNSPEC, flags, nullptr, out.get(), &len);
}
if (rv != NO_ERROR)
out.reset();
@@ -242,7 +242,7 @@
// The order of adapters is the network binding order, so stick to the
// first good adapter for each family.
for (const IP_ADAPTER_ADDRESSES* adapter = addresses.get();
- adapter != NULL && (!have_ipv4 || !have_ipv6);
+ adapter != nullptr && (!have_ipv4 || !have_ipv6);
adapter = adapter->Next) {
if (adapter->OperStatus != IfOperStatusUp)
continue;
@@ -251,8 +251,7 @@
for (const IP_ADAPTER_UNICAST_ADDRESS* address =
adapter->FirstUnicastAddress;
- address != NULL;
- address = address->Next) {
+ address != nullptr; address = address->Next) {
IPEndPoint ipe;
if (!ipe.FromSockAddr(address->Address.lpSockaddr,
address->Address.iSockaddrLength)) {
@@ -506,7 +505,7 @@
// The order of adapters is the network binding order, so stick to the
// first good adapter.
for (const IP_ADAPTER_ADDRESSES* adapter = settings.addresses.get();
- adapter != NULL && config->nameservers.empty();
+ adapter != nullptr && config->nameservers.empty();
adapter = adapter->Next) {
if (adapter->OperStatus != IfOperStatusUp)
continue;
@@ -515,8 +514,7 @@
for (const IP_ADAPTER_DNS_SERVER_ADDRESS* address =
adapter->FirstDnsServerAddress;
- address != NULL;
- address = address->Next) {
+ address != nullptr; address = address->Next) {
IPEndPoint ipe;
if (ipe.FromSockAddr(address->Address.lpSockaddr,
address->Address.iSockaddrLength)) {
diff --git a/net/dns/dns_config_service_win_unittest.cc b/net/dns/dns_config_service_win_unittest.cc
index d30d047..93e62afd 100644
--- a/net/dns/dns_config_service_win_unittest.cc
+++ b/net/dns/dns_config_service_win_unittest.cc
@@ -20,16 +20,16 @@
const base::char16* input;
const char* output[4]; // NULL-terminated, empty if expected false
} cases[] = {
- {STRING16_LITERAL("chromium.org"), {"chromium.org", NULL}},
- {STRING16_LITERAL("chromium.org,org"), {"chromium.org", "org", NULL}},
+ {STRING16_LITERAL("chromium.org"), {"chromium.org", nullptr}},
+ {STRING16_LITERAL("chromium.org,org"), {"chromium.org", "org", nullptr}},
// Empty suffixes terminate the list
- {STRING16_LITERAL("crbug.com,com,,org"), {"crbug.com", "com", NULL}},
+ {STRING16_LITERAL("crbug.com,com,,org"), {"crbug.com", "com", nullptr}},
// IDN are converted to punycode
{STRING16_LITERAL("\u017c\xf3\u0142ta.pi\u0119\u015b\u0107.pl,pl"),
- {"xn--ta-4ja03asj.xn--pi-wla5e0q.pl", "pl", NULL}},
+ {"xn--ta-4ja03asj.xn--pi-wla5e0q.pl", "pl", nullptr}},
// Empty search list is invalid
- {STRING16_LITERAL(""), {NULL}},
- {STRING16_LITERAL(",,"), {NULL}},
+ {STRING16_LITERAL(""), {nullptr}},
+ {STRING16_LITERAL(",,"), {nullptr}},
};
for (const auto& t : cases) {
@@ -89,7 +89,7 @@
adapter->IfType = info.if_type;
adapter->OperStatus = info.oper_status;
adapter->DnsSuffix = const_cast<PWCHAR>(info.dns_suffix);
- IP_ADAPTER_DNS_SERVER_ADDRESS* address = NULL;
+ IP_ADAPTER_DNS_SERVER_ADDRESS* address = nullptr;
for (size_t j = 0; !info.dns_server_addresses[j].empty(); ++j) {
--num_addresses;
if (j == 0) {
diff --git a/net/dns/dns_response.cc b/net/dns/dns_response.cc
index 7deef945..2e7fab29 100644
--- a/net/dns/dns_response.cc
+++ b/net/dns/dns_response.cc
@@ -113,7 +113,8 @@
(owned_rdata.empty() ? rdata.size() : owned_rdata.size());
}
-DnsRecordParser::DnsRecordParser() : packet_(nullptr), length_(0), cur_(0) {}
+DnsRecordParser::DnsRecordParser()
+ : packet_(nullptr), length_(0), cur_(nullptr) {}
DnsRecordParser::DnsRecordParser(const void* packet,
size_t length,
diff --git a/net/dns/dns_response.h b/net/dns/dns_response.h
index 1335d2b9..33c6397 100644
--- a/net/dns/dns_response.h
+++ b/net/dns/dns_response.h
@@ -76,7 +76,7 @@
DnsRecordParser(const void* packet, size_t length, size_t offset);
// Returns |true| if initialized.
- bool IsValid() const { return packet_ != NULL; }
+ bool IsValid() const { return packet_ != nullptr; }
// Returns |true| if no more bytes remain in the packet.
bool AtEnd() const { return cur_ == packet_ + length_; }
diff --git a/net/dns/dns_response_unittest.cc b/net/dns/dns_response_unittest.cc
index a71732f..41bf66e 100644
--- a/net/dns/dns_response_unittest.cc
+++ b/net/dns/dns_response_unittest.cc
@@ -68,14 +68,14 @@
EXPECT_EQ("bar.example.com", out);
// Parse name without storing it.
- EXPECT_EQ(0x11u, parser.ReadName(data + 0x00, NULL));
- EXPECT_EQ(0x1u, parser.ReadName(data + 0x10, NULL));
- EXPECT_EQ(0x6u, parser.ReadName(data + 0x11, NULL));
- EXPECT_EQ(0x2u, parser.ReadName(data + 0x17, NULL));
+ EXPECT_EQ(0x11u, parser.ReadName(data + 0x00, nullptr));
+ EXPECT_EQ(0x1u, parser.ReadName(data + 0x10, nullptr));
+ EXPECT_EQ(0x6u, parser.ReadName(data + 0x11, nullptr));
+ EXPECT_EQ(0x2u, parser.ReadName(data + 0x17, nullptr));
// Check that it works even if initial position is different.
parser = DnsRecordParser(data, sizeof(data), 0x12);
- EXPECT_EQ(0x6u, parser.ReadName(data + 0x11, NULL));
+ EXPECT_EQ(0x6u, parser.ReadName(data + 0x11, nullptr));
}
TEST(DnsRecordParserTest, ReadNameFail) {
diff --git a/net/dns/dns_session_unittest.cc b/net/dns/dns_session_unittest.cc
index 3889439..8afa5b7 100644
--- a/net/dns/dns_session_unittest.cc
+++ b/net/dns/dns_session_unittest.cc
@@ -143,7 +143,7 @@
session_ =
new DnsSession(config_, std::unique_ptr<DnsSocketPool>(dns_socket_pool),
- base::Bind(&base::RandInt), NULL /* NetLog */);
+ base::Bind(&base::RandInt), nullptr /* NetLog */);
events_.clear();
}
diff --git a/net/dns/dns_socket_pool.cc b/net/dns/dns_socket_pool.cc
index 5922d39..1abb206 100644
--- a/net/dns/dns_socket_pool.cc
+++ b/net/dns/dns_socket_pool.cc
@@ -42,8 +42,8 @@
const RandIntCallback& rand_int_callback)
: socket_factory_(socket_factory),
rand_int_callback_(rand_int_callback),
- net_log_(NULL),
- nameservers_(NULL),
+ net_log_(nullptr),
+ nameservers_(nullptr),
initialized_(false) {}
void DnsSocketPool::InitializeInternal(
@@ -64,7 +64,8 @@
return std::unique_ptr<StreamSocket>(
socket_factory_->CreateTransportClientSocket(
- AddressList((*nameservers_)[server_index]), NULL, net_log_, source));
+ AddressList((*nameservers_)[server_index]), nullptr, net_log_,
+ source));
}
std::unique_ptr<DatagramClientSocket> DnsSocketPool::CreateConnectedSocket(
diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc
index b02fa0876..c428f52 100644
--- a/net/dns/dns_test_util.cc
+++ b/net/dns/dns_test_util.cc
@@ -498,11 +498,11 @@
}
const DnsConfig* MockDnsClient::GetConfig() const {
- return config_.IsValid() ? &config_ : NULL;
+ return config_.IsValid() ? &config_ : nullptr;
}
DnsTransactionFactory* MockDnsClient::GetTransactionFactory() {
- return config_.IsValid() ? factory_.get() : NULL;
+ return config_.IsValid() ? factory_.get() : nullptr;
}
AddressSorter* MockDnsClient::GetAddressSorter() {
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc
index 57f1cbd..8be8918 100644
--- a/net/dns/dns_transaction.cc
+++ b/net/dns/dns_transaction.cc
@@ -205,7 +205,7 @@
const DnsResponse* GetResponse() const override {
const DnsResponse* resp = response_.get();
- return (resp != NULL && resp->IsValid()) ? resp : NULL;
+ return (resp != nullptr && resp->IsValid()) ? resp : nullptr;
}
const NetLogWithSource& GetSocketNetLog() const override {
@@ -419,7 +419,7 @@
const DnsQuery* GetQuery() const override { return query_.get(); }
const DnsResponse* GetResponse() const override {
const DnsResponse* resp = response_.get();
- return (resp != NULL && resp->IsValid()) ? resp : NULL;
+ return (resp != nullptr && resp->IsValid()) ? resp : nullptr;
}
const NetLogWithSource& GetSocketNetLog() const override { return net_log_; }
bool secure() const override { return true; }
@@ -579,7 +579,7 @@
const DnsResponse* GetResponse() const override {
const DnsResponse* resp = response_.get();
- return (resp != NULL && resp->IsValid()) ? resp : NULL;
+ return (resp != nullptr && resp->IsValid()) ? resp : nullptr;
}
const NetLogWithSource& GetSocketNetLog() const override {
@@ -845,7 +845,7 @@
DCHECK(attempts_.empty());
net_log_.BeginEvent(NetLogEventType::DNS_TRANSACTION,
base::Bind(&NetLogStartCallback, &hostname_, qtype_));
- AttemptResult result(PrepareSearch(), NULL);
+ AttemptResult result(PrepareSearch(), nullptr);
if (result.rv == OK) {
qnames_initial_size_ = qnames_.size();
result = ProcessAttemptResult(StartQuery());
@@ -937,8 +937,8 @@
return;
const DnsResponse* response =
- result.attempt ? result.attempt->GetResponse() : NULL;
- CHECK(result.rv != OK || response != NULL);
+ result.attempt ? result.attempt->GetResponse() : nullptr;
+ CHECK(result.rv != OK || response != nullptr);
bool secure = result.attempt ? result.attempt->secure() : false;
@@ -1000,7 +1000,7 @@
++attempts_count_;
if (!got_socket)
- return AttemptResult(ERR_CONNECTION_REFUSED, NULL);
+ return AttemptResult(ERR_CONNECTION_REFUSED, nullptr);
net_log_.AddEvent(
NetLogEventType::DNS_TRANSACTION_ATTEMPT,
@@ -1214,7 +1214,7 @@
if (result.attempt != attempts_.back().get()) {
// This attempt already timed out. Ignore it.
session_->RecordServerFailure(result.attempt->server_index());
- return AttemptResult(ERR_IO_PENDING, NULL);
+ return AttemptResult(ERR_IO_PENDING, nullptr);
}
if (!MoreAttemptsAllowed()) {
return result;
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc
index db3e7c58..e20b7857 100644
--- a/net/dns/dns_transaction_unittest.cc
+++ b/net/dns/dns_transaction_unittest.cc
@@ -312,8 +312,8 @@
}
void Cancel() {
- ASSERT_TRUE(transaction_.get() != NULL);
- transaction_.reset(NULL);
+ ASSERT_TRUE(transaction_.get() != nullptr);
+ transaction_.reset(nullptr);
}
void OnTransactionComplete(DnsTransaction* t,
@@ -339,7 +339,7 @@
if (expected_answer_count_ >= 0) {
ASSERT_THAT(rv, IsOk());
- ASSERT_TRUE(response != NULL);
+ ASSERT_TRUE(response != nullptr);
EXPECT_EQ(static_cast<unsigned>(expected_answer_count_),
response->answer_count());
EXPECT_EQ(qtype_, response->qtype());
@@ -593,7 +593,7 @@
DnsSocketPool::CreateNull(socket_factory_.get(),
base::Bind(base::RandInt)),
base::Bind(&DnsTransactionTestBase::GetNextId, base::Unretained(this)),
- NULL /* NetLog */);
+ nullptr /* NetLog */);
transaction_factory_ = DnsTransactionFactory::CreateFactory(session_.get());
}
@@ -982,7 +982,7 @@
helper0.StartTransaction(transaction_factory_.get());
// Destroying the client does not affect running requests.
- transaction_factory_.reset(NULL);
+ transaction_factory_.reset(nullptr);
base::RunLoop().RunUntilIdle();
diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc
index 9a997a2..ed4b72f 100644
--- a/net/dns/host_resolver_manager.cc
+++ b/net/dns/host_resolver_manager.cc
@@ -282,12 +282,12 @@
// Map the error code to a human-readable string.
LPWSTR error_string = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- 0, // Use the internal message table.
+ nullptr, // Use the internal message table.
os_error,
0, // Use default language.
(LPWSTR)&error_string,
- 0, // Buffer size.
- 0); // Arguments (unused).
+ 0, // Buffer size.
+ nullptr); // Arguments (unused).
dict->SetString("os_error_string", base::WideToUTF8(error_string));
LocalFree(error_string);
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
@@ -2116,7 +2116,7 @@
HostResolverManager::HostResolverManager(const Options& options,
NetLog* net_log)
: max_queued_jobs_(0),
- proc_params_(NULL, options.max_retry_attempts),
+ proc_params_(nullptr, options.max_retry_attempts),
net_log_(net_log),
received_dns_config_(false),
num_dns_failures_(0),
diff --git a/net/dns/host_resolver_manager_unittest.cc b/net/dns/host_resolver_manager_unittest.cc
index 626a2e6..80ca8c5 100644
--- a/net/dns/host_resolver_manager_unittest.cc
+++ b/net/dns/host_resolver_manager_unittest.cc
@@ -109,7 +109,7 @@
typedef std::vector<ResolveKey> CaptureList;
MockHostResolverProc()
- : HostResolverProc(NULL),
+ : HostResolverProc(nullptr),
num_requests_waiting_(0),
num_slots_available_(0),
requests_waiting_(&lock_),
@@ -498,7 +498,8 @@
bool ipv6_reachable) {
HostResolverManager::Options options = DefaultOptions();
options.max_concurrent_resolves = max_concurrent_resolves;
- resolver_.reset(new TestHostResolverManager(options, NULL, ipv6_reachable));
+ resolver_.reset(
+ new TestHostResolverManager(options, nullptr, ipv6_reachable));
resolver_->set_proc_params_for_test(params);
}
@@ -1770,7 +1771,7 @@
base::TimeDelta kSleepFudgeFactor = base::TimeDelta::FromMilliseconds(1);
scoped_refptr<LookupAttemptHostResolverProc> resolver_proc(
- new LookupAttemptHostResolverProc(NULL, kAttemptNumberToResolve,
+ new LookupAttemptHostResolverProc(nullptr, kAttemptNumberToResolve,
kTotalAttempts));
ProcTaskParams params = DefaultParams(resolver_proc.get());
@@ -2798,7 +2799,7 @@
// Specialized fixture for tests of DnsTask.
class HostResolverManagerDnsTest : public HostResolverManagerTest {
public:
- HostResolverManagerDnsTest() : dns_client_(NULL) {}
+ HostResolverManagerDnsTest() : dns_client_(nullptr) {}
protected:
// testing::Test implementation:
@@ -2815,7 +2816,8 @@
bool ipv6_reachable) override {
HostResolverManager::Options options = DefaultOptions();
options.max_concurrent_resolves = max_concurrent_resolves;
- resolver_.reset(new TestHostResolverManager(options, NULL, ipv6_reachable));
+ resolver_.reset(
+ new TestHostResolverManager(options, nullptr, ipv6_reachable));
resolver_->set_proc_params_for_test(params);
UseMockDnsClient(DnsConfig(), CreateDefaultDnsRules());
}
diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
index ab5e16f..90d9958 100644
--- a/net/dns/host_resolver_proc.cc
+++ b/net/dns/host_resolver_proc.cc
@@ -27,7 +27,7 @@
bool IsAllLocalhostOfOneFamily(const struct addrinfo* ai) {
bool saw_v4_localhost = false;
bool saw_v6_localhost = false;
- for (; ai != NULL; ai = ai->ai_next) {
+ for (; ai != nullptr; ai = ai->ai_next) {
switch (ai->ai_family) {
case AF_INET: {
const struct sockaddr_in* addr_in =
@@ -59,7 +59,7 @@
} // namespace
-HostResolverProc* HostResolverProc::default_proc_ = NULL;
+HostResolverProc* HostResolverProc::default_proc_ = nullptr;
HostResolverProc::HostResolverProc(HostResolverProc* previous) {
SetPreviousProc(previous);
@@ -89,7 +89,7 @@
void HostResolverProc::SetPreviousProc(HostResolverProc* proc) {
HostResolverProc* current_previous = previous_proc_.get();
- previous_proc_ = NULL;
+ previous_proc_ = nullptr;
// Now that we've guaranteed |this| is the last proc in a chain, we can
// detect potential cycles using GetLastProc().
previous_proc_ = (GetLastProc(proc) == this) ? current_previous : proc;
@@ -101,10 +101,10 @@
// static
HostResolverProc* HostResolverProc::GetLastProc(HostResolverProc* proc) {
- if (proc == NULL)
- return NULL;
+ if (proc == nullptr)
+ return nullptr;
HostResolverProc* last_proc = proc;
- while (last_proc->previous_proc_.get() != NULL)
+ while (last_proc->previous_proc_.get() != nullptr)
last_proc = last_proc->previous_proc_.get();
return last_proc;
}
@@ -133,7 +133,7 @@
if (os_error)
*os_error = 0;
- struct addrinfo* ai = NULL;
+ struct addrinfo* ai = nullptr;
struct addrinfo hints = {0};
switch (address_family) {
@@ -201,7 +201,7 @@
!defined(OS_ANDROID) && !defined(OS_FUCHSIA)
DnsReloaderMaybeReload();
#endif
- int err = getaddrinfo(host.c_str(), NULL, &hints, &ai);
+ int err = getaddrinfo(host.c_str(), nullptr, &hints, &ai);
bool should_retry = false;
// If the lookup was restricted (either by address family, or address
// detection), and the results where all localhost of a single family,
@@ -219,11 +219,11 @@
}
}
if (should_retry) {
- if (ai != NULL) {
+ if (ai != nullptr) {
freeaddrinfo(ai);
- ai = NULL;
+ ai = nullptr;
}
- err = getaddrinfo(host.c_str(), NULL, &hints, &ai);
+ err = getaddrinfo(host.c_str(), nullptr, &hints, &ai);
}
if (err) {
@@ -260,7 +260,7 @@
return OK;
}
-SystemHostResolverProc::SystemHostResolverProc() : HostResolverProc(NULL) {}
+SystemHostResolverProc::SystemHostResolverProc() : HostResolverProc(nullptr) {}
int SystemHostResolverProc::Resolve(const std::string& hostname,
AddressFamily address_family,
diff --git a/net/dns/mdns_client_impl.cc b/net/dns/mdns_client_impl.cc
index 164fdbf..af9c2eae 100644
--- a/net/dns/mdns_client_impl.cc
+++ b/net/dns/mdns_client_impl.cc
@@ -435,7 +435,7 @@
}
bool MDnsClientImpl::IsListening() const {
- return core_.get() != NULL;
+ return core_.get() != nullptr;
}
std::unique_ptr<MDnsListener> MDnsClientImpl::CreateListener(
@@ -675,9 +675,9 @@
void MDnsTransactionImpl::SignalTransactionOver() {
DCHECK(started_);
if (flags_ & MDnsTransaction::SINGLE_RESULT) {
- TriggerCallback(MDnsTransaction::RESULT_NO_RESULTS, NULL);
+ TriggerCallback(MDnsTransaction::RESULT_NO_RESULTS, nullptr);
} else {
- TriggerCallback(MDnsTransaction::RESULT_DONE, NULL);
+ TriggerCallback(MDnsTransaction::RESULT_DONE, nullptr);
}
}
@@ -700,7 +700,7 @@
records.front()->rdata<NsecRecordRdata>();
DCHECK(rdata);
if (!rdata->GetBit(rrtype_))
- weak_this->TriggerCallback(MDnsTransaction::RESULT_NSEC, NULL);
+ weak_this->TriggerCallback(MDnsTransaction::RESULT_NSEC, nullptr);
}
}
#endif
@@ -725,7 +725,7 @@
}
void MDnsTransactionImpl::OnNsecRecord(const std::string& name, unsigned type) {
- TriggerCallback(RESULT_NSEC, NULL);
+ TriggerCallback(RESULT_NSEC, nullptr);
}
void MDnsTransactionImpl::OnCachePurged() {
diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc
index 0b61518c..ed31768 100644
--- a/net/dns/mock_host_resolver.cc
+++ b/net/dns/mock_host_resolver.cc
@@ -829,7 +829,7 @@
}
RuleBasedHostResolverProc* CreateCatchAllHostResolverProc() {
- RuleBasedHostResolverProc* catchall = new RuleBasedHostResolverProc(NULL);
+ RuleBasedHostResolverProc* catchall = new RuleBasedHostResolverProc(nullptr);
// Note that IPv6 lookups fail.
catchall->AddIPLiteralRule("*", "127.0.0.1", "localhost");
diff --git a/net/dns/record_parsed.h b/net/dns/record_parsed.h
index be227d4..27d771d 100644
--- a/net/dns/record_parsed.h
+++ b/net/dns/record_parsed.h
@@ -38,7 +38,7 @@
template <class T> const T* rdata() const {
if (T::kType != type_)
- return NULL;
+ return nullptr;
return static_cast<const T*>(rdata_.get());
}
diff --git a/net/dns/record_parsed_unittest.cc b/net/dns/record_parsed_unittest.cc
index fdb37aa..c60f18c 100644
--- a/net/dns/record_parsed_unittest.cc
+++ b/net/dns/record_parsed_unittest.cc
@@ -31,14 +31,14 @@
parser.SkipQuestion();
record = RecordParsed::CreateFrom(&parser, base::Time());
- EXPECT_TRUE(record != NULL);
+ EXPECT_TRUE(record != nullptr);
ASSERT_EQ("codereview.chromium.org", record->name());
ASSERT_EQ(dns_protocol::kTypeCNAME, record->type());
ASSERT_EQ(dns_protocol::kClassIN, record->klass());
rdata = record->rdata<CnameRecordRdata>();
- ASSERT_TRUE(rdata != NULL);
+ ASSERT_TRUE(rdata != nullptr);
ASSERT_EQ(kT1CanonName, rdata->cname());
ASSERT_FALSE(record->rdata<SrvRecordRdata>());
diff --git a/net/dns/record_rdata.cc b/net/dns/record_rdata.cc
index a284224..87c707e 100644
--- a/net/dns/record_rdata.cc
+++ b/net/dns/record_rdata.cc
@@ -231,7 +231,7 @@
// Read the "next domain". This part for the NSEC record format is
// ignored for mDNS, since it has no semantic meaning.
- unsigned next_domain_length = parser.ReadName(data.data(), NULL);
+ unsigned next_domain_length = parser.ReadName(data.data(), nullptr);
// If we did not succeed in getting the next domain or the data length
// is too short for reading the bitmap header, return.
diff --git a/net/dns/record_rdata_unittest.cc b/net/dns/record_rdata_unittest.cc
index d5765478..827a29e 100644
--- a/net/dns/record_rdata_unittest.cc
+++ b/net/dns/record_rdata_unittest.cc
@@ -46,7 +46,7 @@
std::unique_ptr<SrvRecordRdata> record1_obj =
SrvRecordRdata::Create(record1_strpiece, parser);
- ASSERT_TRUE(record1_obj != NULL);
+ ASSERT_TRUE(record1_obj != nullptr);
ASSERT_EQ(1, record1_obj->priority());
ASSERT_EQ(2, record1_obj->weight());
ASSERT_EQ(80, record1_obj->port());
@@ -55,7 +55,7 @@
std::unique_ptr<SrvRecordRdata> record2_obj =
SrvRecordRdata::Create(record2_strpiece, parser);
- ASSERT_TRUE(record2_obj != NULL);
+ ASSERT_TRUE(record2_obj != nullptr);
ASSERT_EQ(257, record2_obj->priority());
ASSERT_EQ(258, record2_obj->weight());
ASSERT_EQ(259, record2_obj->port());
@@ -79,7 +79,7 @@
std::unique_ptr<ARecordRdata> record_obj =
ARecordRdata::Create(record_strpiece, parser);
- ASSERT_TRUE(record_obj != NULL);
+ ASSERT_TRUE(record_obj != nullptr);
ASSERT_EQ("127.0.0.1", record_obj->address().ToString());
@@ -100,7 +100,7 @@
std::unique_ptr<AAAARecordRdata> record_obj =
AAAARecordRdata::Create(record_strpiece, parser);
- ASSERT_TRUE(record_obj != NULL);
+ ASSERT_TRUE(record_obj != nullptr);
ASSERT_EQ("1234:5678::9", record_obj->address().ToString());
@@ -119,7 +119,7 @@
std::unique_ptr<CnameRecordRdata> record_obj =
CnameRecordRdata::Create(record_strpiece, parser);
- ASSERT_TRUE(record_obj != NULL);
+ ASSERT_TRUE(record_obj != nullptr);
ASSERT_EQ("www.google.com", record_obj->cname());
@@ -138,7 +138,7 @@
std::unique_ptr<PtrRecordRdata> record_obj =
PtrRecordRdata::Create(record_strpiece, parser);
- ASSERT_TRUE(record_obj != NULL);
+ ASSERT_TRUE(record_obj != nullptr);
ASSERT_EQ("www.google.com", record_obj->ptrdomain());
@@ -157,7 +157,7 @@
std::unique_ptr<TxtRecordRdata> record_obj =
TxtRecordRdata::Create(record_strpiece, parser);
- ASSERT_TRUE(record_obj != NULL);
+ ASSERT_TRUE(record_obj != nullptr);
std::vector<std::string> expected;
expected.push_back("www");
@@ -182,7 +182,7 @@
std::unique_ptr<NsecRecordRdata> record_obj =
NsecRecordRdata::Create(record_strpiece, parser);
- ASSERT_TRUE(record_obj != NULL);
+ ASSERT_TRUE(record_obj != nullptr);
ASSERT_EQ(16u, record_obj->bitmap_length());
diff --git a/net/extras/sqlite/sqlite_channel_id_store_unittest.cc b/net/extras/sqlite/sqlite_channel_id_store_unittest.cc
index 5ff05b9..7d2e245 100644
--- a/net/extras/sqlite/sqlite_channel_id_store_unittest.cc
+++ b/net/extras/sqlite/sqlite_channel_id_store_unittest.cc
@@ -127,7 +127,7 @@
// Replace the store effectively destroying the current one and forcing it
// to write its data to disk. Then we can see if after loading it again it
// is still there.
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
store_ = new SQLiteChannelIDStore(
@@ -156,7 +156,7 @@
// Now delete the keypair and check persistence again.
store_->DeleteChannelID(*channel_ids[0]);
store_->DeleteChannelID(*channel_ids[1]);
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
channel_ids.clear();
@@ -168,7 +168,7 @@
Load(&channel_ids);
ASSERT_EQ(0U, channel_ids.size());
// Close the store.
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
}
@@ -183,7 +183,7 @@
// Replace the store effectively destroying the current one and forcing it
// to write its data to disk. Then we can see if after loading it again it
// is still there.
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
store_ = new SQLiteChannelIDStore(
@@ -200,7 +200,7 @@
store_->DeleteAllInList(delete_server_identifiers);
// Now check persistence again.
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
channel_ids.clear();
@@ -213,14 +213,14 @@
ASSERT_EQ(1U, channel_ids.size());
ASSERT_EQ("foo.com", channel_ids[0]->server_identifier());
// Close the store.
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
}
TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV1) {
// Reset the store. We'll be using a different database for this test.
- store_ = NULL;
+ store_ = nullptr;
base::FilePath v1_db_path(temp_dir_.GetPath().AppendASCII("v1db"));
@@ -272,7 +272,7 @@
Load(&channel_ids);
ASSERT_EQ(0U, channel_ids.size());
- store_ = NULL;
+ store_ = nullptr;
base::RunLoop().RunUntilIdle();
// Verify the database version is updated.
@@ -290,7 +290,7 @@
TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV2) {
// Reset the store. We'll be using a different database for this test.
- store_ = NULL;
+ store_ = nullptr;
base::FilePath v2_db_path(temp_dir_.GetPath().AppendASCII("v2db"));
@@ -346,7 +346,7 @@
Load(&channel_ids);
ASSERT_EQ(0U, channel_ids.size());
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
@@ -365,7 +365,7 @@
TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV3) {
// Reset the store. We'll be using a different database for this test.
- store_ = NULL;
+ store_ = nullptr;
base::FilePath v3_db_path(temp_dir_.GetPath().AppendASCII("v3db"));
@@ -423,7 +423,7 @@
Load(&channel_ids);
ASSERT_EQ(0U, channel_ids.size());
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
@@ -442,7 +442,7 @@
TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV4) {
// Reset the store. We'll be using a different database for this test.
- store_ = NULL;
+ store_ = nullptr;
base::FilePath v4_db_path(temp_dir_.GetPath().AppendASCII("v4db"));
@@ -516,7 +516,7 @@
Load(&channel_ids);
ASSERT_EQ(0U, channel_ids.size());
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
@@ -535,7 +535,7 @@
TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV5) {
// Reset the store. We'll be using a different database for this test.
- store_ = NULL;
+ store_ = nullptr;
base::FilePath v5_db_path(temp_dir_.GetPath().AppendASCII("v5db"));
@@ -591,7 +591,7 @@
Load(&channel_ids);
ASSERT_EQ(0U, channel_ids.size());
- store_ = NULL;
+ store_ = nullptr;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store.cc b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
index fb891be..d66909b 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
@@ -747,7 +747,7 @@
if (initialized_ || corruption_detected_) {
// Return false if we were previously initialized but the DB has since been
// closed, or if corruption caused a database reset during initialization.
- return db_ != NULL;
+ return db_ != nullptr;
}
base::Time start = base::Time::Now();
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc b/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc
index 71005556..14074cf 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc
@@ -87,7 +87,7 @@
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
store_ = new SQLitePersistentCookieStore(
temp_dir_.GetPath().Append(cookie_filename), client_task_runner_,
- background_task_runner_, false, NULL);
+ background_task_runner_, false, nullptr);
std::vector<CanonicalCookie*> cookies;
Load();
ASSERT_EQ(0u, cookies_.size());
@@ -99,14 +99,14 @@
}
// Replace the store effectively destroying the current one and forcing it
// to write its data to disk.
- store_ = NULL;
+ store_ = nullptr;
// Flush TaskScheduler tasks, causing pending commits to run.
scoped_task_environment_.RunUntilIdle();
store_ = new SQLitePersistentCookieStore(
temp_dir_.GetPath().Append(cookie_filename), client_task_runner_,
- background_task_runner_, false, NULL);
+ background_task_runner_, false, nullptr);
}
// Pick a random cookie out of the 15000 in the store and return it.
@@ -120,9 +120,7 @@
return CookieFromIndices(domain, cookie_num);
}
- void TearDown() override {
- store_ = NULL;
- }
+ void TearDown() override { store_ = nullptr; }
void StartPerfMeasurement() {
DCHECK(perf_measurement_start_.is_null());
diff --git a/net/filter/gzip_header.cc b/net/filter/gzip_header.cc
index a34aece..2ffd9ee 100644
--- a/net/filter/gzip_header.cc
+++ b/net/filter/gzip_header.cc
@@ -123,7 +123,7 @@
}
// See if we can find the end of the \0-terminated FNAME field.
pos = reinterpret_cast<const uint8_t*>(memchr(pos, '\0', (end - pos)));
- if ( pos != NULL ) {
+ if (pos != nullptr) {
pos++; // advance past the '\0'
flags_ &= ~FLAG_FNAME; // we're done with the FNAME stuff
state_ = IN_FCOMMENT;
@@ -139,7 +139,7 @@
}
// See if we can find the end of the \0-terminated FCOMMENT field.
pos = reinterpret_cast<const uint8_t*>(memchr(pos, '\0', (end - pos)));
- if ( pos != NULL ) {
+ if (pos != nullptr) {
pos++; // advance past the '\0'
flags_ &= ~FLAG_FCOMMENT; // we're done with the FCOMMENT stuff
state_ = IN_FHCRC_BYTE_0;
diff --git a/net/ftp/ftp_auth_cache.cc b/net/ftp/ftp_auth_cache.cc
index 129906cf..63da9ae 100644
--- a/net/ftp/ftp_auth_cache.cc
+++ b/net/ftp/ftp_auth_cache.cc
@@ -29,7 +29,7 @@
if (it->origin == origin)
return &(*it);
}
- return NULL;
+ return nullptr;
}
void FtpAuthCache::Add(const GURL& origin, const AuthCredentials& credentials) {
diff --git a/net/ftp/ftp_auth_cache_unittest.cc b/net/ftp/ftp_auth_cache_unittest.cc
index e6eaa87..af3ea7c 100644
--- a/net/ftp/ftp_auth_cache_unittest.cc
+++ b/net/ftp/ftp_auth_cache_unittest.cc
@@ -38,7 +38,7 @@
GURL origin2("ftp://foo2");
// Lookup non-existent entry.
- EXPECT_TRUE(cache.Lookup(origin1) == NULL);
+ EXPECT_TRUE(cache.Lookup(origin1) == nullptr);
// Add entry for origin1.
cache.Add(origin1, AuthCredentials(kUsername1, kPassword1));
@@ -69,11 +69,11 @@
// Remove entry of origin1.
cache.Remove(origin1, AuthCredentials(kUsername3, kPassword3));
- EXPECT_TRUE(cache.Lookup(origin1) == NULL);
+ EXPECT_TRUE(cache.Lookup(origin1) == nullptr);
// Remove non-existent entry.
cache.Remove(origin1, AuthCredentials(kUsername3, kPassword3));
- EXPECT_TRUE(cache.Lookup(origin1) == NULL);
+ EXPECT_TRUE(cache.Lookup(origin1) == nullptr);
}
// Check that if the origin differs only by port number, it is considered
@@ -116,7 +116,7 @@
// Remove
cache.Remove(GURL("ftp://HOsT"), AuthCredentials(kOthername, kOtherword));
- EXPECT_TRUE(cache.Lookup(GURL("ftp://host")) == NULL);
+ EXPECT_TRUE(cache.Lookup(GURL("ftp://host")) == nullptr);
}
TEST(FtpAuthCacheTest, OnlyRemoveMatching) {
@@ -131,7 +131,7 @@
// Auth data matches, should remove.
cache.Remove(GURL("ftp://host"), AuthCredentials(kUsername, kPassword));
- EXPECT_TRUE(cache.Lookup(GURL("ftp://host")) == NULL);
+ EXPECT_TRUE(cache.Lookup(GURL("ftp://host")) == nullptr);
}
TEST(FtpAuthCacheTest, EvictOldEntries) {
@@ -149,7 +149,7 @@
// Adding one entry should cause eviction of the first entry.
cache.Add(GURL("ftp://last_host"), AuthCredentials(kUsername, kPassword));
- EXPECT_TRUE(cache.Lookup(GURL("ftp://host0")) == NULL);
+ EXPECT_TRUE(cache.Lookup(GURL("ftp://host0")) == nullptr);
// Remaining entries should not get evicted.
for (size_t i = 1; i < FtpAuthCache::kMaxEntries; i++) {
diff --git a/net/http/failing_http_transaction_factory.cc b/net/http/failing_http_transaction_factory.cc
index 2ee5fc8..4d3a609 100644
--- a/net/http/failing_http_transaction_factory.cc
+++ b/net/http/failing_http_transaction_factory.cc
@@ -211,7 +211,7 @@
}
HttpCache* FailingHttpTransactionFactory::GetCache() {
- return NULL;
+ return nullptr;
}
HttpNetworkSession* FailingHttpTransactionFactory::GetSession() {
diff --git a/net/http/http_auth.cc b/net/http/http_auth.cc
index 68ae3b1f..7aa3b60 100644
--- a/net/http/http_auth.cc
+++ b/net/http/http_auth.cc
@@ -35,7 +35,7 @@
HostResolver* host_resolver,
std::unique_ptr<HttpAuthHandler>* handler) {
DCHECK(http_auth_handler_factory);
- DCHECK(handler->get() == NULL);
+ DCHECK(handler->get() == nullptr);
// Choose the challenge whose authentication handler gives the maximum score.
std::unique_ptr<HttpAuthHandler> best;
diff --git a/net/http/http_auth_cache_unittest.cc b/net/http/http_auth_cache_unittest.cc
index 41016b0..f54049b 100644
--- a/net/http/http_auth_cache_unittest.cc
+++ b/net/http/http_auth_cache_unittest.cc
@@ -322,7 +322,7 @@
// lookup.
HttpAuthCache::Entry* entry = cache.Lookup(
origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST);
- EXPECT_FALSE(NULL == entry);
+ EXPECT_FALSE(nullptr == entry);
}
TEST(HttpAuthCacheTest, ClearEntriesAddedSince) {
@@ -461,7 +461,7 @@
"nonce=\"s3MzvFhaBAA=4c520af5acd9d8d7ae26947529d18c8eae1e98f4\"",
CreateASCIICredentials("realm-digest-user", "realm-digest-password"),
"/baz/index.html");
- ASSERT_TRUE(entry_pre != NULL);
+ ASSERT_TRUE(entry_pre != nullptr);
EXPECT_EQ(2, entry_pre->IncrementNonceCount());
EXPECT_EQ(3, entry_pre->IncrementNonceCount());
@@ -478,7 +478,7 @@
// the nonce count should be reset to 0.
HttpAuthCache::Entry* entry_post =
cache.Lookup(origin, kRealm1, HttpAuth::AUTH_SCHEME_DIGEST);
- ASSERT_TRUE(entry_post != NULL);
+ ASSERT_TRUE(entry_post != nullptr);
EXPECT_EQ(2, entry_post->IncrementNonceCount());
// UpdateStaleChallenge will fail if an entry doesn't exist in the cache.
@@ -524,19 +524,19 @@
// Copied from first_cache.
entry = second_cache.Lookup(origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC);
- EXPECT_TRUE(NULL != entry);
+ EXPECT_TRUE(nullptr != entry);
EXPECT_EQ(kAlice, entry->credentials().username());
EXPECT_EQ(k123, entry->credentials().password());
// Copied from first_cache.
entry = second_cache.Lookup(origin, kRealm2, HttpAuth::AUTH_SCHEME_BASIC);
- EXPECT_TRUE(NULL != entry);
+ EXPECT_TRUE(nullptr != entry);
EXPECT_EQ(kAlice2, entry->credentials().username());
EXPECT_EQ(k1234, entry->credentials().password());
// Overwritten from first_cache.
entry = second_cache.Lookup(origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST);
- EXPECT_TRUE(NULL != entry);
+ EXPECT_TRUE(nullptr != entry);
EXPECT_EQ(kRoot, entry->credentials().username());
EXPECT_EQ(kWileCoyote, entry->credentials().password());
// Nonce count should get copied.
@@ -544,13 +544,13 @@
// All paths should get copied.
entry = second_cache.LookupByPath(origin, another_path);
- EXPECT_TRUE(NULL != entry);
+ EXPECT_TRUE(nullptr != entry);
EXPECT_EQ(kRoot, entry->credentials().username());
EXPECT_EQ(kWileCoyote, entry->credentials().password());
// Left intact in second_cache.
entry = second_cache.Lookup(origin, kRealm4, HttpAuth::AUTH_SCHEME_BASIC);
- EXPECT_TRUE(NULL != entry);
+ EXPECT_TRUE(nullptr != entry);
EXPECT_EQ(kAdmin, entry->credentials().username());
EXPECT_EQ(kRoot, entry->credentials().password());
}
@@ -587,10 +587,10 @@
cache_.Lookup(
origin_, GenerateRealm(realm_i), HttpAuth::AUTH_SCHEME_BASIC);
if (exists) {
- EXPECT_FALSE(entry == NULL);
+ EXPECT_FALSE(entry == nullptr);
EXPECT_EQ(GenerateRealm(realm_i), entry->realm());
} else {
- EXPECT_TRUE(entry == NULL);
+ EXPECT_TRUE(entry == nullptr);
}
}
@@ -598,10 +598,10 @@
const HttpAuthCache::Entry* entry =
cache_.LookupByPath(origin_, GeneratePath(realm_i, path_i));
if (exists) {
- EXPECT_FALSE(entry == NULL);
+ EXPECT_FALSE(entry == nullptr);
EXPECT_EQ(GenerateRealm(realm_i), entry->realm());
} else {
- EXPECT_TRUE(entry == NULL);
+ EXPECT_TRUE(entry == nullptr);
}
}
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
index 12cc4f2..6bb51b9c 100644
--- a/net/http/http_auth_controller.cc
+++ b/net/http/http_auth_controller.cc
@@ -154,7 +154,7 @@
bool needs_auth = HaveAuth() || SelectPreemptiveAuth(net_log);
if (!needs_auth)
return OK;
- const AuthCredentials* credentials = NULL;
+ const AuthCredentials* credentials = nullptr;
if (identity_.source != HttpAuth::IDENT_SRC_DEFAULT_CREDENTIALS)
credentials = &identity_.credentials;
DCHECK(auth_token_.empty());
@@ -385,7 +385,7 @@
}
bool HttpAuthController::HaveAuthHandler() const {
- return handler_.get() != NULL;
+ return handler_.get() != nullptr;
}
bool HttpAuthController::HaveAuth() const {
diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc
index 9aafc81..e79bedfe 100644
--- a/net/http/http_auth_handler.cc
+++ b/net/http/http_auth_handler.cc
@@ -69,8 +69,8 @@
std::string* auth_token) {
DCHECK(!callback.is_null());
DCHECK(request);
- DCHECK(credentials != NULL || AllowsDefaultCredentials());
- DCHECK(auth_token != NULL);
+ DCHECK(credentials != nullptr || AllowsDefaultCredentials());
+ DCHECK(auth_token != nullptr);
DCHECK(callback_.is_null());
callback_ = std::move(callback);
net_log_.BeginEvent(EventTypeFromAuthTarget(target_));
diff --git a/net/http/http_auth_handler_digest_unittest.cc b/net/http/http_auth_handler_digest_unittest.cc
index 4af18578..e4bc09dd 100644
--- a/net/http/http_auth_handler_digest_unittest.cc
+++ b/net/http/http_auth_handler_digest_unittest.cc
@@ -43,7 +43,7 @@
const std::string& challenge,
std::string* token) {
// Input validation.
- if (token == NULL) {
+ if (token == nullptr) {
ADD_FAILURE() << "|token| must be non-NULL";
return false;
}
@@ -66,7 +66,7 @@
int rv_create = factory->CreateAuthHandlerFromString(
challenge, target, null_ssl_info, url_origin.GetOrigin(),
NetLogWithSource(), host_resolver.get(), &handler);
- if (rv_create != OK || handler.get() == NULL) {
+ if (rv_create != OK || handler.get() == nullptr) {
ADD_FAILURE() << "Unable to create auth handler.";
return false;
}
@@ -372,10 +372,10 @@
EXPECT_THAT(rv, IsOk());
} else {
EXPECT_NE(OK, rv);
- EXPECT_TRUE(handler.get() == NULL);
+ EXPECT_TRUE(handler.get() == nullptr);
continue;
}
- ASSERT_TRUE(handler.get() != NULL);
+ ASSERT_TRUE(handler.get() != nullptr);
HttpAuthHandlerDigest* digest =
static_cast<HttpAuthHandlerDigest*>(handler.get());
EXPECT_STREQ(tests[i].parsed_realm, digest->realm_.c_str());
@@ -534,7 +534,7 @@
tests[i].challenge, HttpAuth::AUTH_SERVER, null_ssl_info, origin,
NetLogWithSource(), host_resolver.get(), &handler);
EXPECT_THAT(rv, IsOk());
- ASSERT_TRUE(handler != NULL);
+ ASSERT_TRUE(handler != nullptr);
HttpAuthHandlerDigest* digest =
static_cast<HttpAuthHandlerDigest*>(handler.get());
@@ -564,7 +564,7 @@
default_challenge, HttpAuth::AUTH_SERVER, null_ssl_info, origin,
NetLogWithSource(), host_resolver.get(), &handler);
EXPECT_THAT(rv, IsOk());
- ASSERT_TRUE(handler.get() != NULL);
+ ASSERT_TRUE(handler.get() != nullptr);
HttpAuthChallengeTokenizer tok_default(default_challenge.begin(),
default_challenge.end());
EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT,
diff --git a/net/http/http_auth_handler_factory.cc b/net/http/http_auth_handler_factory.cc
index 0e5610e..c6519b1b 100644
--- a/net/http/http_auth_handler_factory.cc
+++ b/net/http/http_auth_handler_factory.cc
@@ -94,7 +94,7 @@
std::string lower_scheme = base::ToLowerASCII(scheme);
auto it = factory_map_.find(lower_scheme);
if (it == factory_map_.end()) {
- return NULL; // |scheme| is not registered.
+ return nullptr; // |scheme| is not registered.
}
return it->second.get();
}
diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h
index c0e0659..efc3d9e 100644
--- a/net/http/http_auth_handler_factory.h
+++ b/net/http/http_auth_handler_factory.h
@@ -39,7 +39,7 @@
CREATE_PREEMPTIVE, // Create a handler preemptively.
};
- HttpAuthHandlerFactory() : http_auth_preferences_(NULL) {}
+ HttpAuthHandlerFactory() : http_auth_preferences_(nullptr) {}
virtual ~HttpAuthHandlerFactory() {}
// Sets the source of the HTTP authentication preferences.
diff --git a/net/http/http_auth_handler_factory_unittest.cc b/net/http/http_auth_handler_factory_unittest.cc
index b6ae977..8ce2c4a 100644
--- a/net/http/http_auth_handler_factory_unittest.cc
+++ b/net/http/http_auth_handler_factory_unittest.cc
@@ -134,7 +134,7 @@
"Basic realm=\"FooBar\"", HttpAuth::AUTH_SERVER, null_ssl_info,
server_origin, NetLogWithSource(), host_resolver.get(), &handler);
EXPECT_THAT(rv, IsOk());
- ASSERT_FALSE(handler.get() == NULL);
+ ASSERT_FALSE(handler.get() == nullptr);
EXPECT_EQ(HttpAuth::AUTH_SCHEME_BASIC, handler->auth_scheme());
EXPECT_STREQ("FooBar", handler->realm().c_str());
EXPECT_EQ(HttpAuth::AUTH_SERVER, handler->target());
@@ -147,7 +147,7 @@
"UNSUPPORTED realm=\"FooBar\"", HttpAuth::AUTH_SERVER, null_ssl_info,
server_origin, NetLogWithSource(), host_resolver.get(), &handler);
EXPECT_THAT(rv, IsError(ERR_UNSUPPORTED_AUTH_SCHEME));
- EXPECT_TRUE(handler.get() == NULL);
+ EXPECT_TRUE(handler.get() == nullptr);
}
{
std::unique_ptr<HttpAuthHandler> handler;
@@ -156,7 +156,7 @@
null_ssl_info, proxy_origin, NetLogWithSource(), host_resolver.get(),
&handler);
EXPECT_THAT(rv, IsOk());
- ASSERT_FALSE(handler.get() == NULL);
+ ASSERT_FALSE(handler.get() == nullptr);
EXPECT_EQ(HttpAuth::AUTH_SCHEME_DIGEST, handler->auth_scheme());
EXPECT_STREQ("FooBar", handler->realm().c_str());
EXPECT_EQ(HttpAuth::AUTH_PROXY, handler->target());
@@ -169,7 +169,7 @@
"NTLM", HttpAuth::AUTH_SERVER, null_ssl_info, server_origin,
NetLogWithSource(), host_resolver.get(), &handler);
EXPECT_THAT(rv, IsOk());
- ASSERT_FALSE(handler.get() == NULL);
+ ASSERT_FALSE(handler.get() == nullptr);
EXPECT_EQ(HttpAuth::AUTH_SCHEME_NTLM, handler->auth_scheme());
EXPECT_STREQ("", handler->realm().c_str());
EXPECT_EQ(HttpAuth::AUTH_SERVER, handler->target());
@@ -184,7 +184,7 @@
// Note the default factory doesn't support Kerberos on Android
#if BUILDFLAG(USE_KERBEROS) && !defined(OS_ANDROID)
EXPECT_THAT(rv, IsOk());
- ASSERT_FALSE(handler.get() == NULL);
+ ASSERT_FALSE(handler.get() == nullptr);
EXPECT_EQ(HttpAuth::AUTH_SCHEME_NEGOTIATE, handler->auth_scheme());
EXPECT_STREQ("", handler->realm().c_str());
EXPECT_EQ(HttpAuth::AUTH_SERVER, handler->target());
diff --git a/net/http/http_auth_handler_mock.cc b/net/http/http_auth_handler_mock.cc
index 850f20a..791eb8b 100644
--- a/net/http/http_auth_handler_mock.cc
+++ b/net/http/http_auth_handler_mock.cc
@@ -46,7 +46,7 @@
: state_(State::WAIT_FOR_INIT),
generate_async_(false),
generate_rv_(OK),
- auth_token_(NULL),
+ auth_token_(nullptr),
first_round_(true),
connection_based_(false),
allows_default_credentials_(false),
@@ -112,7 +112,7 @@
request_url_ = request->url;
if (generate_async_) {
EXPECT_TRUE(callback_.is_null());
- EXPECT_TRUE(auth_token_ == NULL);
+ EXPECT_TRUE(auth_token_ == nullptr);
callback_ = std::move(callback);
auth_token_ = auth_token;
base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -143,7 +143,7 @@
} else {
state_ = State::DONE;
}
- auth_token_ = NULL;
+ auth_token_ = nullptr;
base::ResetAndReturn(&callback_).Run(generate_rv_);
}
diff --git a/net/http/http_auth_handler_negotiate.cc b/net/http/http_auth_handler_negotiate.cc
index 1733efc..267dc09 100644
--- a/net/http/http_auth_handler_negotiate.cc
+++ b/net/http/http_auth_handler_negotiate.cc
@@ -150,7 +150,7 @@
resolver_(resolver),
already_called_(false),
has_credentials_(false),
- auth_token_(NULL),
+ auth_token_(nullptr),
next_state_(STATE_NONE),
http_auth_preferences_(prefs) {}
@@ -221,10 +221,10 @@
CompletionOnceCallback callback,
std::string* auth_token) {
DCHECK(callback_.is_null());
- DCHECK(auth_token_ == NULL);
+ DCHECK(auth_token_ == nullptr);
auth_token_ = auth_token;
if (already_called_) {
- DCHECK((!has_credentials_ && credentials == NULL) ||
+ DCHECK((!has_credentials_ && credentials == nullptr) ||
(has_credentials_ && credentials->Equals(credentials_)));
next_state_ = STATE_GENERATE_AUTH_TOKEN;
} else {
@@ -375,7 +375,7 @@
int HttpAuthHandlerNegotiate::DoGenerateAuthToken() {
next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE;
- AuthCredentials* credentials = has_credentials_ ? &credentials_ : NULL;
+ AuthCredentials* credentials = has_credentials_ ? &credentials_ : nullptr;
return auth_system_->GenerateAuthToken(
credentials, spn_, channel_bindings_, auth_token_,
base::BindOnce(&HttpAuthHandlerNegotiate::OnIOComplete,
@@ -384,7 +384,7 @@
int HttpAuthHandlerNegotiate::DoGenerateAuthTokenComplete(int rv) {
DCHECK_NE(ERR_IO_PENDING, rv);
- auth_token_ = NULL;
+ auth_token_ = nullptr;
return rv;
}
diff --git a/net/http/http_auth_handler_negotiate_unittest.cc b/net/http/http_auth_handler_negotiate_unittest.cc
index eff278ed..d376a3c 100644
--- a/net/http/http_auth_handler_negotiate_unittest.cc
+++ b/net/http/http_auth_handler_negotiate_unittest.cc
@@ -259,12 +259,12 @@
EXPECT_EQ(OK, CreateHandler(
true, false, true, "http://alias:500", &auth_handler));
- ASSERT_TRUE(auth_handler.get() != NULL);
+ ASSERT_TRUE(auth_handler.get() != nullptr);
TestCompletionCallback callback;
HttpRequestInfo request_info;
std::string token;
EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken(
- NULL, &request_info, callback.callback(), &token)));
+ nullptr, &request_info, callback.callback(), &token)));
#if defined(OS_WIN)
EXPECT_EQ("HTTP/alias", auth_handler->spn_for_testing());
#elif defined(OS_POSIX)
@@ -277,12 +277,12 @@
std::unique_ptr<HttpAuthHandlerNegotiate> auth_handler;
EXPECT_EQ(OK, CreateHandler(
true, true, true, "http://alias:80", &auth_handler));
- ASSERT_TRUE(auth_handler.get() != NULL);
+ ASSERT_TRUE(auth_handler.get() != nullptr);
TestCompletionCallback callback;
HttpRequestInfo request_info;
std::string token;
EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken(
- NULL, &request_info, callback.callback(), &token)));
+ nullptr, &request_info, callback.callback(), &token)));
#if defined(OS_WIN)
EXPECT_EQ("HTTP/alias", auth_handler->spn_for_testing());
#elif defined(OS_POSIX)
@@ -295,12 +295,12 @@
std::unique_ptr<HttpAuthHandlerNegotiate> auth_handler;
EXPECT_EQ(OK, CreateHandler(
true, true, true, "http://alias:500", &auth_handler));
- ASSERT_TRUE(auth_handler.get() != NULL);
+ ASSERT_TRUE(auth_handler.get() != nullptr);
TestCompletionCallback callback;
HttpRequestInfo request_info;
std::string token;
EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken(
- NULL, &request_info, callback.callback(), &token)));
+ nullptr, &request_info, callback.callback(), &token)));
#if defined(OS_WIN)
EXPECT_EQ("HTTP/alias:500", auth_handler->spn_for_testing());
#elif defined(OS_POSIX)
@@ -313,12 +313,12 @@
std::unique_ptr<HttpAuthHandlerNegotiate> auth_handler;
EXPECT_EQ(OK, CreateHandler(
false, false, true, "http://alias:500", &auth_handler));
- ASSERT_TRUE(auth_handler.get() != NULL);
+ ASSERT_TRUE(auth_handler.get() != nullptr);
TestCompletionCallback callback;
HttpRequestInfo request_info;
std::string token;
EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken(
- NULL, &request_info, callback.callback(), &token)));
+ nullptr, &request_info, callback.callback(), &token)));
#if defined(OS_WIN)
EXPECT_EQ("HTTP/canonical.example.com", auth_handler->spn_for_testing());
#elif defined(OS_POSIX)
@@ -331,12 +331,13 @@
std::unique_ptr<HttpAuthHandlerNegotiate> auth_handler;
EXPECT_EQ(OK, CreateHandler(
false, false, false, "http://alias:500", &auth_handler));
- ASSERT_TRUE(auth_handler.get() != NULL);
+ ASSERT_TRUE(auth_handler.get() != nullptr);
TestCompletionCallback callback;
HttpRequestInfo request_info;
std::string token;
- EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken(
- NULL, &request_info, callback.callback(), &token));
+ EXPECT_EQ(ERR_IO_PENDING,
+ auth_handler->GenerateAuthToken(nullptr, &request_info,
+ callback.callback(), &token));
EXPECT_THAT(callback.WaitForResult(), IsOk());
#if defined(OS_WIN)
EXPECT_EQ("HTTP/canonical.example.com", auth_handler->spn_for_testing());
diff --git a/net/http/http_auth_sspi_win.cc b/net/http/http_auth_sspi_win.cc
index 767a4de..d972421 100644
--- a/net/http/http_auth_sspi_win.cc
+++ b/net/http/http_auth_sspi_win.cc
@@ -71,15 +71,15 @@
// Pass the username/password to get the credentials handle.
SECURITY_STATUS status = library->AcquireCredentialsHandle(
- NULL, // pszPrincipal
+ nullptr, // pszPrincipal
const_cast<SEC_WCHAR*>(package), // pszPackage
- SECPKG_CRED_OUTBOUND, // fCredentialUse
- NULL, // pvLogonID
- &identity, // pAuthData
- NULL, // pGetKeyFn (not used)
- NULL, // pvGetKeyArgument (not used)
- cred, // phCredential
- &expiry); // ptsExpiry
+ SECPKG_CRED_OUTBOUND, // fCredentialUse
+ nullptr, // pvLogonID
+ &identity, // pAuthData
+ nullptr, // pGetKeyFn (not used)
+ nullptr, // pvGetKeyArgument (not used)
+ cred, // phCredential
+ &expiry); // ptsExpiry
return MapAcquireCredentialsStatusToError(status, package);
}
@@ -93,15 +93,15 @@
// cached credentials for the logged in user, which can be used
// for a single sign-on.
SECURITY_STATUS status = library->AcquireCredentialsHandle(
- NULL, // pszPrincipal
+ nullptr, // pszPrincipal
const_cast<SEC_WCHAR*>(package), // pszPackage
- SECPKG_CRED_OUTBOUND, // fCredentialUse
- NULL, // pvLogonID
- NULL, // pAuthData
- NULL, // pGetKeyFn (not used)
- NULL, // pvGetKeyArgument (not used)
- cred, // phCredential
- &expiry); // ptsExpiry
+ SECPKG_CRED_OUTBOUND, // fCredentialUse
+ nullptr, // pvLogonID
+ nullptr, // pAuthData
+ nullptr, // pGetKeyFn (not used)
+ nullptr, // pvGetKeyArgument (not used)
+ cred, // phCredential
+ &expiry); // ptsExpiry
return MapAcquireCredentialsStatusToError(status, package);
}
@@ -445,7 +445,7 @@
}
if (!out_buffer.cbBuffer) {
free(out_buffer.pvBuffer);
- out_buffer.pvBuffer = NULL;
+ out_buffer.pvBuffer = nullptr;
}
*out_token = out_buffer.pvBuffer;
*out_token_len = out_buffer.cbBuffer;
@@ -473,7 +473,7 @@
ULONG* max_token_length) {
DCHECK(library);
DCHECK(max_token_length);
- PSecPkgInfo pkg_info = NULL;
+ PSecPkgInfo pkg_info = nullptr;
SECURITY_STATUS status = library->QuerySecurityPackageInfo(
const_cast<wchar_t *>(package.c_str()), &pkg_info);
int rv = MapQuerySecurityPackageInfoStatusToError(status);
diff --git a/net/http/http_auth_sspi_win_unittest.cc b/net/http/http_auth_sspi_win_unittest.cc
index 33c796d..3c42767 100644
--- a/net/http/http_auth_sspi_win_unittest.cc
+++ b/net/http/http_auth_sspi_win_unittest.cc
@@ -61,7 +61,7 @@
TEST(HttpAuthSSPITest, DetermineMaxTokenLength_InvalidPackage) {
MockSSPILibrary mock_library;
mock_library.ExpectQuerySecurityPackageInfo(L"Foo", SEC_E_SECPKG_NOT_FOUND,
- NULL);
+ nullptr);
ULONG max_token_length = kMaxTokenLength;
int rv = DetermineMaxTokenLength(&mock_library, L"Foo", &max_token_length);
EXPECT_THAT(rv, IsError(ERR_UNSUPPORTED_AUTH_SCHEME));
@@ -97,7 +97,7 @@
// Generate an auth token and create another thing.
std::string auth_token;
EXPECT_EQ(OK, auth_sspi.GenerateAuthToken(
- NULL, "HTTP/intranet.google.com", std::string(),
+ nullptr, "HTTP/intranet.google.com", std::string(),
&auth_token, base::BindOnce(&UnexpectedCallback)));
std::string second_challenge_text = "Negotiate Zm9vYmFy";
@@ -134,7 +134,7 @@
std::string auth_token;
EXPECT_EQ(OK, auth_sspi.GenerateAuthToken(
- NULL, "HTTP/intranet.google.com", std::string(),
+ nullptr, "HTTP/intranet.google.com", std::string(),
&auth_token, base::BindOnce(&UnexpectedCallback)));
std::string second_challenge_text = "Negotiate";
HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(),
@@ -157,7 +157,7 @@
std::string auth_token;
EXPECT_EQ(OK, auth_sspi.GenerateAuthToken(
- NULL, "HTTP/intranet.google.com", std::string(),
+ nullptr, "HTTP/intranet.google.com", std::string(),
&auth_token, base::BindOnce(&UnexpectedCallback)));
std::string second_challenge_text = "Negotiate =happyjoy=";
HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(),
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 199074f..fc87738b 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -172,14 +172,14 @@
: operation_(operation),
transaction_(transaction),
entry_(entry),
- backend_(NULL) {}
+ backend_(nullptr) {}
WorkItem(WorkItemOperation operation,
Transaction* transaction,
CompletionOnceCallback callback,
disk_cache::Backend** backend)
: operation_(operation),
transaction_(transaction),
- entry_(NULL),
+ entry_(nullptr),
callback_(std::move(callback)),
backend_(backend) {}
~WorkItem() = default;
@@ -206,8 +206,8 @@
}
WorkItemOperation operation() { return operation_; }
- void ClearTransaction() { transaction_ = NULL; }
- void ClearEntry() { entry_ = NULL; }
+ void ClearTransaction() { transaction_ = nullptr; }
+ void ClearEntry() { entry_ = nullptr; }
void ClearCallback() { callback_.Reset(); }
bool Matches(Transaction* transaction) const {
return transaction == transaction_;
@@ -433,7 +433,7 @@
// Do lazy initialization of disk cache if needed.
if (!disk_cache_.get()) {
// We don't care about the result.
- CreateBackend(NULL, CompletionOnceCallback());
+ CreateBackend(nullptr, CompletionOnceCallback());
}
HttpCache::Transaction* transaction =
@@ -477,7 +477,7 @@
// Do lazy initialization of disk cache if needed.
if (!disk_cache_.get()) {
// We don't care about the result.
- CreateBackend(NULL, CompletionOnceCallback());
+ CreateBackend(nullptr, CompletionOnceCallback());
}
HttpCache::Transaction* new_transaction =
@@ -638,7 +638,7 @@
// This is not a performance critical operation, this is handling an error
// condition so it is OK to look up the entry again.
- int rv = DoomEntry(key, NULL);
+ int rv = DoomEntry(key, nullptr);
DCHECK_EQ(OK, rv);
}
@@ -707,9 +707,9 @@
// Defer to DoomEntry if there is an active entry, otherwise call
// AsyncDoomEntry without triggering a callback.
if (active_entries_.count(key))
- DoomEntry(key, NULL);
+ DoomEntry(key, nullptr);
else
- AsyncDoomEntry(key, NULL);
+ AsyncDoomEntry(key, nullptr);
}
void HttpCache::FinalizeDoomedEntry(ActiveEntry* entry) {
@@ -1443,18 +1443,18 @@
}
if (try_restart_requests) {
- item->NotifyTransaction(ERR_CACHE_RACE, NULL);
+ item->NotifyTransaction(ERR_CACHE_RACE, nullptr);
continue;
}
// At this point item->operation() is anything except Doom.
if (item->operation() == WI_CREATE_ENTRY) {
if (result == OK) {
// Successful OpenOrCreate, Open, or Create followed by a Create.
- item->NotifyTransaction(ERR_CACHE_CREATE_FAILURE, NULL);
+ item->NotifyTransaction(ERR_CACHE_CREATE_FAILURE, nullptr);
} else {
if (op != WI_CREATE_ENTRY && op != WI_OPEN_OR_CREATE_ENTRY) {
// Failed Open or Doom followed by a Create.
- item->NotifyTransaction(ERR_CACHE_RACE, NULL);
+ item->NotifyTransaction(ERR_CACHE_RACE, nullptr);
try_restart_requests = true;
} else {
item->NotifyTransaction(result, entry);
@@ -1465,7 +1465,7 @@
else if (item->operation() == WI_OPEN_OR_CREATE_ENTRY) {
if ((op == WI_OPEN_ENTRY || op == WI_CREATE_ENTRY) && result != OK) {
// Failed Open or Create followed by an OpenOrCreate.
- item->NotifyTransaction(ERR_CACHE_RACE, NULL);
+ item->NotifyTransaction(ERR_CACHE_RACE, nullptr);
try_restart_requests = true;
} else {
item->NotifyTransaction(result, entry);
@@ -1475,7 +1475,7 @@
else {
if (op == WI_CREATE_ENTRY && result != OK) {
// Failed Create followed by an Open.
- item->NotifyTransaction(ERR_CACHE_RACE, NULL);
+ item->NotifyTransaction(ERR_CACHE_RACE, nullptr);
try_restart_requests = true;
} else {
item->NotifyTransaction(result, entry);
@@ -1533,7 +1533,7 @@
// The cache may be gone when we return from the callback.
if (!item->DoCallback(result, disk_cache_.get()))
- item->NotifyTransaction(result, NULL);
+ item->NotifyTransaction(result, nullptr);
}
} // namespace net
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 6964c70..bb31e3e 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -111,11 +111,10 @@
// If the request includes one of these request headers, then avoid caching
// to avoid getting confused.
static const HeaderNameAndValue kPassThroughHeaders[] = {
- { "if-unmodified-since", NULL }, // causes unexpected 412s
- { "if-match", NULL }, // causes unexpected 412s
- { "if-range", NULL },
- { NULL, NULL }
-};
+ {"if-unmodified-since", nullptr}, // causes unexpected 412s
+ {"if-match", nullptr}, // causes unexpected 412s
+ {"if-range", nullptr},
+ {nullptr, nullptr}};
struct ValidationHeaderInfo {
const char* request_header_name;
@@ -130,17 +129,15 @@
// If the request includes one of these request headers, then avoid reusing
// our cached copy if any.
static const HeaderNameAndValue kForceFetchHeaders[] = {
- { "cache-control", "no-cache" },
- { "pragma", "no-cache" },
- { NULL, NULL }
-};
+ {"cache-control", "no-cache"},
+ {"pragma", "no-cache"},
+ {nullptr, nullptr}};
// If the request includes one of these request headers, then force our
// cached copy (if any) to be revalidated before reusing it.
static const HeaderNameAndValue kForceValidateHeaders[] = {
- { "cache-control", "max-age=0" },
- { NULL, NULL }
-};
+ {"cache-control", "max-age=0"},
+ {nullptr, nullptr}};
static bool HeaderMatches(const HttpRequestHeaders& headers,
const HeaderNameAndValue* search) {
@@ -167,12 +164,12 @@
HttpCache::Transaction::Transaction(RequestPriority priority, HttpCache* cache)
: next_state_(STATE_NONE),
initial_request_(nullptr),
- request_(NULL),
+ request_(nullptr),
priority_(priority),
cache_(cache->GetWeakPtr()),
- entry_(NULL),
- new_entry_(NULL),
- new_response_(NULL),
+ entry_(nullptr),
+ new_entry_(nullptr),
+ new_response_(nullptr),
mode_(NONE),
reading_(false),
invalid_range_(false),
@@ -197,7 +194,7 @@
recorded_histograms_(false),
parallel_writing_pattern_(PARALLEL_WRITING_NONE),
moved_network_transaction_to_writers_(false),
- websocket_handshake_stream_base_create_helper_(NULL),
+ websocket_handshake_stream_base_create_helper_(nullptr),
in_do_loop_(false),
weak_factory_(this) {
TRACE_EVENT0("io", "HttpCacheTransaction::Transaction");
@@ -1121,7 +1118,7 @@
}
// This is only set if we have something to do with the response.
- range_requested_ = (partial_.get() != NULL);
+ range_requested_ = (partial_.get() != nullptr);
return OK;
}
@@ -1382,7 +1379,7 @@
entry_ = new_entry_;
// If there is a failure, the cache should have taken care of new_entry_.
- new_entry_ = NULL;
+ new_entry_ = nullptr;
if (result == ERR_CACHE_RACE) {
TransitionToState(STATE_HEADERS_PHASE_CANNOT_PROCEED);
@@ -1767,7 +1764,7 @@
UpdateCacheEntryStatus(CacheEntryStatus::ENTRY_OTHER);
SetResponse(HttpResponseInfo());
ResetNetworkTransaction();
- new_response_ = NULL;
+ new_response_ = nullptr;
TransitionToState(STATE_SEND_REQUEST);
return OK;
}
@@ -1788,7 +1785,7 @@
if (mode_ == WRITE && (method_ == "PUT" || method_ == "DELETE")) {
if (NonErrorResponse(new_response->headers->response_code()) &&
(entry_ && !entry_->doomed)) {
- int ret = cache_->DoomEntry(cache_key_, NULL);
+ int ret = cache_->DoomEntry(cache_key_, nullptr);
DCHECK_EQ(OK, ret);
}
// Do not invalidate the entry if its a failed Delete or Put.
@@ -1851,7 +1848,7 @@
if (response_.headers->HasHeaderValue("cache-control", "no-store")) {
if (!entry_->doomed) {
- int ret = cache_->DoomEntry(cache_key_, NULL);
+ int ret = cache_->DoomEntry(cache_key_, nullptr);
DCHECK_EQ(OK, ret);
}
TransitionToState(STATE_UPDATE_CACHED_RESPONSE_COMPLETE);
@@ -1909,7 +1906,7 @@
// the first part to the user.
if (network_trans_)
ResetNetworkTransaction();
- new_response_ = NULL;
+ new_response_ = nullptr;
TransitionToState(STATE_START_PARTIAL_CACHE_VALIDATION);
partial_->SetRangeToStartDownload();
return OK;
@@ -1934,7 +1931,7 @@
if (method_ == "HEAD") {
// This response is replacing the cached one.
DoneWithEntry(false);
- new_response_ = NULL;
+ new_response_ = nullptr;
TransitionToState(STATE_FINISH_HEADERS);
return OK;
}
@@ -1995,7 +1992,7 @@
if (net_log_.IsCapturing())
net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_WRITE_DATA);
// Truncate the stream.
- return WriteToEntry(kResponseContentIndex, 0, NULL, 0, io_callback_);
+ return WriteToEntry(kResponseContentIndex, 0, nullptr, 0, io_callback_);
}
int HttpCache::Transaction::DoTruncateCachedDataComplete(int result) {
@@ -2019,7 +2016,7 @@
if (net_log_.IsCapturing())
net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_WRITE_INFO);
- return WriteToEntry(kMetadataIndex, 0, NULL, 0, io_callback_);
+ return WriteToEntry(kMetadataIndex, 0, nullptr, 0, io_callback_);
}
int HttpCache::Transaction::DoTruncateCachedMetadataComplete(int result) {
@@ -2036,7 +2033,7 @@
}
int HttpCache::Transaction::DoPartialHeadersReceived() {
- new_response_ = NULL;
+ new_response_ = nullptr;
if (!partial_) {
if (entry_ && entry_->disk_entry->GetDataSize(kMetadataIndex) &&
@@ -2421,7 +2418,7 @@
// The range is invalid or we cannot handle it properly.
VLOG(1) << "Invalid byte range found.";
effective_load_flags_ |= LOAD_DISABLE_CACHE;
- partial_.reset(NULL);
+ partial_.reset(nullptr);
}
}
}
@@ -2640,8 +2637,7 @@
// Retrieve either the cached response's "etag" or "last-modified" header.
std::string validator;
response_.headers->EnumerateHeader(
- NULL,
- kValidationHeaders[i].related_response_header_name,
+ nullptr, kValidationHeaders[i].related_response_header_name,
&validator);
if (response_.headers->response_code() != 200 || truncated_ ||
@@ -2782,9 +2778,9 @@
// TODO(darin): Or should we use the last?
if (response_.headers->GetHttpVersion() >= HttpVersion(1, 1))
- response_.headers->EnumerateHeader(NULL, "etag", etag_value);
+ response_.headers->EnumerateHeader(nullptr, "etag", etag_value);
- response_.headers->EnumerateHeader(NULL, "last-modified",
+ response_.headers->EnumerateHeader(nullptr, "last-modified",
last_modified_value);
if (etag_value->empty() && last_modified_value->empty())
@@ -3028,7 +3024,7 @@
// response from the server (it's not changing its mind midway, right?).
UpdateCacheEntryStatus(CacheEntryStatus::ENTRY_OTHER);
DoneWithEntry(mode_ != WRITE);
- partial_.reset(NULL);
+ partial_.reset(nullptr);
}
void HttpCache::Transaction::FixHeadersForHead() {
@@ -3202,7 +3198,7 @@
// DoneWithEntry.
cache_->DoneWithEntry(entry_, this, true /* entry_is_complete */,
partial_ != nullptr);
- entry_ = NULL;
+ entry_ = nullptr;
is_sparse_ = false;
// It's OK to use PartialData::RestoreHeaders here as |restart| is only set
// when the HttpResponseInfo couldn't even be read, at which point it's
@@ -3238,17 +3234,17 @@
void HttpCache::Transaction::DoomPartialEntry(bool delete_object) {
DVLOG(2) << "DoomPartialEntry";
if (entry_ && !entry_->doomed) {
- int rv = cache_->DoomEntry(cache_key_, NULL);
+ int rv = cache_->DoomEntry(cache_key_, nullptr);
DCHECK_EQ(OK, rv);
}
cache_->DoneWithEntry(entry_, this, false /* entry_is_complete */,
partial_ != nullptr);
- entry_ = NULL;
+ entry_ = nullptr;
is_sparse_ = false;
truncated_ = false;
if (delete_object)
- partial_.reset(NULL);
+ partial_.reset(nullptr);
}
int HttpCache::Transaction::DoPartialCacheReadCompleted(int result) {
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 308a9572..9aaf0cad 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -576,8 +576,8 @@
void CreateTruncatedEntry(std::string raw_headers, MockHttpCache* cache) {
// Create a disk cache entry that stores an incomplete resource.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache->CreateBackendEntry(kRangeGET_TransactionOK.url, &entry,
- NULL));
+ ASSERT_TRUE(
+ cache->CreateBackendEntry(kRangeGET_TransactionOK.url, &entry, nullptr));
raw_headers =
HttpUtil::AssembleRawHeaders(raw_headers.data(), raw_headers.size());
@@ -5106,14 +5106,14 @@
// We will control the network layer's responses for |kUrl| using
// |mock_network_response|.
- MockTransaction mock_network_response = { 0 };
+ MockTransaction mock_network_response = {nullptr};
mock_network_response.url = kUrl;
AddMockTransaction(&mock_network_response);
// Request |kUrl| for the first time. It should hit the network and
// receive |kNetResponse1|, which it saves into the HTTP cache.
- MockTransaction request = { 0 };
+ MockTransaction request = {nullptr};
request.url = kUrl;
request.method = "GET";
request.request_headers = "";
@@ -5297,11 +5297,11 @@
// We will control the network layer's responses for |kUrl| using
// |mock_network_response|.
- MockTransaction mock_network_response = { 0 };
+ MockTransaction mock_network_response = {nullptr};
mock_network_response.url = kUrl;
AddMockTransaction(&mock_network_response);
- MockTransaction request = { 0 };
+ MockTransaction request = {nullptr};
request.url = kUrl;
request.method = "GET";
request.request_headers = kExtraRequestHeaders;
@@ -5341,11 +5341,11 @@
// We will control the network layer's responses for |kUrl| using
// |mock_network_response|.
- MockTransaction mock_network_response = { 0 };
+ MockTransaction mock_network_response = {nullptr};
mock_network_response.url = kUrl;
AddMockTransaction(&mock_network_response);
- MockTransaction request = { 0 };
+ MockTransaction request = {nullptr};
request.url = kUrl;
request.method = "GET";
request.request_headers = kExtraRequestHeaders;
@@ -5601,7 +5601,8 @@
request.upload_data_stream = &upload_data_stream;
// Populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, request, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, request,
+ nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5609,7 +5610,8 @@
// Load from cache.
request.load_flags |= LOAD_ONLY_FROM_CACHE | LOAD_SKIP_CACHE_VALIDATION;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, request, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, request,
+ nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
@@ -5639,7 +5641,8 @@
request.upload_data_stream = &upload_data_stream;
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, request, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, request,
+ nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5659,7 +5662,7 @@
MockHttpRequest req1(transaction);
req1.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5668,7 +5671,7 @@
transaction.method = "GET";
MockHttpRequest req2(transaction);
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5684,7 +5687,7 @@
MockHttpRequest req1(transaction);
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5700,13 +5703,13 @@
MockHttpRequest req2(transaction);
req2.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(2, cache.disk_cache()->create_count());
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5730,12 +5733,13 @@
req1.top_frame_origin = origin_a;
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
// Same for a different origin.
MockHttpRequest req1b(transaction);
req1b.top_frame_origin = origin_b;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1b, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1b,
+ nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5752,7 +5756,7 @@
req2.upload_data_stream = &upload_data_stream;
req2.top_frame_origin = origin_a;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5760,13 +5764,14 @@
// req1b should still be cached, since it has a different top-level frame
// origin.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1b, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1b,
+ nullptr);
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
EXPECT_EQ(3, cache.disk_cache()->create_count());
// req1 should not be cached after the POST.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(4, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
EXPECT_EQ(4, cache.disk_cache()->create_count());
@@ -5784,7 +5789,7 @@
MockHttpRequest req1(transaction);
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5800,13 +5805,13 @@
MockHttpRequest req2(transaction);
req2.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5832,7 +5837,7 @@
MockHttpRequest req(transaction);
req.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req, nullptr);
RemoveMockTransaction(&transaction);
}
@@ -5846,7 +5851,7 @@
MockHttpRequest req1(transaction);
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -5862,13 +5867,13 @@
MockHttpRequest req2(transaction);
req2.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(2, cache.disk_cache()->create_count());
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
@@ -6173,7 +6178,8 @@
request.upload_data_stream = &upload_data_stream;
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, request, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, request,
+ nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -6188,7 +6194,7 @@
MockHttpRequest req1(transaction);
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -6203,13 +6209,13 @@
MockHttpRequest req2(transaction);
req2.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
@@ -6225,7 +6231,7 @@
MockHttpRequest req1(transaction);
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -6241,13 +6247,13 @@
MockHttpRequest req2(transaction);
req2.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
@@ -6264,7 +6270,7 @@
MockHttpRequest req1(transaction);
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -6280,13 +6286,13 @@
MockHttpRequest req2(transaction);
req2.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(2, cache.disk_cache()->open_count());
@@ -6310,7 +6316,8 @@
request.upload_data_stream = &upload_data_stream;
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, request, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, request,
+ nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -6325,7 +6332,7 @@
MockHttpRequest req1(transaction);
// Attempt to populate the cache.
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -6340,13 +6347,13 @@
MockHttpRequest req2(transaction);
req2.upload_data_stream = &upload_data_stream;
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req2, nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, NULL);
+ RunTransactionTestWithRequest(cache.http_cache(), transaction, req1, nullptr);
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
@@ -6565,7 +6572,7 @@
MockTransaction transaction(kRangeGET_TransactionOK);
AddMockTransaction(&transaction);
transaction.request_headers = EXTRA_HEADER;
- transaction.handler = NULL;
+ transaction.handler = nullptr;
RunTransactionTest(cache.http_cache(), transaction);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -6777,7 +6784,7 @@
transaction.response_headers = "ETag: \"foo\"\n"
"Accept-Ranges: bytes\n"
"Content-Range: bytes 40-49/80\n";
- transaction.handler = NULL;
+ transaction.handler = nullptr;
RunTransactionTestWithResponse(cache.http_cache(), transaction, &headers);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -7375,7 +7382,7 @@
transaction.status = "HTTP/1.1 301 Moved Permanently";
transaction.response_headers = "Location: http://www.bar.com/\n";
transaction.data = "";
- transaction.handler = NULL;
+ transaction.handler = nullptr;
// Write to the cache.
RunTransactionTest(cache.http_cache(), transaction);
@@ -7631,8 +7638,8 @@
// Create a disk cache entry that stores 206 headers while not being sparse.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kSimpleGET_Transaction.url, &entry,
- NULL));
+ ASSERT_TRUE(
+ cache.CreateBackendEntry(kSimpleGET_Transaction.url, &entry, nullptr));
std::string raw_headers(kRangeGET_TransactionOK.status);
raw_headers.append("\n");
@@ -7679,8 +7686,8 @@
// Create a disk cache entry that stores 206 headers while not being sparse.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry,
- NULL));
+ ASSERT_TRUE(
+ cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry, nullptr));
std::string raw_headers(kRangeGET_TransactionOK.status);
raw_headers.append("\n");
@@ -7720,8 +7727,8 @@
// Create a disk cache entry that stores 206 headers.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kSimpleGET_Transaction.url, &entry,
- NULL));
+ ASSERT_TRUE(
+ cache.CreateBackendEntry(kSimpleGET_Transaction.url, &entry, nullptr));
// Make sure that the headers cannot be validated with the server.
std::string raw_headers(kRangeGET_TransactionOK.status);
@@ -8088,7 +8095,7 @@
std::string headers;
MockTransaction transaction(kRangeGET_TransactionOK);
- transaction.handler = NULL;
+ transaction.handler = nullptr;
transaction.response_headers = "Content-Range: bytes 40-49/45\n"
"Content-Length: 10\n";
AddMockTransaction(&transaction);
@@ -8116,7 +8123,7 @@
std::string headers;
MockTransaction transaction(kRangeGET_TransactionOK);
- transaction.handler = NULL;
+ transaction.handler = nullptr;
transaction.response_headers = "Content-Range: bytes 40-49/80\n"
"Content-Length: 20\n";
AddMockTransaction(&transaction);
@@ -8145,7 +8152,7 @@
std::string headers;
MockTransaction transaction(kRangeGET_TransactionOK);
- transaction.handler = NULL;
+ transaction.handler = nullptr;
transaction.request_headers = "Range: bytes = 50-59\r\n" EXTRA_HEADER;
std::string response_headers(transaction.response_headers);
response_headers.append("Content-Range: bytes 50-59/160\n");
@@ -8185,7 +8192,7 @@
std::string headers;
MockTransaction transaction(kRangeGET_TransactionOK);
- transaction.handler = NULL;
+ transaction.handler = nullptr;
transaction.request_headers = "Range: bytes = 4294967288-4294967297\r\n"
EXTRA_HEADER;
transaction.response_headers =
@@ -8283,7 +8290,7 @@
MockTransaction transaction(kRangeGET_TransactionOK);
transaction.request_headers = "Range: bytes = 40-49\r\n" EXTRA_HEADER;
transaction.data = "rg: 40-"; // Less than expected.
- transaction.handler = NULL;
+ transaction.handler = nullptr;
std::string headers(transaction.response_headers);
headers.append("Content-Range: bytes 40-49/80\n");
transaction.response_headers = headers.c_str();
@@ -8357,8 +8364,8 @@
TEST_F(HttpCacheTest, WriteResponseInfo_Truncated) {
MockHttpCache cache;
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry("http://www.google.com", &entry,
- NULL));
+ ASSERT_TRUE(
+ cache.CreateBackendEntry("http://www.google.com", &entry, nullptr));
std::string headers("HTTP/1.1 200 OK");
headers = HttpUtil::AssembleRawHeaders(headers.data(), headers.size());
@@ -9187,7 +9194,7 @@
EXPECT_EQ(info->headers->response_code(), 301);
std::string location;
- info->headers->EnumerateHeader(NULL, "Location", &location);
+ info->headers->EnumerateHeader(nullptr, "Location", &location);
EXPECT_EQ(location, "http://www.bar.com/");
// Mark the transaction as completed so it is cached.
@@ -9221,7 +9228,7 @@
EXPECT_EQ(info->headers->response_code(), 301);
std::string location;
- info->headers->EnumerateHeader(NULL, "Location", &location);
+ info->headers->EnumerateHeader(nullptr, "Location", &location);
EXPECT_EQ(location, "http://www.bar.com/");
// Mark the transaction as completed so it is cached.
@@ -9447,14 +9454,14 @@
const char kUrl[] = "http://foobar";
const char kData[] = "body";
- MockTransaction mock_network_response = { 0 };
+ MockTransaction mock_network_response = {nullptr};
mock_network_response.url = kUrl;
AddMockTransaction(&mock_network_response);
// Request |kUrl|, causing |kNetResponse1| to be written to the cache.
- MockTransaction request = { 0 };
+ MockTransaction request = {nullptr};
request.url = kUrl;
request.method = "GET";
request.request_headers = "\r\n";
@@ -9634,11 +9641,11 @@
HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response);
- EXPECT_TRUE(response.metadata.get() == NULL);
+ EXPECT_TRUE(response.metadata.get() == nullptr);
// Trivial call.
cache.http_cache()->WriteMetadata(GURL("foo"), DEFAULT_PRIORITY, Time::Now(),
- NULL, 0);
+ nullptr, 0);
// Write meta data to the same entry.
scoped_refptr<IOBufferWithSize> buf =
@@ -9650,14 +9657,14 @@
buf.get(), buf->size());
// Release the buffer before the operation takes place.
- buf = NULL;
+ buf = nullptr;
// Makes sure we finish pending operations.
base::RunLoop().RunUntilIdle();
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response);
- ASSERT_TRUE(response.metadata.get() != NULL);
+ ASSERT_TRUE(response.metadata.get() != nullptr);
EXPECT_EQ(50, response.metadata->size());
EXPECT_EQ(0, strcmp(response.metadata->data(), "Hi there"));
@@ -9677,11 +9684,11 @@
HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response);
- EXPECT_TRUE(response.metadata.get() == NULL);
+ EXPECT_TRUE(response.metadata.get() == nullptr);
// Trivial call.
cache.http_cache()->WriteMetadata(GURL("foo"), DEFAULT_PRIORITY, Time::Now(),
- NULL, 0);
+ nullptr, 0);
// Write meta data to the same entry.
scoped_refptr<IOBufferWithSize> buf =
@@ -9693,14 +9700,14 @@
buf.get(), buf->size());
// Release the buffer before the operation takes place.
- buf = NULL;
+ buf = nullptr;
// Makes sure we finish pending operations.
base::RunLoop().RunUntilIdle();
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response);
- ASSERT_TRUE(response.metadata.get() == NULL);
+ ASSERT_TRUE(response.metadata.get() == nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(2, cache.disk_cache()->open_count());
@@ -9718,7 +9725,7 @@
HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response);
- EXPECT_TRUE(response.metadata.get() == NULL);
+ EXPECT_TRUE(response.metadata.get() == nullptr);
// Attempt to write meta data to the same entry.
scoped_refptr<IOBufferWithSize> buf =
@@ -9736,7 +9743,7 @@
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response);
- EXPECT_TRUE(response.metadata.get() == NULL);
+ EXPECT_TRUE(response.metadata.get() == nullptr);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(2, cache.disk_cache()->open_count());
@@ -9889,7 +9896,7 @@
HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(),
kTypicalGET_Transaction, &response);
- EXPECT_TRUE(response.metadata.get() == NULL);
+ EXPECT_TRUE(response.metadata.get() == nullptr);
// Write meta data to the same entry.
scoped_refptr<IOBufferWithSize> buf =
@@ -9908,7 +9915,7 @@
trans1.load_flags = LOAD_ONLY_FROM_CACHE | LOAD_SKIP_CACHE_VALIDATION;
RunTransactionTestWithResponseInfo(cache.http_cache(), trans1, &response);
- ASSERT_TRUE(response.metadata.get() != NULL);
+ ASSERT_TRUE(response.metadata.get() != nullptr);
EXPECT_EQ(50, response.metadata->size());
EXPECT_EQ(0, strcmp(response.metadata->data(), "Hi there"));
@@ -9922,9 +9929,9 @@
trans1.status = "HTTP/1.1 304 Not Modified";
AddMockTransaction(&trans1);
- response.metadata = NULL;
+ response.metadata = nullptr;
RunTransactionTestWithResponseInfo(cache.http_cache(), trans1, &response);
- EXPECT_TRUE(response.metadata.get() != NULL);
+ EXPECT_TRUE(response.metadata.get() != nullptr);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(3, cache.disk_cache()->open_count());
@@ -9936,7 +9943,7 @@
MockTransaction trans2(kTypicalGET_Transaction);
trans2.load_flags = LOAD_VALIDATE_CACHE;
RunTransactionTestWithResponseInfo(cache.http_cache(), trans2, &response);
- EXPECT_TRUE(response.metadata.get() == NULL);
+ EXPECT_TRUE(response.metadata.get() == nullptr);
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(4, cache.disk_cache()->open_count());
diff --git a/net/http/http_cache_writers.cc b/net/http/http_cache_writers.cc
index 6842520d..c20d5d3 100644
--- a/net/http/http_cache_writers.cc
+++ b/net/http/http_cache_writers.cc
@@ -361,7 +361,7 @@
// Save the callback as |this| may be destroyed when |cache_callback_| is run.
// Note that |callback_| is intentionally reset even if it is not run.
CompletionOnceCallback callback = std::move(callback_);
- read_buf_ = NULL;
+ read_buf_ = nullptr;
DCHECK(!all_writers_.empty() || cache_callback_);
if (cache_callback_)
std::move(cache_callback_).Run();
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index 5a43fd3..ab48161 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -50,7 +50,7 @@
}
HttpCache* HttpNetworkLayer::GetCache() {
- return NULL;
+ return nullptr;
}
HttpNetworkSession* HttpNetworkLayer::GetSession() {
diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc
index 3871fb5d..0f651458 100644
--- a/net/http/http_network_layer_unittest.cc
+++ b/net/http/http_network_layer_unittest.cc
@@ -282,7 +282,7 @@
std::unique_ptr<HttpTransaction> trans;
int rv = factory_->CreateTransaction(DEFAULT_PRIORITY, &trans);
EXPECT_THAT(rv, IsOk());
- EXPECT_TRUE(trans.get() != NULL);
+ EXPECT_TRUE(trans.get() != nullptr);
}
TEST_F(HttpNetworkLayerTest, Suspend) {
@@ -297,7 +297,7 @@
rv = factory_->CreateTransaction(DEFAULT_PRIORITY, &trans);
EXPECT_THAT(rv, IsError(ERR_NETWORK_IO_SUSPENDED));
- ASSERT_TRUE(trans == NULL);
+ ASSERT_TRUE(trans == nullptr);
factory_->OnResume();
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 6b0db6c..3a0f61a 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -516,7 +516,7 @@
NOTREACHED();
break;
}
- return NULL;
+ return nullptr;
}
void HttpNetworkSession::OnMemoryPressure(
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 359d488..8f6711a 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -102,7 +102,7 @@
io_callback_(base::BindRepeating(&HttpNetworkTransaction::OnIOComplete,
base::Unretained(this))),
session_(session),
- request_(NULL),
+ request_(nullptr),
priority_(priority),
headers_valid_(false),
can_send_early_data_(false),
@@ -119,7 +119,7 @@
establishing_tunnel_(false),
enable_ip_based_pooling_(true),
enable_alternative_services_(true),
- websocket_handshake_stream_base_create_helper_(NULL),
+ websocket_handshake_stream_base_create_helper_(nullptr),
net_error_details_(),
retry_attempts_(0),
num_restarts_(0),
@@ -275,14 +275,14 @@
// In this case, we've gathered credentials for use with proxy
// authentication of a tunnel.
DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_);
- DCHECK(stream_request_ != NULL);
- auth_controllers_[target] = NULL;
+ DCHECK(stream_request_ != nullptr);
+ auth_controllers_[target] = nullptr;
ResetStateForRestart();
rv = stream_request_->RestartTunnelWithProxyAuth();
} else {
// In this case, we've gathered credentials for the server or the proxy
// but it is not during the tunneling phase.
- DCHECK(stream_request_ == NULL);
+ DCHECK(stream_request_ == nullptr);
PrepareForAuthRestart(target);
rv = DoLoop(OK);
// Note: If an error is encountered while draining the old response body, no
@@ -335,7 +335,7 @@
if (stream_.get()) {
total_received_bytes_ += stream_->GetTotalReceivedBytes();
total_sent_bytes_ += stream_->GetTotalSentBytes();
- HttpStream* new_stream = NULL;
+ HttpStream* new_stream = nullptr;
if (keep_alive && stream_->CanReuseConnection()) {
// We should call connection_->set_idle_time(), but this doesn't occur
// often enough to be worth the trouble.
@@ -1279,7 +1279,7 @@
int HttpNetworkTransaction::DoReadBody() {
DCHECK(read_buf_.get());
DCHECK_GT(read_buf_len_, 0);
- DCHECK(stream_ != NULL);
+ DCHECK(stream_ != nullptr);
next_state_ = STATE_READ_BODY_COMPLETE;
return stream_->ReadResponseBody(
@@ -1329,7 +1329,7 @@
}
// Clear these to avoid leaving around old state.
- read_buf_ = NULL;
+ read_buf_ = nullptr;
read_buf_len_ = 0;
return result;
@@ -1736,7 +1736,7 @@
send_end_time_ = base::TimeTicks();
pending_auth_target_ = HttpAuth::AUTH_NONE;
- read_buf_ = NULL;
+ read_buf_ = nullptr;
read_buf_len_ = 0;
headers_valid_ = false;
request_headers_.Clear();
@@ -1763,7 +1763,7 @@
bool HttpNetworkTransaction::ShouldResendRequest() const {
bool connection_is_proven = stream_->IsConnectionReused();
- bool has_received_headers = GetResponseHeaders() != NULL;
+ bool has_received_headers = GetResponseHeaders() != nullptr;
// NOTE: we resend a request only if we reused a keep-alive connection.
// This automatically prevents an infinite resend loop because we'll run
diff --git a/net/http/http_network_transaction_ssl_unittest.cc b/net/http/http_network_transaction_ssl_unittest.cc
index 837fd08..fa77814 100644
--- a/net/http/http_network_transaction_ssl_unittest.cc
+++ b/net/http/http_network_transaction_ssl_unittest.cc
@@ -106,7 +106,7 @@
};
TEST_F(HttpNetworkTransactionSSLTest, ChannelID) {
- ChannelIDService channel_id_service(new DefaultChannelIDStore(NULL));
+ ChannelIDService channel_id_service(new DefaultChannelIDStore(nullptr));
session_context_.channel_id_service = &channel_id_service;
HttpNetworkSession::Params params;
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 0cad95cae..816e546d 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -697,21 +697,21 @@
: ParentPool(0,
0,
base::TimeDelta(),
- NULL,
+ nullptr,
host_resolver,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL) {}
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr) {}
//-----------------------------------------------------------------------------
@@ -1765,7 +1765,7 @@
spdy::SpdySerializedFrame spdy_request(spdy_util_.ConstructSpdyGet(
request.url.spec().c_str(), 1, DEFAULT_PRIORITY));
spdy::SpdySerializedFrame spdy_response(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame spdy_data(
spdy_util_.ConstructSpdyDataFrame(1, "hello", true));
@@ -1950,17 +1950,17 @@
TEST_F(HttpNetworkTransactionTest, KeepAliveConnectionNotConnectedOnWrite) {
MockWrite write_failure(ASYNC, ERR_SOCKET_NOT_CONNECTED);
- KeepAliveConnectionResendRequestTest(&write_failure, NULL);
+ KeepAliveConnectionResendRequestTest(&write_failure, nullptr);
}
TEST_F(HttpNetworkTransactionTest, KeepAliveConnectionReset) {
MockRead read_failure(ASYNC, ERR_CONNECTION_RESET);
- KeepAliveConnectionResendRequestTest(NULL, &read_failure);
+ KeepAliveConnectionResendRequestTest(nullptr, &read_failure);
}
TEST_F(HttpNetworkTransactionTest, KeepAliveConnectionEOF) {
MockRead read_failure(SYNCHRONOUS, OK); // EOF
- KeepAliveConnectionResendRequestTest(NULL, &read_failure);
+ KeepAliveConnectionResendRequestTest(nullptr, &read_failure);
}
// Make sure that on a 408 response (Request Timeout), the request is retried,
@@ -1971,27 +1971,27 @@
"Connection: Keep-Alive\r\n"
"Content-Length: 6\r\n\r\n"
"Pickle");
- KeepAliveConnectionResendRequestTest(NULL, &read_failure);
+ KeepAliveConnectionResendRequestTest(nullptr, &read_failure);
}
TEST_F(HttpNetworkTransactionTest, PreconnectErrorNotConnectedOnWrite) {
MockWrite write_failure(ASYNC, ERR_SOCKET_NOT_CONNECTED);
- PreconnectErrorResendRequestTest(&write_failure, NULL, false);
+ PreconnectErrorResendRequestTest(&write_failure, nullptr, false);
}
TEST_F(HttpNetworkTransactionTest, PreconnectErrorReset) {
MockRead read_failure(ASYNC, ERR_CONNECTION_RESET);
- PreconnectErrorResendRequestTest(NULL, &read_failure, false);
+ PreconnectErrorResendRequestTest(nullptr, &read_failure, false);
}
TEST_F(HttpNetworkTransactionTest, PreconnectErrorEOF) {
MockRead read_failure(SYNCHRONOUS, OK); // EOF
- PreconnectErrorResendRequestTest(NULL, &read_failure, false);
+ PreconnectErrorResendRequestTest(nullptr, &read_failure, false);
}
TEST_F(HttpNetworkTransactionTest, PreconnectErrorAsyncEOF) {
MockRead read_failure(ASYNC, OK); // EOF
- PreconnectErrorResendRequestTest(NULL, &read_failure, false);
+ PreconnectErrorResendRequestTest(nullptr, &read_failure, false);
}
// Make sure that on a 408 response (Request Timeout), the request is retried,
@@ -2002,28 +2002,28 @@
"Connection: Keep-Alive\r\n"
"Content-Length: 6\r\n\r\n"
"Pickle");
- KeepAliveConnectionResendRequestTest(NULL, &read_failure);
- PreconnectErrorResendRequestTest(NULL, &read_failure, false);
+ KeepAliveConnectionResendRequestTest(nullptr, &read_failure);
+ PreconnectErrorResendRequestTest(nullptr, &read_failure, false);
}
TEST_F(HttpNetworkTransactionTest, SpdyPreconnectErrorNotConnectedOnWrite) {
MockWrite write_failure(ASYNC, ERR_SOCKET_NOT_CONNECTED);
- PreconnectErrorResendRequestTest(&write_failure, NULL, true);
+ PreconnectErrorResendRequestTest(&write_failure, nullptr, true);
}
TEST_F(HttpNetworkTransactionTest, SpdyPreconnectErrorReset) {
MockRead read_failure(ASYNC, ERR_CONNECTION_RESET);
- PreconnectErrorResendRequestTest(NULL, &read_failure, true);
+ PreconnectErrorResendRequestTest(nullptr, &read_failure, true);
}
TEST_F(HttpNetworkTransactionTest, SpdyPreconnectErrorEOF) {
MockRead read_failure(SYNCHRONOUS, OK); // EOF
- PreconnectErrorResendRequestTest(NULL, &read_failure, true);
+ PreconnectErrorResendRequestTest(nullptr, &read_failure, true);
}
TEST_F(HttpNetworkTransactionTest, SpdyPreconnectErrorAsyncEOF) {
MockRead read_failure(ASYNC, OK); // EOF
- PreconnectErrorResendRequestTest(NULL, &read_failure, true);
+ PreconnectErrorResendRequestTest(nullptr, &read_failure, true);
}
TEST_F(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) {
@@ -5508,7 +5508,8 @@
spdy_util_.ConstructSpdyGet("http://www.example.org/", 1, LOWEST));
MockWrite spdy_writes[] = {CreateMockWrite(req, 0)};
- spdy::SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame data(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead spdy_reads[] = {
CreateMockRead(resp, 1), CreateMockRead(data, 2), MockRead(ASYNC, 0, 3),
@@ -5601,7 +5602,7 @@
spdy::SpdySerializedFrame body_authentication(
spdy_util_.ConstructSpdyDataFrame(1, true));
spdy::SpdySerializedFrame resp_data(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
spdy::SpdySerializedFrame body_data(
spdy_util_.ConstructSpdyDataFrame(3, true));
MockRead spdy_reads[] = {
@@ -5673,7 +5674,7 @@
// CONNECT to www.example.org:443 via SPDY
spdy::SpdySerializedFrame connect(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
// fetch https://www.example.org/ via HTTP
const char get[] =
@@ -5683,7 +5684,7 @@
spdy::SpdySerializedFrame wrapped_get(
spdy_util_.ConstructSpdyDataFrame(1, get, false));
spdy::SpdySerializedFrame conn_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
const char resp[] = "HTTP/1.1 200 OK\r\n"
"Content-Length: 10\r\n\r\n";
spdy::SpdySerializedFrame wrapped_get_resp(
@@ -5758,7 +5759,7 @@
// CONNECT to www.example.org:443 via SPDY
spdy::SpdySerializedFrame connect(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
// fetch https://www.example.org/ via SPDY
const char kMyUrl[] = "https://www.example.org/";
spdy::SpdySerializedFrame get(
@@ -5766,9 +5767,9 @@
spdy::SpdySerializedFrame wrapped_get(
spdy_util_.ConstructWrappedSpdyFrame(get, 1));
spdy::SpdySerializedFrame conn_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame get_resp(
- spdy_util_wrapped.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_wrapped.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame wrapped_get_resp(
spdy_util_.ConstructWrappedSpdyFrame(get_resp, 1));
spdy::SpdySerializedFrame body(
@@ -5849,7 +5850,7 @@
// CONNECT to www.example.org:443 via SPDY
spdy::SpdySerializedFrame connect(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
spdy::SpdySerializedFrame get(
spdy_util_.ConstructSpdyRstStream(1, spdy::ERROR_CODE_CANCEL));
@@ -5909,14 +5910,14 @@
const char kMyUrl[] = "https://www.example.org/";
spdy::SpdySerializedFrame get(spdy_util_.ConstructSpdyGet(kMyUrl, 1, LOWEST));
spdy::SpdySerializedFrame get_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame body(spdy_util_.ConstructSpdyDataFrame(1, true));
spdy_util_.UpdateWithStreamDestruction(1);
spdy::SpdySerializedFrame get2(
spdy_util_.ConstructSpdyGet(kMyUrl, 3, LOWEST));
spdy::SpdySerializedFrame get_resp2(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
spdy::SpdySerializedFrame body2(spdy_util_.ConstructSpdyDataFrame(3, true));
MockWrite auth_challenge_writes[] = {
@@ -6055,9 +6056,9 @@
// CONNECT to www.example.org:443 via SPDY.
spdy::SpdySerializedFrame connect1(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
spdy::SpdySerializedFrame conn_resp1(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
// Fetch https://www.example.org/ via HTTP.
const char get1[] =
@@ -6083,7 +6084,7 @@
3, std::move(connect2_block), LOWEST, false));
spdy::SpdySerializedFrame conn_resp2(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
// Fetch https://mail.example.org/ via HTTP.
const char get2[] =
@@ -6191,9 +6192,9 @@
// CONNECT to www.example.org:443 via SPDY.
spdy::SpdySerializedFrame connect1(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
spdy::SpdySerializedFrame conn_resp1(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
// Fetch https://www.example.org/ via HTTP.
const char get1[] =
@@ -6321,7 +6322,7 @@
spdy::SpdySerializedFrame get1(
spdy_util_.ConstructSpdyHeaders(1, std::move(headers), LOWEST, true));
spdy::SpdySerializedFrame get_resp1(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame body1(
spdy_util_.ConstructSpdyDataFrame(1, "1", true));
spdy_util_.UpdateWithStreamDestruction(1);
@@ -6332,7 +6333,7 @@
spdy::SpdySerializedFrame get2(
spdy_util_.ConstructSpdyHeaders(3, std::move(headers2), LOWEST, true));
spdy::SpdySerializedFrame get_resp2(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
spdy::SpdySerializedFrame body2(
spdy_util_.ConstructSpdyDataFrame(3, "22", true));
@@ -6416,16 +6417,16 @@
SpdyTestUtil spdy_util1;
// CONNECT to www.example.org:443 via HTTP/2.
spdy::SpdySerializedFrame connect(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
// fetch https://www.example.org/ via HTTP/2.
const char kMyUrl[] = "https://www.example.org/";
spdy::SpdySerializedFrame get(spdy_util1.ConstructSpdyGet(kMyUrl, 1, LOWEST));
spdy::SpdySerializedFrame wrapped_get(
spdy_util_.ConstructWrappedSpdyFrame(get, 1));
spdy::SpdySerializedFrame conn_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame get_resp(
- spdy_util1.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util1.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame wrapped_get_resp(
spdy_util_.ConstructWrappedSpdyFrame(get_resp, 1));
spdy::SpdySerializedFrame body(spdy_util1.ConstructSpdyDataFrame(1, true));
@@ -9735,7 +9736,7 @@
net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS);
spdy::SpdySerializedFrame conn(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
spdy::SpdySerializedFrame goaway(
spdy_util_.ConstructSpdyRstStream(1, spdy::ERROR_CODE_CANCEL));
MockWrite data_writes[] = {
@@ -9885,7 +9886,7 @@
net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS);
spdy::SpdySerializedFrame conn(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
spdy::SpdySerializedFrame rst(
spdy_util_.ConstructSpdyRstStream(1, spdy::ERROR_CODE_CANCEL));
MockWrite data_writes[] = {
@@ -9947,7 +9948,7 @@
// Since we have proxy, should try to establish tunnel.
spdy::SpdySerializedFrame req(spdy_util_.ConstructSpdyConnect(
- NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
+ nullptr, 0, 1, LOWEST, HostPortPair("www.example.org", 443)));
spdy::SpdySerializedFrame rst(
spdy_util_.ConstructSpdyRstStream(1, spdy::ERROR_CODE_CANCEL));
spdy_util_.UpdateWithStreamDestruction(1);
@@ -9983,7 +9984,7 @@
kAuthStatus, kAuthChallenge, base::size(kAuthChallenge) / 2, 1));
spdy::SpdySerializedFrame conn_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
const char resp[] = "HTTP/1.1 200 OK\r\n"
"Content-Length: 5\r\n\r\n";
@@ -10108,10 +10109,10 @@
};
spdy::SpdySerializedFrame stream2_syn(spdy_util_.ConstructSpdyPush(
- NULL, 0, 2, 1, "http://www.another-origin.com/foo.dat"));
+ nullptr, 0, 2, 1, "http://www.another-origin.com/foo.dat"));
spdy::SpdySerializedFrame stream1_reply(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame stream1_body(
spdy_util_.ConstructSpdyDataFrame(1, true));
@@ -10225,13 +10226,13 @@
};
spdy::SpdySerializedFrame stream1_reply(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame stream1_body(
spdy_util_.ConstructSpdyDataFrame(1, true));
spdy::SpdySerializedFrame stream2_syn(spdy_util_.ConstructSpdyPush(
- NULL, 0, 2, 1, "https://www.another-origin.com/foo.dat"));
+ nullptr, 0, 2, 1, "https://www.another-origin.com/foo.dat"));
MockRead spdy_reads[] = {
CreateMockRead(stream1_reply, 1, ASYNC),
@@ -11335,7 +11336,7 @@
ProxyServer proxy_server(ProxyServer::SCHEME_HTTP,
HostPortPair("http_proxy", 80));
CaptureGroupNameTransportSocketPool* http_proxy_pool =
- new CaptureGroupNameTransportSocketPool(NULL, NULL);
+ new CaptureGroupNameTransportSocketPool(nullptr, nullptr);
auto mock_pool_manager = std::make_unique<MockClientSocketPoolManager>();
mock_pool_manager->SetSocketPool(proxy_server,
base::WrapUnique(http_proxy_pool));
@@ -11398,7 +11399,7 @@
ProxyServer::FromURI(tests[i].proxy_server, ProxyServer::SCHEME_HTTP));
ASSERT_TRUE(proxy_server.is_valid());
CaptureGroupNameTransportSocketPool* socks_conn_pool =
- new CaptureGroupNameTransportSocketPool(NULL, NULL);
+ new CaptureGroupNameTransportSocketPool(nullptr, nullptr);
auto mock_pool_manager = std::make_unique<MockClientSocketPoolManager>();
mock_pool_manager->SetSocketPool(proxy_server,
base::WrapUnique(socks_conn_pool));
@@ -12904,7 +12905,8 @@
spdy_util_.ConstructSpdyGet("https://www.example.org/", 1, LOWEST));
MockWrite spdy_writes[] = {CreateMockWrite(req, 0)};
- spdy::SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame data(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead spdy_reads[] = {
CreateMockRead(resp, 1), CreateMockRead(data, 2), MockRead(ASYNC, 0, 3),
@@ -13004,9 +13006,11 @@
MockWrite spdy_writes[] = {
CreateMockWrite(req1, 0), CreateMockWrite(req2, 1),
};
- spdy::SpdySerializedFrame resp1(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp1(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame data1(spdy_util_.ConstructSpdyDataFrame(1, true));
- spdy::SpdySerializedFrame resp2(spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy::SpdySerializedFrame resp2(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
spdy::SpdySerializedFrame data2(spdy_util_.ConstructSpdyDataFrame(3, true));
MockRead spdy_reads[] = {
CreateMockRead(resp1, 2), CreateMockRead(data1, 3),
@@ -13290,7 +13294,8 @@
const char kCONNECTResponse[] = "HTTP/1.1 200 Connected\r\n\r\n";
- spdy::SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame data(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead spdy_reads[] = {
MockRead(ASYNC, 1, kCONNECTResponse), CreateMockRead(resp, 3),
@@ -13385,7 +13390,8 @@
spdy_util_.ConstructSpdyGet("https://www.example.org/", 1, LOWEST));
MockWrite spdy_writes[] = {CreateMockWrite(req, 0)};
- spdy::SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame data(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead spdy_reads[] = {
CreateMockRead(resp, 1), CreateMockRead(data, 2), MockRead(ASYNC, 0, 3),
@@ -13535,15 +13541,17 @@
// and TestRound's created with the default constructor should not be used.
struct TestRound {
TestRound()
- : expected_rv(ERR_UNEXPECTED), extra_write(NULL), extra_read(NULL) {}
+ : expected_rv(ERR_UNEXPECTED),
+ extra_write(nullptr),
+ extra_read(nullptr) {}
TestRound(const MockWrite& write_arg,
const MockRead& read_arg,
int expected_rv_arg)
: write(write_arg),
read(read_arg),
expected_rv(expected_rv_arg),
- extra_write(NULL),
- extra_read(NULL) {}
+ extra_write(nullptr),
+ extra_read(nullptr) {}
TestRound(const MockWrite& write_arg, const MockRead& read_arg,
int expected_rv_arg, const MockWrite* extra_write_arg,
const MockRead* extra_read_arg)
@@ -14397,7 +14405,7 @@
auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER);
int rv = OK;
- const HttpResponseInfo* response = NULL;
+ const HttpResponseInfo* response = nullptr;
HttpRequestInfo request;
request.method = "GET";
request.url = origin;
@@ -15075,7 +15083,8 @@
spdy_util_.ConstructSpdyGet("https://www.example.org", 1, LOWEST));
MockWrite spdy_writes[] = {CreateMockWrite(req, 0)};
- spdy::SpdySerializedFrame resp(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame data(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead spdy_reads[] = {
CreateMockRead(resp, 1), CreateMockRead(data, 2), MockRead(ASYNC, 0, 3),
@@ -15236,7 +15245,7 @@
// of SSLClientCertCache, NULL is just as meaningful as a real
// certificate, so this is the same as supply a
// legitimate-but-unacceptable certificate.
- rv = trans.RestartWithCertificate(NULL, NULL, callback.callback());
+ rv = trans.RestartWithCertificate(nullptr, nullptr, callback.callback());
ASSERT_THAT(rv, IsError(ERR_IO_PENDING));
// Ensure the certificate was added to the client auth cache before
@@ -15354,7 +15363,7 @@
// of SSLClientCertCache, NULL is just as meaningful as a real
// certificate, so this is the same as supply a
// legitimate-but-unacceptable certificate.
- rv = trans.RestartWithCertificate(NULL, NULL, callback.callback());
+ rv = trans.RestartWithCertificate(nullptr, nullptr, callback.callback());
ASSERT_THAT(rv, IsError(ERR_IO_PENDING));
// Ensure the certificate was added to the client auth cache before
@@ -15451,7 +15460,7 @@
// of SSLClientCertCache, NULL is just as meaningful as a real
// certificate, so this is the same as supply a
// legitimate-but-unacceptable certificate.
- rv = trans.RestartWithCertificate(NULL, NULL, callback.callback());
+ rv = trans.RestartWithCertificate(nullptr, nullptr, callback.callback());
ASSERT_THAT(rv, IsError(ERR_IO_PENDING));
// Ensure the certificate was added to the client auth cache before
@@ -15499,11 +15508,11 @@
CreateMockWrite(host1_req, 0), CreateMockWrite(host2_req, 3),
};
spdy::SpdySerializedFrame host1_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame host1_resp_body(
spdy_util_.ConstructSpdyDataFrame(1, true));
spdy::SpdySerializedFrame host2_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
spdy::SpdySerializedFrame host2_resp_body(
spdy_util_.ConstructSpdyDataFrame(3, true));
MockRead spdy_reads[] = {
@@ -15582,11 +15591,11 @@
CreateMockWrite(host1_req, 0), CreateMockWrite(host2_req, 3),
};
spdy::SpdySerializedFrame host1_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame host1_resp_body(
spdy_util_.ConstructSpdyDataFrame(1, true));
spdy::SpdySerializedFrame host2_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
spdy::SpdySerializedFrame host2_resp_body(
spdy_util_.ConstructSpdyDataFrame(3, true));
MockRead spdy_reads[] = {
@@ -15911,11 +15920,11 @@
CreateMockWrite(host1_req, 0), CreateMockWrite(host2_req, 3),
};
spdy::SpdySerializedFrame host1_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame host1_resp_body(
spdy_util_.ConstructSpdyDataFrame(1, true));
spdy::SpdySerializedFrame host2_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
spdy::SpdySerializedFrame host2_resp_body(
spdy_util_.ConstructSpdyDataFrame(3, true));
MockRead spdy_reads[] = {
@@ -15990,7 +15999,8 @@
CreateMockWrite(req1, 0),
};
- spdy::SpdySerializedFrame resp1(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp1(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame body1(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead reads1[] = {CreateMockRead(resp1, 1), CreateMockRead(body1, 2),
MockRead(SYNCHRONOUS, ERR_IO_PENDING, 3)};
@@ -16339,7 +16349,7 @@
// SPDY GET for HTTPS URL (through CONNECT tunnel)
const HostPortPair host_port_pair("www.example.org", 8080);
spdy::SpdySerializedFrame connect(
- spdy_util_.ConstructSpdyConnect(NULL, 0, 1, LOWEST, host_port_pair));
+ spdy_util_.ConstructSpdyConnect(nullptr, 0, 1, LOWEST, host_port_pair));
spdy::SpdySerializedFrame req1(
spdy_util_wrapped.ConstructSpdyGet(https_url.c_str(), 1, LOWEST));
spdy::SpdySerializedFrame wrapped_req1(
@@ -16369,7 +16379,8 @@
spdy_util_wrapped.ConstructWrappedSpdyFrame(resp1, 1));
spdy::SpdySerializedFrame wrapped_body1(
spdy_util_wrapped.ConstructWrappedSpdyFrame(body1, 1));
- spdy::SpdySerializedFrame resp2(spdy_util_.ConstructSpdyGetReply(NULL, 0, 3));
+ spdy::SpdySerializedFrame resp2(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 3));
spdy::SpdySerializedFrame body2(spdy_util_.ConstructSpdyDataFrame(3, true));
MockRead reads1[] = {
CreateMockRead(conn_resp, 1),
@@ -16474,7 +16485,8 @@
CreateMockWrite(req1, 0),
};
- spdy::SpdySerializedFrame resp1(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp1(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame body1(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead reads1[] = {
MockRead(ASYNC, ERR_IO_PENDING, 1), CreateMockRead(resp1, 2),
@@ -16497,7 +16509,7 @@
};
spdy::SpdySerializedFrame resp2(
- spdy_util_secure.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_secure.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame body2(
spdy_util_secure.ConstructSpdyDataFrame(1, true));
MockRead reads2[] = {CreateMockRead(resp2, 1), CreateMockRead(body2, 2),
@@ -16596,7 +16608,8 @@
CreateMockWrite(req2, 0),
};
- spdy::SpdySerializedFrame resp2(spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy::SpdySerializedFrame resp2(
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame body2(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead reads2[] = {
CreateMockRead(resp2, 1), CreateMockRead(body2, 2),
@@ -16672,7 +16685,7 @@
CreateMockWrite(host1_req, 0),
};
spdy::SpdySerializedFrame host1_resp(
- spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame host1_resp_body(
spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead spdy1_reads[] = {
@@ -16692,7 +16705,7 @@
CreateMockWrite(host2_req, 0),
};
spdy::SpdySerializedFrame host2_resp(
- spdy_util_2.ConstructSpdyGetReply(NULL, 0, 1));
+ spdy_util_2.ConstructSpdyGetReply(nullptr, 0, 1));
spdy::SpdySerializedFrame host2_resp_body(
spdy_util_2.ConstructSpdyDataFrame(1, true));
MockRead spdy2_reads[] = {
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc
index 710f958..51d112a 100644
--- a/net/http/http_proxy_client_socket.cc
+++ b/net/http/http_proxy_client_socket.cc
@@ -99,7 +99,7 @@
}
const HttpResponseInfo* HttpProxyClientSocket::GetConnectResponseInfo() const {
- return response_.headers.get() ? &response_ : NULL;
+ return response_.headers.get() ? &response_ : nullptr;
}
int HttpProxyClientSocket::Connect(CompletionOnceCallback callback) {
diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc
index 47558d33..2b64e3e 100644
--- a/net/http/http_proxy_client_socket_pool_unittest.cc
+++ b/net/http/http_proxy_client_socket_pool_unittest.cc
@@ -130,18 +130,18 @@
scoped_refptr<TransportSocketParams> CreateHttpProxyParams() const {
if (GetParam() != HTTP)
- return NULL;
+ return nullptr;
return new TransportSocketParams(HostPortPair(kHttpProxyHost, 80), false,
OnHostResolutionCallback());
}
scoped_refptr<SSLSocketParams> CreateHttpsProxyParams() const {
if (GetParam() == HTTP)
- return NULL;
+ return nullptr;
return new SSLSocketParams(
new TransportSocketParams(HostPortPair(kHttpsProxyHost, 443), false,
OnHostResolutionCallback()),
- NULL, NULL, HostPortPair(kHttpsProxyHost, 443), SSLConfig(),
+ nullptr, nullptr, HostPortPair(kHttpsProxyHost, 443), SSLConfig(),
PRIVACY_MODE_DISABLED);
}
diff --git a/net/http/http_proxy_connect_job.cc b/net/http/http_proxy_connect_job.cc
index 2379d4a..dbf3065 100644
--- a/net/http/http_proxy_connect_job.cc
+++ b/net/http/http_proxy_connect_job.cc
@@ -147,8 +147,8 @@
spdy_session_pool_(spdy_session_pool),
quic_stream_factory_(quic_stream_factory),
endpoint_(endpoint),
- http_auth_cache_(tunnel ? http_auth_cache : NULL),
- http_auth_handler_factory_(tunnel ? http_auth_handler_factory : NULL),
+ http_auth_cache_(tunnel ? http_auth_cache : nullptr),
+ http_auth_handler_factory_(tunnel ? http_auth_handler_factory : nullptr),
is_trusted_proxy_(is_trusted_proxy),
tunnel_(tunnel),
traffic_annotation_(traffic_annotation) {
diff --git a/net/http/http_proxy_connect_job_unittest.cc b/net/http/http_proxy_connect_job_unittest.cc
index e5ce43c..f942365 100644
--- a/net/http/http_proxy_connect_job_unittest.cc
+++ b/net/http/http_proxy_connect_job_unittest.cc
@@ -511,7 +511,7 @@
SpdyTestUtil spdy_util;
spdy::SpdySerializedFrame connect(spdy_util.ConstructSpdyConnect(
- NULL, 0, 1, DEFAULT_PRIORITY, HostPortPair(kEndpointHost, 443)));
+ nullptr, 0, 1, DEFAULT_PRIORITY, HostPortPair(kEndpointHost, 443)));
spdy::SpdySerializedFrame rst(
spdy_util.ConstructSpdyRstStream(1, spdy::ERROR_CODE_CANCEL));
spdy_util.UpdateWithStreamDestruction(1);
@@ -627,7 +627,7 @@
SpdyTestUtil spdy_util;
spdy::SpdySerializedFrame connect(spdy_util.ConstructSpdyConnect(
- NULL, 0, 1, DEFAULT_PRIORITY, HostPortPair(kEndpointHost, 443)));
+ nullptr, 0, 1, DEFAULT_PRIORITY, HostPortPair(kEndpointHost, 443)));
spdy::SpdySerializedFrame rst(
spdy_util.ConstructSpdyRstStream(1, spdy::ERROR_CODE_CANCEL));
spdy_util.UpdateWithStreamDestruction(1);
@@ -1111,7 +1111,7 @@
SpdyTestUtil spdy_util;
spdy::SpdySerializedFrame connect(spdy_util.ConstructSpdyConnect(
- NULL, 0, 1, DEFAULT_PRIORITY, HostPortPair(kEndpointHost, 443)));
+ nullptr, 0, 1, DEFAULT_PRIORITY, HostPortPair(kEndpointHost, 443)));
spdy::SpdySerializedFrame rst(
spdy_util.ConstructSpdyRstStream(1, spdy::ERROR_CODE_CANCEL));
spdy_util.UpdateWithStreamDestruction(1);
diff --git a/net/http/http_request_info.cc b/net/http/http_request_info.cc
index d8bbe325..f764880 100644
--- a/net/http/http_request_info.cc
+++ b/net/http/http_request_info.cc
@@ -7,7 +7,7 @@
namespace net {
HttpRequestInfo::HttpRequestInfo()
- : upload_data_stream(NULL),
+ : upload_data_stream(nullptr),
load_flags(0),
privacy_mode(PRIVACY_MODE_DISABLED),
reporting_upload_depth(0) {}
diff --git a/net/http/http_response_body_drainer.cc b/net/http/http_response_body_drainer.cc
index 45f363b..010657d 100644
--- a/net/http/http_response_body_drainer.cc
+++ b/net/http/http_response_body_drainer.cc
@@ -22,7 +22,7 @@
: stream_(stream),
next_state_(STATE_NONE),
total_read_(0),
- session_(NULL) {}
+ session_(nullptr) {}
HttpResponseBodyDrainer::~HttpResponseBodyDrainer() = default;
diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc
index f21ba7d..8f229ca 100644
--- a/net/http/http_response_body_drainer_unittest.cc
+++ b/net/http/http_response_body_drainer_unittest.cc
@@ -129,7 +129,7 @@
result_waiter_->set_result(not_reusable);
}
- HttpStream* RenewStreamForAuth() override { return NULL; }
+ HttpStream* RenewStreamForAuth() override { return nullptr; }
bool IsResponseBodyComplete() const override { return is_complete_; }
@@ -225,7 +225,7 @@
void MockHttpStream::CompleteRead() {
int result = ReadResponseBodyImpl(user_buf_.get(), buf_len_);
- user_buf_ = NULL;
+ user_buf_ = nullptr;
base::ResetAndReturn(&callback_).Run(result);
}
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 63f47c78..f457e187 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -889,7 +889,8 @@
size_t iter = 0;
while (EnumerateHeader(&iter, name, &value))
- HttpUtil::ParseContentType(value, mime_type, charset, &had_charset, NULL);
+ HttpUtil::ParseContentType(value, mime_type, charset, &had_charset,
+ nullptr);
}
bool HttpResponseHeaders::GetMimeType(std::string* mime_type) const {
@@ -1279,9 +1280,9 @@
bool HttpResponseHeaders::HasValidators() const {
std::string etag_header;
- EnumerateHeader(NULL, "etag", &etag_header);
+ EnumerateHeader(nullptr, "etag", &etag_header);
std::string last_modified_header;
- EnumerateHeader(NULL, "Last-Modified", &last_modified_header);
+ EnumerateHeader(nullptr, "Last-Modified", &last_modified_header);
return HttpUtil::HasValidators(GetHttpVersion(), etag_header,
last_modified_header);
}
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index d70fb4d..690a8f9a 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -559,9 +559,9 @@
scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
std::string value;
- EXPECT_TRUE(parsed->EnumerateHeader(NULL, "date", &value));
+ EXPECT_TRUE(parsed->EnumerateHeader(nullptr, "date", &value));
EXPECT_EQ("Tue, 07 Aug 2007 23:10:55 GMT", value);
- EXPECT_TRUE(parsed->EnumerateHeader(NULL, "last-modified", &value));
+ EXPECT_TRUE(parsed->EnumerateHeader(nullptr, "last-modified", &value));
EXPECT_EQ("Wed, 01 Aug 2007 23:23:45 GMT", value);
}
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index 7f205e2..0a872c3 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -595,7 +595,7 @@
const url::SchemeHostPort& server) {
auto it = server_network_stats_map_.Get(server);
if (it == server_network_stats_map_.end()) {
- return NULL;
+ return nullptr;
}
return &it->second;
}
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 19eaa7e..3db1d0e 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -250,7 +250,7 @@
std::string request = request_line + headers.ToString();
request_headers_length_ = request.size();
- if (request_->upload_data_stream != NULL) {
+ if (request_->upload_data_stream != nullptr) {
request_body_send_buf_ =
base::MakeRefCounted<SeekableIOBuffer>(kRequestBodyBufferSize);
if (request_->upload_data_stream->is_chunked()) {
@@ -488,10 +488,10 @@
return OK;
}
- if (request_->upload_data_stream != NULL &&
+ if (request_->upload_data_stream != nullptr &&
(request_->upload_data_stream->is_chunked() ||
- // !IsEOF() indicates that the body wasn't merged.
- (request_->upload_data_stream->size() > 0 &&
+ // !IsEOF() indicates that the body wasn't merged.
+ (request_->upload_data_stream->size() > 0 &&
!request_->upload_data_stream->IsEOF()))) {
net_log_.AddEvent(NetLogEventType::HTTP_TRANSACTION_SEND_REQUEST_BODY,
base::Bind(&NetLogSendRequestBodyCallback,
@@ -789,7 +789,7 @@
read_buf_unused_offset_ = 0;
} else {
// Now waiting for more of the body to be read.
- user_read_buf_ = NULL;
+ user_read_buf_ = nullptr;
user_read_buf_len_ = 0;
}
@@ -1164,10 +1164,9 @@
bool HttpStreamParser::ShouldMergeRequestHeadersAndBody(
const std::string& request_headers,
const UploadDataStream* request_body) {
- if (request_body != NULL &&
+ if (request_body != nullptr &&
// IsInMemory() ensures that the request body is not chunked.
- request_body->IsInMemory() &&
- request_body->size() > 0) {
+ request_body->IsInMemory() && request_body->size() > 0) {
uint64_t merged_size = request_headers.size() + request_body->size();
if (merged_size <= kMaxMergedHeaderAndBodySize)
return true;
diff --git a/net/http/http_stream_parser_unittest.cc b/net/http/http_stream_parser_unittest.cc
index 1125d556..16b77a3 100644
--- a/net/http/http_stream_parser_unittest.cc
+++ b/net/http/http_stream_parser_unittest.cc
@@ -341,8 +341,8 @@
TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_NoBody) {
// Shouldn't be merged if upload data is non-existent.
- ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody(
- "some header", NULL));
+ ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody("some header",
+ nullptr));
}
TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_EmptyBody) {
diff --git a/net/http/http_transaction_test_util.cc b/net/http/http_transaction_test_util.cc
index bb000a7..7f9ce92 100644
--- a/net/http/http_transaction_test_util.cc
+++ b/net/http/http_transaction_test_util.cc
@@ -587,11 +587,11 @@
}
HttpCache* MockNetworkLayer::GetCache() {
- return NULL;
+ return nullptr;
}
HttpNetworkSession* MockNetworkLayer::GetSession() {
- return NULL;
+ return nullptr;
}
void MockNetworkLayer::SetClock(base::Clock* clock) {
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 6d9c6e63..150c9c7 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -998,7 +998,7 @@
}
bool HttpUtil::HeadersIterator::AdvanceTo(const char* name) {
- DCHECK(name != NULL);
+ DCHECK(name != nullptr);
DCHECK_EQ(0, base::ToLowerASCII(name).compare(name))
<< "the header name must be in all lower case";
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc
index 355b2060..6880ae4 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -343,7 +343,7 @@
return;
ignore_callbacks_ = value;
if (!value)
- StoreAndDeliverCallbacks(false, NULL, CompletionOnceCallback(), 0);
+ StoreAndDeliverCallbacks(false, nullptr, CompletionOnceCallback(), 0);
}
MockDiskEntry::~MockDiskEntry() = default;
@@ -728,7 +728,7 @@
disk_cache::Backend* backend;
int rv = http_cache_.GetBackend(&backend, cb.callback());
rv = cb.GetResult(rv);
- return (rv == OK) ? backend : NULL;
+ return (rv == OK) ? backend : nullptr;
}
MockDiskCache* MockHttpCache::disk_cache() {
@@ -864,10 +864,7 @@
//-----------------------------------------------------------------------------
MockBlockingBackendFactory::MockBlockingBackendFactory()
- : backend_(NULL),
- block_(true),
- fail_(false) {
-}
+ : backend_(nullptr), block_(true), fail_(false) {}
MockBlockingBackendFactory::~MockBlockingBackendFactory() = default;
diff --git a/net/http/proxy_connect_redirect_http_stream.cc b/net/http/proxy_connect_redirect_http_stream.cc
index 99b3ba4..1f5dae74 100644
--- a/net/http/proxy_connect_redirect_http_stream.cc
+++ b/net/http/proxy_connect_redirect_http_stream.cc
@@ -13,7 +13,7 @@
ProxyConnectRedirectHttpStream::ProxyConnectRedirectHttpStream(
LoadTimingInfo* load_timing_info)
- : has_load_timing_info_(load_timing_info != NULL) {
+ : has_load_timing_info_(load_timing_info != nullptr) {
if (has_load_timing_info_)
load_timing_info_ = *load_timing_info;
}
@@ -123,7 +123,7 @@
HttpStream* ProxyConnectRedirectHttpStream::RenewStreamForAuth() {
NOTREACHED();
- return NULL;
+ return nullptr;
}
} // namespace net
diff --git a/net/http/transport_security_persister.cc b/net/http/transport_security_persister.cc
index ee788d8..804ea45 100644
--- a/net/http/transport_security_persister.cc
+++ b/net/http/transport_security_persister.cc
@@ -236,7 +236,7 @@
if (writer_.HasPendingWrite())
writer_.DoScheduledWrite();
- transport_security_state_->SetDelegate(NULL);
+ transport_security_state_->SetDelegate(nullptr);
}
void TransportSecurityPersister::StateIsDirty(TransportSecurityState* state) {
@@ -294,7 +294,7 @@
TransportSecurityState* state) {
std::unique_ptr<base::Value> value =
base::JSONReader::ReadDeprecated(serialized);
- base::DictionaryValue* dict_value = NULL;
+ base::DictionaryValue* dict_value = nullptr;
if (!value.get() || !value->GetAsDictionary(&dict_value))
return false;
@@ -303,7 +303,7 @@
for (base::DictionaryValue::Iterator i(*dict_value);
!i.IsAtEnd(); i.Advance()) {
- const base::DictionaryValue* parsed = NULL;
+ const base::DictionaryValue* parsed = nullptr;
if (!i.value().GetAsDictionary(&parsed)) {
LOG(WARNING) << "Could not parse entry " << i.key() << "; skipping entry";
continue;
diff --git a/net/http/url_security_manager_win.cc b/net/http/url_security_manager_win.cc
index 97fd9e1..3d6b0100 100644
--- a/net/http/url_security_manager_win.cc
+++ b/net/http/url_security_manager_win.cc
@@ -57,7 +57,8 @@
HRESULT hr;
hr = security_manager_->ProcessUrlAction(
base::as_wcstr(url16), URLACTION_CREDENTIALS_USE,
- reinterpret_cast<BYTE*>(&policy), sizeof(policy), NULL, 0, PUAF_NOUI, 0);
+ reinterpret_cast<BYTE*>(&policy), sizeof(policy), nullptr, 0, PUAF_NOUI,
+ 0);
if (FAILED(hr)) {
LOG(ERROR) << "IInternetSecurityManager::ProcessUrlAction failed: " << hr;
return false;
@@ -102,8 +103,8 @@
bool URLSecurityManagerWin::EnsureSystemSecurityManager() {
if (!security_manager_.Get()) {
- HRESULT hr = CoInternetCreateSecurityManager(
- NULL, security_manager_.GetAddressOf(), NULL);
+ HRESULT hr =
+ CoInternetCreateSecurityManager(nullptr, &security_manager_, 0);
if (FAILED(hr) || !security_manager_.Get()) {
LOG(ERROR) << "Unable to create the Windows Security Manager instance";
return false;
diff --git a/net/log/net_log.cc b/net/log/net_log.cc
index 4481012..afb760e 100644
--- a/net/log/net_log.cc
+++ b/net/log/net_log.cc
@@ -110,8 +110,7 @@
} // namespace
-NetLog::ThreadSafeObserver::ThreadSafeObserver() : net_log_(NULL) {
-}
+NetLog::ThreadSafeObserver::ThreadSafeObserver() : net_log_(nullptr) {}
NetLog::ThreadSafeObserver::~ThreadSafeObserver() {
// Make sure we aren't watching a NetLog on destruction. Because the NetLog
@@ -141,7 +140,7 @@
void NetLog::AddGlobalEntry(NetLogEventType type) {
AddEntry(type, NetLogSource(NetLogSourceType::NONE, NextID()),
- NetLogEventPhase::NONE, NULL);
+ NetLogEventPhase::NONE, nullptr);
}
void NetLog::AddGlobalEntry(
@@ -192,7 +191,7 @@
DCHECK(it != observers_.end());
observers_.erase(it);
- observer->net_log_ = NULL;
+ observer->net_log_ = nullptr;
observer->capture_mode_ = NetLogCaptureMode();
UpdateIsCapturing();
}
@@ -232,7 +231,7 @@
#undef EVENT_TYPE
default:
NOTREACHED();
- return NULL;
+ return nullptr;
}
}
@@ -255,7 +254,7 @@
#undef SOURCE_TYPE
default:
NOTREACHED();
- return NULL;
+ return nullptr;
}
}
@@ -279,7 +278,7 @@
return "PHASE_NONE";
}
NOTREACHED();
- return NULL;
+ return nullptr;
}
// static
diff --git a/net/log/net_log_source.cc b/net/log/net_log_source.cc
index b8104b68..a427f68 100644
--- a/net/log/net_log_source.cc
+++ b/net/log/net_log_source.cc
@@ -57,8 +57,8 @@
// static
bool NetLogSource::FromEventParameters(base::Value* event_params,
NetLogSource* source) {
- base::DictionaryValue* dict = NULL;
- base::DictionaryValue* source_dict = NULL;
+ base::DictionaryValue* dict = nullptr;
+ base::DictionaryValue* source_dict = nullptr;
int source_id = -1;
int source_type = static_cast<int>(NetLogSourceType::COUNT);
if (!event_params || !event_params->GetAsDictionary(&dict) ||
diff --git a/net/log/net_log_unittest.cc b/net/log/net_log_unittest.cc
index 7a82814..21a14096 100644
--- a/net/log/net_log_unittest.cc
+++ b/net/log/net_log_unittest.cc
@@ -162,7 +162,9 @@
class NetLogTestThread : public base::SimpleThread {
public:
NetLogTestThread()
- : base::SimpleThread("NetLogTest"), net_log_(NULL), start_event_(NULL) {}
+ : base::SimpleThread("NetLogTest"),
+ net_log_(nullptr),
+ start_event_(nullptr) {}
// We'll wait for |start_event| to be triggered before calling a subclass's
// subclass's RunTestThread() function.
diff --git a/net/log/net_log_util.cc b/net/log/net_log_util.cc
index 823de8e..59bd8b0 100644
--- a/net/log/net_log_util.cc
+++ b/net/log/net_log_util.cc
@@ -107,11 +107,11 @@
// Despite the name, can return an in memory "disk cache".
disk_cache::Backend* GetDiskCacheBackend(URLRequestContext* context) {
if (!context->http_transaction_factory())
- return NULL;
+ return nullptr;
HttpCache* http_cache = context->http_transaction_factory()->GetCache();
if (!http_cache)
- return NULL;
+ return nullptr;
return http_cache->GetCurrentBackend();
}
diff --git a/net/log/net_log_util_unittest.cc b/net/log/net_log_util_unittest.cc
index 813f60a..9208cd6 100644
--- a/net/log/net_log_util_unittest.cc
+++ b/net/log/net_log_util_unittest.cc
@@ -47,7 +47,7 @@
EXPECT_GT(net_info_without_cache->size(), 0u);
// Fore creation of a cache backend, and get NetInfo again.
- disk_cache::Backend* backend = NULL;
+ disk_cache::Backend* backend = nullptr;
EXPECT_EQ(OK, context.http_transaction_factory()->GetCache()->GetBackend(
&backend, TestCompletionCallback().callback()));
EXPECT_TRUE(http_cache->GetCurrentBackend());
diff --git a/net/log/net_log_with_source.cc b/net/log/net_log_with_source.cc
index 0e88cdf2..8997f64c 100644
--- a/net/log/net_log_with_source.cc
+++ b/net/log/net_log_with_source.cc
@@ -46,7 +46,7 @@
if (!net_log_)
return;
- net_log_->AddEntry(type, source_, phase, NULL);
+ net_log_->AddEntry(type, source_, phase, nullptr);
}
void NetLogWithSource::AddEntry(
diff --git a/net/log/net_log_with_source.h b/net/log/net_log_with_source.h
index d3656f7..820160b 100644
--- a/net/log/net_log_with_source.h
+++ b/net/log/net_log_with_source.h
@@ -19,7 +19,7 @@
// output log messages without needing to pass in the source.
class NET_EXPORT NetLogWithSource {
public:
- NetLogWithSource() : net_log_(NULL) {}
+ NetLogWithSource() : net_log_(nullptr) {}
~NetLogWithSource();
// Add a log entry to the NetLog for the bound source.
diff --git a/net/log/test_net_log_entry.cc b/net/log/test_net_log_entry.cc
index 1936ef3..d58e4d2 100644
--- a/net/log/test_net_log_entry.cc
+++ b/net/log/test_net_log_entry.cc
@@ -37,7 +37,7 @@
time = entry.time;
source = entry.source;
phase = entry.phase;
- params.reset(entry.params ? entry.params->DeepCopy() : NULL);
+ params.reset(entry.params ? entry.params->DeepCopy() : nullptr);
return *this;
}
diff --git a/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win.cc b/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win.cc
index c8b3024..deb86879 100644
--- a/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win.cc
+++ b/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win.cc
@@ -214,7 +214,7 @@
std::wstring adapter_name_wide = base::SysMultiByteToWide(adapter_name,
CP_ACP);
- DHCPCAPI_PARAMS_ARRAY send_params = { 0, NULL };
+ DHCPCAPI_PARAMS_ARRAY send_params = {0, nullptr};
DHCPCAPI_PARAMS wpad_params = { 0 };
wpad_params.OptionId = 252;
@@ -246,13 +246,10 @@
// chances on non-standard, poorly documented usage.
base::ScopedBlockingCall scoped_blocking_call(
FROM_HERE, base::BlockingType::MAY_BLOCK);
- res = ::DhcpRequestParams(DHCPCAPI_REQUEST_SYNCHRONOUS,
- NULL,
- const_cast<LPWSTR>(adapter_name_wide.c_str()),
- NULL,
- send_params, request_params,
- result_buffer.get(), &result_buffer_size,
- NULL);
+ res = ::DhcpRequestParams(
+ DHCPCAPI_REQUEST_SYNCHRONOUS, nullptr,
+ const_cast<LPWSTR>(adapter_name_wide.c_str()), nullptr, send_params,
+ request_params, result_buffer.get(), &result_buffer_size, nullptr);
++retry_count;
} while (res == ERROR_MORE_DATA && retry_count <= 3);
diff --git a/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win_unittest.cc b/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win_unittest.cc
index cdc39aa..d5be763 100644
--- a/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win_unittest.cc
+++ b/net/proxy_resolution/dhcp_pac_file_adapter_fetcher_win_unittest.cc
@@ -54,7 +54,7 @@
void Cancel() override {
DhcpPacFileAdapterFetcher::Cancel();
- fetcher_ = NULL;
+ fetcher_ = nullptr;
}
std::unique_ptr<PacFileFetcher> ImplCreateScriptFetcher() override {
@@ -116,7 +116,7 @@
// the simple approach currently used in ImplCreateScriptFetcher above).
DCHECK(fetcher_ && fetcher_->has_pending_request());
fetcher_->NotifyFetchCompletion(fetcher_result_, pac_script_);
- fetcher_ = NULL;
+ fetcher_ = nullptr;
}
bool IsWaitingForFetcher() const {
diff --git a/net/proxy_resolution/dhcp_pac_file_fetcher_win.cc b/net/proxy_resolution/dhcp_pac_file_fetcher_win.cc
index 5541498..348de98 100644
--- a/net/proxy_resolution/dhcp_pac_file_fetcher_win.cc
+++ b/net/proxy_resolution/dhcp_pac_file_fetcher_win.cc
@@ -275,7 +275,7 @@
URLRequestContext* url_request_context)
: state_(STATE_START),
num_pending_fetchers_(0),
- destination_string_(NULL),
+ destination_string_(nullptr),
url_request_context_(url_request_context),
task_runner_(base::MakeRefCounted<TaskRunnerWithCap>()) {
DCHECK(url_request_context_);
@@ -376,7 +376,7 @@
// and a previous query was cancelled before it completed.
if (query.get() != last_query_.get())
return;
- last_query_ = NULL;
+ last_query_ = nullptr;
DhcpAdapterNamesLoggingInfo* logging_info = query->logging_info();
logging_info->origin_thread_end_time = base::TimeTicks::Now();
@@ -565,14 +565,11 @@
// Return only unicast addresses, and skip information we do not need.
base::ScopedBlockingCall scoped_blocking_call(
FROM_HERE, base::BlockingType::MAY_BLOCK);
- error = GetAdaptersAddresses(AF_UNSPEC,
- GAA_FLAG_SKIP_ANYCAST |
- GAA_FLAG_SKIP_MULTICAST |
- GAA_FLAG_SKIP_DNS_SERVER |
- GAA_FLAG_SKIP_FRIENDLY_NAME,
- NULL,
- adapters.get(),
- &adapters_size);
+ error = GetAdaptersAddresses(
+ AF_UNSPEC,
+ GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST |
+ GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME,
+ nullptr, adapters.get(), &adapters_size);
++num_tries;
} while (error == ERROR_BUFFER_OVERFLOW && num_tries <= 3);
@@ -589,7 +586,7 @@
return false;
}
- IP_ADAPTER_ADDRESSES* adapter = NULL;
+ IP_ADAPTER_ADDRESSES* adapter = nullptr;
for (adapter = adapters.get(); adapter; adapter = adapter->Next) {
if (IsDhcpCapableAdapter(adapter)) {
DCHECK(adapter->AdapterName);
diff --git a/net/proxy_resolution/mock_pac_file_fetcher.cc b/net/proxy_resolution/mock_pac_file_fetcher.cc
index 9e6ce594..07190a6 100644
--- a/net/proxy_resolution/mock_pac_file_fetcher.cc
+++ b/net/proxy_resolution/mock_pac_file_fetcher.cc
@@ -14,8 +14,7 @@
namespace net {
MockPacFileFetcher::MockPacFileFetcher()
- : pending_request_text_(NULL),
- is_shutdown_(false) {}
+ : pending_request_text_(nullptr), is_shutdown_(false) {}
MockPacFileFetcher::~MockPacFileFetcher() = default;
@@ -60,7 +59,7 @@
}
URLRequestContext* MockPacFileFetcher::GetRequestContext() const {
- return NULL;
+ return nullptr;
}
const GURL& MockPacFileFetcher::pending_request_url() const {
diff --git a/net/proxy_resolution/multi_threaded_proxy_resolver.cc b/net/proxy_resolution/multi_threaded_proxy_resolver.cc
index b48196c..a73dba3 100644
--- a/net/proxy_resolution/multi_threaded_proxy_resolver.cc
+++ b/net/proxy_resolution/multi_threaded_proxy_resolver.cc
@@ -158,7 +158,7 @@
class Job : public base::RefCountedThreadSafe<Job> {
public:
- Job() : executor_(NULL), was_cancelled_(false) {}
+ Job() : executor_(nullptr), was_cancelled_(false) {}
void set_executor(Executor* executor) {
executor_ = executor;
@@ -303,8 +303,8 @@
void Run(scoped_refptr<base::SingleThreadTaskRunner> origin_runner) override {
ProxyResolver* resolver = executor()->resolver();
DCHECK(resolver);
- int rv = resolver->GetProxyForURL(url_, &results_buf_,
- CompletionOnceCallback(), NULL, net_log_);
+ int rv = resolver->GetProxyForURL(
+ url_, &results_buf_, CompletionOnceCallback(), nullptr, net_log_);
DCHECK_NE(rv, ERR_IO_PENDING);
origin_runner->PostTask(
@@ -368,7 +368,7 @@
void Executor::OnJobCompleted(Job* job) {
DCHECK_EQ(job, outstanding_job_.get());
- outstanding_job_ = NULL;
+ outstanding_job_ = nullptr;
coordinator_->OnExecutorReady(this);
}
@@ -388,7 +388,7 @@
if (outstanding_job_.get()) {
outstanding_job_->Cancel();
// Orphan the job (since this executor may be deleted soon).
- outstanding_job_->set_executor(NULL);
+ outstanding_job_->set_executor(nullptr);
}
// It is now safe to free the ProxyResolver, since all the tasks that
@@ -396,8 +396,8 @@
resolver_.reset();
// Null some stuff as a precaution.
- coordinator_ = NULL;
- outstanding_job_ = NULL;
+ coordinator_ = nullptr;
+ outstanding_job_ = nullptr;
}
Executor::~Executor() {
@@ -479,7 +479,7 @@
if (!executor->outstanding_job())
return executor;
}
- return NULL;
+ return nullptr;
}
void MultiThreadedProxyResolver::AddNewExecutor() {
diff --git a/net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc b/net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc
index dacb16e..6c93f5d6 100644
--- a/net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc
+++ b/net/proxy_resolution/multi_threaded_proxy_resolver_unittest.cc
@@ -61,7 +61,7 @@
EXPECT_TRUE(worker_thread_checker_.CalledOnValidThread());
EXPECT_TRUE(callback.is_null());
- EXPECT_TRUE(request == NULL);
+ EXPECT_TRUE(request == nullptr);
// Write something into |net_log| (doesn't really have any meaning.)
net_log.BeginEvent(NetLogEventType::PAC_JAVASCRIPT_ALERT);
@@ -261,7 +261,7 @@
BoundTestNetLog log0;
ProxyInfo results0;
rv = resolver().GetProxyForURL(GURL("http://request0"), &results0,
- callback0.callback(), NULL, log0.bound());
+ callback0.callback(), nullptr, log0.bound());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
// Wait for request 0 to finish.
@@ -283,23 +283,23 @@
TestCompletionCallback callback1;
ProxyInfo results1;
- rv =
- resolver().GetProxyForURL(GURL("http://request1"), &results1,
- callback1.callback(), NULL, NetLogWithSource());
+ rv = resolver().GetProxyForURL(GURL("http://request1"), &results1,
+ callback1.callback(), nullptr,
+ NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
TestCompletionCallback callback2;
ProxyInfo results2;
- rv =
- resolver().GetProxyForURL(GURL("http://request2"), &results2,
- callback2.callback(), NULL, NetLogWithSource());
+ rv = resolver().GetProxyForURL(GURL("http://request2"), &results2,
+ callback2.callback(), nullptr,
+ NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
TestCompletionCallback callback3;
ProxyInfo results3;
- rv =
- resolver().GetProxyForURL(GURL("http://request3"), &results3,
- callback3.callback(), NULL, NetLogWithSource());
+ rv = resolver().GetProxyForURL(GURL("http://request3"), &results3,
+ callback3.callback(), nullptr,
+ NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
// Wait for the requests to finish (they must finish in the order they were
@@ -345,7 +345,7 @@
ProxyInfo results1;
BoundTestNetLog log1;
rv = resolver().GetProxyForURL(GURL("http://request1"), &results1,
- callback1.callback(), NULL, log1.bound());
+ callback1.callback(), nullptr, log1.bound());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
std::unique_ptr<ProxyResolver::Request> request2;
@@ -426,9 +426,9 @@
TestCompletionCallback callback1;
ProxyInfo results1;
- rv =
- resolver().GetProxyForURL(GURL("http://request1"), &results1,
- callback1.callback(), NULL, NetLogWithSource());
+ rv = resolver().GetProxyForURL(GURL("http://request1"), &results1,
+ callback1.callback(), nullptr,
+ NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
std::unique_ptr<ProxyResolver::Request> request2;
@@ -441,9 +441,9 @@
TestCompletionCallback callback3;
ProxyInfo results3;
- rv =
- resolver().GetProxyForURL(GURL("http://request3"), &results3,
- callback3.callback(), NULL, NetLogWithSource());
+ rv = resolver().GetProxyForURL(GURL("http://request3"), &results3,
+ callback3.callback(), nullptr,
+ NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
// Cancel request0 (inprogress) and request2 (pending).
@@ -487,23 +487,23 @@
TestCompletionCallback callback0;
ProxyInfo results0;
- rv =
- resolver().GetProxyForURL(GURL("http://request0"), &results0,
- callback0.callback(), NULL, NetLogWithSource());
+ rv = resolver().GetProxyForURL(GURL("http://request0"), &results0,
+ callback0.callback(), nullptr,
+ NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
TestCompletionCallback callback1;
ProxyInfo results1;
- rv =
- resolver().GetProxyForURL(GURL("http://request1"), &results1,
- callback1.callback(), NULL, NetLogWithSource());
+ rv = resolver().GetProxyForURL(GURL("http://request1"), &results1,
+ callback1.callback(), nullptr,
+ NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
TestCompletionCallback callback2;
ProxyInfo results2;
- rv =
- resolver().GetProxyForURL(GURL("http://request2"), &results2,
- callback2.callback(), NULL, NetLogWithSource());
+ rv = resolver().GetProxyForURL(GURL("http://request2"), &results2,
+ callback2.callback(), nullptr,
+ NetLogWithSource());
EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
// Wait until request 0 reaches the worker thread.
diff --git a/net/proxy_resolution/network_delegate_error_observer.cc b/net/proxy_resolution/network_delegate_error_observer.cc
index a898cb6..9998540 100644
--- a/net/proxy_resolution/network_delegate_error_observer.cc
+++ b/net/proxy_resolution/network_delegate_error_observer.cc
@@ -60,7 +60,7 @@
void NetworkDelegateErrorObserver::Core::Shutdown() {
CHECK(origin_runner_->BelongsToCurrentThread());
- network_delegate_ = NULL;
+ network_delegate_ = nullptr;
}
// NetworkDelegateErrorObserver -----------------------------------------------
diff --git a/net/proxy_resolution/network_delegate_error_observer_unittest.cc b/net/proxy_resolution/network_delegate_error_observer_unittest.cc
index 0a13cab02..1bd3e42 100644
--- a/net/proxy_resolution/network_delegate_error_observer_unittest.cc
+++ b/net/proxy_resolution/network_delegate_error_observer_unittest.cc
@@ -108,7 +108,7 @@
base::Thread thread("test_thread");
thread.Start();
NetworkDelegateErrorObserver observer(
- NULL, base::ThreadTaskRunnerHandle::Get().get());
+ nullptr, base::ThreadTaskRunnerHandle::Get().get());
thread.task_runner()->PostTask(
FROM_HERE,
base::BindOnce(&NetworkDelegateErrorObserver::OnPACScriptError,
diff --git a/net/proxy_resolution/pac_file_decider_unittest.cc b/net/proxy_resolution/pac_file_decider_unittest.cc
index c257c2e..cd3d212 100644
--- a/net/proxy_resolution/pac_file_decider_unittest.cc
+++ b/net/proxy_resolution/pac_file_decider_unittest.cc
@@ -108,7 +108,7 @@
class RuleBasedPacFileFetcher : public PacFileFetcher {
public:
explicit RuleBasedPacFileFetcher(const Rules* rules)
- : rules_(rules), request_context_(NULL) {}
+ : rules_(rules), request_context_(nullptr) {}
virtual void SetRequestContext(URLRequestContext* context) {
request_context_ = context;
@@ -285,7 +285,7 @@
rules.AddFailParsingRule("http://custom/proxy.pac");
TestCompletionCallback callback;
- PacFileDecider decider(&fetcher, &dhcp_fetcher, NULL);
+ PacFileDecider decider(&fetcher, &dhcp_fetcher, nullptr);
EXPECT_THAT(decider.Start(ProxyConfigWithAnnotation(
config, TRAFFIC_ANNOTATION_FOR_TESTS),
base::TimeDelta(), true, callback.callback()),
@@ -302,7 +302,7 @@
config.set_pac_url(GURL("http://custom/proxy.pac"));
TestCompletionCallback callback;
- PacFileDecider decider(NULL, &dhcp_fetcher, NULL);
+ PacFileDecider decider(nullptr, &dhcp_fetcher, nullptr);
EXPECT_THAT(decider.Start(ProxyConfigWithAnnotation(
config, TRAFFIC_ANNOTATION_FOR_TESTS),
base::TimeDelta(), true, callback.callback()),
@@ -322,7 +322,7 @@
Rules::Rule rule = rules.AddSuccessRule("http://wpad/wpad.dat");
TestCompletionCallback callback;
- PacFileDecider decider(&fetcher, &dhcp_fetcher, NULL);
+ PacFileDecider decider(&fetcher, &dhcp_fetcher, nullptr);
EXPECT_THAT(decider.Start(ProxyConfigWithAnnotation(
config, TRAFFIC_ANNOTATION_FOR_TESTS),
base::TimeDelta(), true, callback.callback()),
@@ -344,7 +344,7 @@
request_context_.set_host_resolver(&resolver_);
fetcher_.SetRequestContext(&request_context_);
config_.set_auto_detect(true);
- decider_.reset(new PacFileDecider(&fetcher_, &dhcp_fetcher_, NULL));
+ decider_.reset(new PacFileDecider(&fetcher_, &dhcp_fetcher_, nullptr));
}
int StartDecider() {
@@ -428,7 +428,7 @@
base::string16 pac_contents = base::UTF8ToUTF16(kPac);
GURL url("http://foobar/baz");
dhcp_fetcher.SetPacURL(url);
- decider_.reset(new PacFileDecider(&fetcher_, &dhcp_fetcher, NULL));
+ decider_.reset(new PacFileDecider(&fetcher_, &dhcp_fetcher, nullptr));
EXPECT_THAT(StartDecider(), IsError(ERR_IO_PENDING));
dhcp_fetcher.CompleteRequests(OK, pac_contents);
EXPECT_TRUE(decider_->effective_config().value().has_pac_url());
@@ -445,7 +445,7 @@
resolver_.rules_map()[HostResolverSource::SYSTEM]->AddSimulatedFailure(
"wpad");
MockPacFileFetcher fetcher;
- decider_.reset(new PacFileDecider(&fetcher, &dhcp_fetcher_, NULL));
+ decider_.reset(new PacFileDecider(&fetcher, &dhcp_fetcher_, nullptr));
EXPECT_THAT(StartDecider(), IsError(ERR_IO_PENDING));
EXPECT_TRUE(fetcher.has_pending_request());
fetcher.NotifyFetchCompletion(OK, kPac);
@@ -482,7 +482,7 @@
TEST_F(PacFileDeciderQuickCheckTest, CancelPartway) {
resolver_.set_ondemand_mode(true);
EXPECT_THAT(StartDecider(), IsError(ERR_IO_PENDING));
- decider_.reset(NULL);
+ decider_.reset(nullptr);
}
// Fails at WPAD (downloading), but succeeds in choosing the custom PAC.
@@ -499,7 +499,7 @@
Rules::Rule rule = rules.AddSuccessRule("http://custom/proxy.pac");
TestCompletionCallback callback;
- PacFileDecider decider(&fetcher, &dhcp_fetcher, NULL);
+ PacFileDecider decider(&fetcher, &dhcp_fetcher, nullptr);
EXPECT_THAT(decider.Start(ProxyConfigWithAnnotation(
config, TRAFFIC_ANNOTATION_FOR_TESTS),
base::TimeDelta(), true, callback.callback()),
@@ -593,7 +593,7 @@
rules.AddFailDownloadRule("http://custom/proxy.pac");
TestCompletionCallback callback;
- PacFileDecider decider(&fetcher, &dhcp_fetcher, NULL);
+ PacFileDecider decider(&fetcher, &dhcp_fetcher, nullptr);
EXPECT_THAT(decider.Start(ProxyConfigWithAnnotation(
config, TRAFFIC_ANNOTATION_FOR_TESTS),
base::TimeDelta(), true, callback.callback()),
@@ -615,7 +615,7 @@
rules.AddFailParsingRule("http://custom/proxy.pac");
TestCompletionCallback callback;
- PacFileDecider decider(&fetcher, &dhcp_fetcher, NULL);
+ PacFileDecider decider(&fetcher, &dhcp_fetcher, nullptr);
EXPECT_THAT(decider.Start(ProxyConfigWithAnnotation(
config, TRAFFIC_ANNOTATION_FOR_TESTS),
base::TimeDelta(), true, callback.callback()),
@@ -753,7 +753,7 @@
rules.AddFailDownloadRule("http://wpad/wpad.dat");
TestCompletionCallback callback;
- PacFileDecider decider(&fetcher, &dhcp_fetcher, NULL);
+ PacFileDecider decider(&fetcher, &dhcp_fetcher, nullptr);
EXPECT_THAT(decider.Start(ProxyConfigWithAnnotation(
config, TRAFFIC_ANNOTATION_FOR_TESTS),
base::TimeDelta(), true, callback.callback()),
@@ -779,7 +779,7 @@
rules.AddFailDownloadRule("http://wpad/wpad.dat");
TestCompletionCallback callback;
- PacFileDecider decider(&fetcher, &dhcp_fetcher, NULL);
+ PacFileDecider decider(&fetcher, &dhcp_fetcher, nullptr);
// Since there is fallback to DNS-based WPAD, the final error will be that
// it failed downloading, not that it failed parsing.
EXPECT_THAT(decider.Start(ProxyConfigWithAnnotation(
@@ -846,7 +846,7 @@
// Scope so PacFileDecider gets destroyed early.
{
- PacFileDecider decider(&fetcher, dhcp_fetcher.get(), NULL);
+ PacFileDecider decider(&fetcher, dhcp_fetcher.get(), nullptr);
decider.Start(
ProxyConfigWithAnnotation(config, TRAFFIC_ANNOTATION_FOR_TESTS),
base::TimeDelta(), true, callback.callback());
diff --git a/net/proxy_resolution/pac_file_fetcher_impl.cc b/net/proxy_resolution/pac_file_fetcher_impl.cc
index e9e919b..4e7b612 100644
--- a/net/proxy_resolution/pac_file_fetcher_impl.cc
+++ b/net/proxy_resolution/pac_file_fetcher_impl.cc
@@ -331,7 +331,7 @@
next_id_(0),
cur_request_id_(0),
result_code_(OK),
- result_text_(NULL),
+ result_text_(nullptr),
max_response_bytes_(kDefaultMaxResponseBytes),
max_duration_(kDefaultMaxDuration),
allow_file_url_(allow_file_url),
@@ -425,7 +425,7 @@
cur_request_id_ = 0;
callback_.Reset();
result_code_ = OK;
- result_text_ = NULL;
+ result_text_ = nullptr;
fetch_start_time_ = base::TimeTicks();
fetch_time_to_first_byte_ = base::TimeTicks();
}
diff --git a/net/proxy_resolution/polling_proxy_config_service.cc b/net/proxy_resolution/polling_proxy_config_service.cc
index 1035de7..1f39e6f 100644
--- a/net/proxy_resolution/polling_proxy_config_service.cc
+++ b/net/proxy_resolution/polling_proxy_config_service.cc
@@ -38,7 +38,7 @@
// (observers should not be called past this point).
void Orphan() {
base::AutoLock lock(lock_);
- origin_task_runner_ = NULL;
+ origin_task_runner_ = nullptr;
}
bool GetLatestProxyConfig(ProxyConfigWithAnnotation* config) {
diff --git a/net/proxy_resolution/proxy_config.cc b/net/proxy_resolution/proxy_config.cc
index 9cfe6d1..091c685 100644
--- a/net/proxy_resolution/proxy_config.cc
+++ b/net/proxy_resolution/proxy_config.cc
@@ -150,7 +150,7 @@
return GetProxyListForWebSocketScheme();
if (!fallback_proxies.IsEmpty())
return &fallback_proxies;
- return NULL; // No mapping for this scheme. Use direct.
+ return nullptr; // No mapping for this scheme. Use direct.
}
bool ProxyConfig::ProxyRules::Equals(const ProxyRules& other) const {
@@ -172,7 +172,7 @@
return &proxies_for_https;
if (scheme == "ftp")
return &proxies_for_ftp;
- return NULL; // No mapping for this scheme.
+ return nullptr; // No mapping for this scheme.
}
const ProxyList* ProxyConfig::ProxyRules::GetProxyListForWebSocketScheme()
@@ -183,7 +183,7 @@
return &proxies_for_https;
if (!proxies_for_http.IsEmpty())
return &proxies_for_http;
- return NULL;
+ return nullptr;
}
ProxyConfig::ProxyConfig() : auto_detect_(false), pac_mandatory_(false) {}
diff --git a/net/proxy_resolution/proxy_config_service_win_unittest.cc b/net/proxy_resolution/proxy_config_service_win_unittest.cc
index 147e86c..5665e3b9 100644
--- a/net/proxy_resolution/proxy_config_service_win_unittest.cc
+++ b/net/proxy_resolution/proxy_config_service_win_unittest.cc
@@ -30,171 +30,180 @@
ProxyRulesExpectation proxy_rules;
const char* proxy_bypass_list; // newline separated
} tests[] = {
- // Auto detect.
- {
- { // Input.
- TRUE, // fAutoDetect
- NULL, // lpszAutoConfigUrl
- NULL, // lpszProxy
- NULL, // lpszProxyBypass
+ // Auto detect.
+ {
+ {
+ // Input.
+ TRUE, // fAutoDetect
+ nullptr, // lpszAutoConfigUrl
+ nullptr, // lpszProxy
+ nullptr, // lpszProxyBypass
+ },
+
+ // Expected result.
+ true, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::Empty(),
},
- // Expected result.
- true, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::Empty(),
- },
+ // Valid PAC url
+ {
+ {
+ // Input.
+ FALSE, // fAutoDetect
+ L"http://wpad/wpad.dat", // lpszAutoConfigUrl
+ nullptr, // lpszProxy
+ nullptr, // lpszProxy_bypass
+ },
- // Valid PAC url
- {
- { // Input.
- FALSE, // fAutoDetect
- L"http://wpad/wpad.dat", // lpszAutoConfigUrl
- NULL, // lpszProxy
- NULL, // lpszProxy_bypass
+ // Expected result.
+ false, // auto_detect
+ GURL("http://wpad/wpad.dat"), // pac_url
+ ProxyRulesExpectation::Empty(),
},
- // Expected result.
- false, // auto_detect
- GURL("http://wpad/wpad.dat"), // pac_url
- ProxyRulesExpectation::Empty(),
- },
+ // Invalid PAC url string.
+ {
+ {
+ // Input.
+ FALSE, // fAutoDetect
+ L"wpad.dat", // lpszAutoConfigUrl
+ nullptr, // lpszProxy
+ nullptr, // lpszProxy_bypass
+ },
- // Invalid PAC url string.
- {
- { // Input.
- FALSE, // fAutoDetect
- L"wpad.dat", // lpszAutoConfigUrl
- NULL, // lpszProxy
- NULL, // lpszProxy_bypass
+ // Expected result.
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::Empty(),
},
- // Expected result.
- false, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::Empty(),
- },
+ // Single-host in proxy list.
+ {
+ {
+ // Input.
+ FALSE, // fAutoDetect
+ nullptr, // lpszAutoConfigUrl
+ L"www.google.com", // lpszProxy
+ nullptr, // lpszProxy_bypass
+ },
- // Single-host in proxy list.
- {
- { // Input.
- FALSE, // fAutoDetect
- NULL, // lpszAutoConfigUrl
- L"www.google.com", // lpszProxy
- NULL, // lpszProxy_bypass
+ // Expected result.
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::Single("www.google.com:80", // single proxy
+ ""), // bypass rules
},
- // Expected result.
- false, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::Single(
- "www.google.com:80", // single proxy
- ""), // bypass rules
- },
+ // Per-scheme proxy rules.
+ {
+ {
+ // Input.
+ FALSE, // fAutoDetect
+ nullptr, // lpszAutoConfigUrl
+ L"http=www.google.com:80;https=www.foo.com:110", // lpszProxy
+ nullptr, // lpszProxy_bypass
+ },
- // Per-scheme proxy rules.
- {
- { // Input.
- FALSE, // fAutoDetect
- NULL, // lpszAutoConfigUrl
- L"http=www.google.com:80;https=www.foo.com:110", // lpszProxy
- NULL, // lpszProxy_bypass
+ // Expected result.
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::PerScheme("www.google.com:80", // http
+ "www.foo.com:110", // https
+ "", // ftp
+ ""), // bypass rules
},
- // Expected result.
- false, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::PerScheme(
- "www.google.com:80", // http
- "www.foo.com:110", // https
- "", // ftp
- ""), // bypass rules
- },
+ // SOCKS proxy configuration.
+ {
+ {
+ // Input.
+ FALSE, // fAutoDetect
+ nullptr, // lpszAutoConfigUrl
+ L"http=www.google.com:80;https=www.foo.com:110;"
+ L"ftp=ftpproxy:20;socks=foopy:130", // lpszProxy
+ nullptr, // lpszProxy_bypass
+ },
- // SOCKS proxy configuration.
- {
- { // Input.
- FALSE, // fAutoDetect
- NULL, // lpszAutoConfigUrl
- L"http=www.google.com:80;https=www.foo.com:110;"
- L"ftp=ftpproxy:20;socks=foopy:130", // lpszProxy
- NULL, // lpszProxy_bypass
+ // Expected result.
+ // Note that "socks" is interprted as meaning "socks4", since that is
+ // how
+ // Internet Explorer applies the settings. For more details on this
+ // policy, see:
+ // http://code.google.com/p/chromium/issues/detail?id=55912#c2
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::PerSchemeWithSocks(
+ "www.google.com:80", // http
+ "www.foo.com:110", // https
+ "ftpproxy:20", // ftp
+ "socks4://foopy:130", // socks
+ ""), // bypass rules
},
- // Expected result.
- // Note that "socks" is interprted as meaning "socks4", since that is how
- // Internet Explorer applies the settings. For more details on this
- // policy, see:
- // http://code.google.com/p/chromium/issues/detail?id=55912#c2
- false, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::PerSchemeWithSocks(
- "www.google.com:80", // http
- "www.foo.com:110", // https
- "ftpproxy:20", // ftp
- "socks4://foopy:130", // socks
- ""), // bypass rules
- },
+ // Bypass local names.
+ {
+ {
+ // Input.
+ TRUE, // fAutoDetect
+ nullptr, // lpszAutoConfigUrl
+ nullptr, // lpszProxy
+ L"<local>", // lpszProxy_bypass
+ },
- // Bypass local names.
- {
- { // Input.
- TRUE, // fAutoDetect
- NULL, // lpszAutoConfigUrl
- NULL, // lpszProxy
- L"<local>", // lpszProxy_bypass
+ true, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::EmptyWithBypass("<local>"),
},
- true, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::EmptyWithBypass("<local>"),
- },
+ // Bypass "google.com" and local names, using semicolon as delimiter
+ // (ignoring white space).
+ {
+ {
+ // Input.
+ TRUE, // fAutoDetect
+ nullptr, // lpszAutoConfigUrl
+ nullptr, // lpszProxy
+ L"<local> ; google.com", // lpszProxy_bypass
+ },
- // Bypass "google.com" and local names, using semicolon as delimiter
- // (ignoring white space).
- {
- { // Input.
- TRUE, // fAutoDetect
- NULL, // lpszAutoConfigUrl
- NULL, // lpszProxy
- L"<local> ; google.com", // lpszProxy_bypass
+ // Expected result.
+ true, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::EmptyWithBypass("<local>,google.com"),
},
- // Expected result.
- true, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::EmptyWithBypass("<local>,google.com"),
- },
+ // Bypass "foo.com" and "google.com", using lines as delimiter.
+ {
+ {
+ // Input.
+ TRUE, // fAutoDetect
+ nullptr, // lpszAutoConfigUrl
+ nullptr, // lpszProxy
+ L"foo.com\r\ngoogle.com", // lpszProxy_bypass
+ },
- // Bypass "foo.com" and "google.com", using lines as delimiter.
- {
- { // Input.
- TRUE, // fAutoDetect
- NULL, // lpszAutoConfigUrl
- NULL, // lpszProxy
- L"foo.com\r\ngoogle.com", // lpszProxy_bypass
+ // Expected result.
+ true, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"),
},
- // Expected result.
- true, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"),
- },
+ // Bypass "foo.com" and "google.com", using commas as delimiter.
+ {
+ {
+ // Input.
+ TRUE, // fAutoDetect
+ nullptr, // lpszAutoConfigUrl
+ nullptr, // lpszProxy
+ L"foo.com, google.com", // lpszProxy_bypass
+ },
- // Bypass "foo.com" and "google.com", using commas as delimiter.
- {
- { // Input.
- TRUE, // fAutoDetect
- NULL, // lpszAutoConfigUrl
- NULL, // lpszProxy
- L"foo.com, google.com", // lpszProxy_bypass
+ // Expected result.
+ true, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"),
},
-
- // Expected result.
- true, // auto_detect
- GURL(), // pac_url
- ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"),
- },
};
for (size_t i = 0; i < base::size(tests); ++i) {
diff --git a/net/proxy_resolution/proxy_config_unittest.cc b/net/proxy_resolution/proxy_config_unittest.cc
index 2902fd8f..eeaacce 100644
--- a/net/proxy_resolution/proxy_config_unittest.cc
+++ b/net/proxy_resolution/proxy_config_unittest.cc
@@ -13,7 +13,7 @@
void ExpectProxyServerEquals(const char* expectation,
const ProxyList& proxy_servers) {
- if (expectation == NULL) {
+ if (expectation == nullptr) {
EXPECT_TRUE(proxy_servers.IsEmpty());
} else {
EXPECT_EQ(expectation, proxy_servers.ToPacString());
@@ -108,202 +108,204 @@
const char* proxy_for_ftp;
const char* fallback_proxy;
} tests[] = {
- // One HTTP proxy for all schemes.
- {
- "myproxy:80",
+ // One HTTP proxy for all schemes.
+ {
+ "myproxy:80",
- ProxyConfig::ProxyRules::Type::PROXY_LIST,
- "PROXY myproxy:80",
- NULL,
- NULL,
- NULL,
- NULL,
- },
-
- // Multiple HTTP proxies for all schemes.
- {
- "myproxy:80,https://myotherproxy",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST,
- "PROXY myproxy:80;HTTPS myotherproxy:443",
- NULL,
- NULL,
- NULL,
- NULL,
- },
-
- // Only specify a proxy server for "http://" urls.
- {
- "http=myproxy:80",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- "PROXY myproxy:80",
- NULL,
- NULL,
- NULL,
- },
-
- // Specify an HTTP proxy for "ftp://" and a SOCKS proxy for "https://" urls.
- {
- "ftp=ftp-proxy ; https=socks4://foopy",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- NULL,
- "SOCKS foopy:1080",
- "PROXY ftp-proxy:80",
- NULL,
- },
-
- // Give a scheme-specific proxy as well as a non-scheme specific.
- // The first entry "foopy" takes precedance marking this list as
- // Type::PROXY_LIST.
- {
- "foopy ; ftp=ftp-proxy",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST,
- "PROXY foopy:80",
- NULL,
- NULL,
- NULL,
- NULL,
- },
-
- // Give a scheme-specific proxy as well as a non-scheme specific.
- // The first entry "ftp=ftp-proxy" takes precedance marking this list as
- // Type::PROXY_LIST_PER_SCHEME.
- {
- "ftp=ftp-proxy ; foopy",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- NULL,
- NULL,
- "PROXY ftp-proxy:80",
- NULL,
- },
-
- // Include a list of entries for a single scheme.
- {
- "ftp=ftp1,ftp2,ftp3",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- NULL,
- NULL,
- "PROXY ftp1:80;PROXY ftp2:80;PROXY ftp3:80",
- NULL,
- },
-
- // Include multiple entries for the same scheme -- they accumulate.
- {
- "http=http1,http2; http=http3",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- "PROXY http1:80;PROXY http2:80;PROXY http3:80",
- NULL,
- NULL,
- NULL,
- },
-
- // Include lists of entries for multiple schemes.
- {
- "ftp=ftp1,ftp2,ftp3 ; http=http1,http2; ",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- "PROXY http1:80;PROXY http2:80",
- NULL,
- "PROXY ftp1:80;PROXY ftp2:80;PROXY ftp3:80",
- NULL,
- },
-
- // Include non-default proxy schemes.
- {
- "http=https://secure_proxy; ftp=socks4://socks_proxy; https=socks://foo",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- "HTTPS secure_proxy:443",
- "SOCKS5 foo:1080",
- "SOCKS socks_proxy:1080",
- NULL,
- },
-
- // Only SOCKS proxy present, others being blank.
- {
- "socks=foopy",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- NULL,
- NULL,
- NULL,
- "SOCKS foopy:1080",
+ ProxyConfig::ProxyRules::Type::PROXY_LIST,
+ "PROXY myproxy:80",
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
},
- // SOCKS proxy present along with other proxies too
- {
- "http=httpproxy ; https=httpsproxy ; ftp=ftpproxy ; socks=foopy ",
+ // Multiple HTTP proxies for all schemes.
+ {
+ "myproxy:80,https://myotherproxy",
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- "PROXY httpproxy:80",
- "PROXY httpsproxy:80",
- "PROXY ftpproxy:80",
- "SOCKS foopy:1080",
- },
-
- // SOCKS proxy (with modifier) present along with some proxies
- // (FTP being blank)
- {
- "http=httpproxy ; https=httpsproxy ; socks=socks5://foopy ",
-
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- "PROXY httpproxy:80",
- "PROXY httpsproxy:80",
- NULL,
- "SOCKS5 foopy:1080",
+ ProxyConfig::ProxyRules::Type::PROXY_LIST,
+ "PROXY myproxy:80;HTTPS myotherproxy:443",
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
},
- // Include unsupported schemes -- they are discarded.
- {
- "crazy=foopy ; foo=bar ; https=myhttpsproxy",
+ // Only specify a proxy server for "http://" urls.
+ {
+ "http=myproxy:80",
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- NULL,
- "PROXY myhttpsproxy:80",
- NULL,
- NULL,
- },
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ "PROXY myproxy:80",
+ nullptr,
+ nullptr,
+ nullptr,
+ },
- // direct:// as first option for a scheme.
- {
- "http=direct://,myhttpproxy; https=direct://",
+ // Specify an HTTP proxy for "ftp://" and a SOCKS proxy for "https://"
+ // urls.
+ {
+ "ftp=ftp-proxy ; https=socks4://foopy",
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- "DIRECT;PROXY myhttpproxy:80",
- "DIRECT",
- NULL,
- NULL,
- },
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ nullptr,
+ "SOCKS foopy:1080",
+ "PROXY ftp-proxy:80",
+ nullptr,
+ },
- // direct:// as a second option for a scheme.
- {
- "http=myhttpproxy,direct://",
+ // Give a scheme-specific proxy as well as a non-scheme specific.
+ // The first entry "foopy" takes precedance marking this list as
+ // Type::PROXY_LIST.
+ {
+ "foopy ; ftp=ftp-proxy",
- ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
- NULL,
- "PROXY myhttpproxy:80;DIRECT",
- NULL,
- NULL,
- NULL,
- },
+ ProxyConfig::ProxyRules::Type::PROXY_LIST,
+ "PROXY foopy:80",
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ },
+
+ // Give a scheme-specific proxy as well as a non-scheme specific.
+ // The first entry "ftp=ftp-proxy" takes precedance marking this list as
+ // Type::PROXY_LIST_PER_SCHEME.
+ {
+ "ftp=ftp-proxy ; foopy",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ nullptr,
+ nullptr,
+ "PROXY ftp-proxy:80",
+ nullptr,
+ },
+
+ // Include a list of entries for a single scheme.
+ {
+ "ftp=ftp1,ftp2,ftp3",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ nullptr,
+ nullptr,
+ "PROXY ftp1:80;PROXY ftp2:80;PROXY ftp3:80",
+ nullptr,
+ },
+
+ // Include multiple entries for the same scheme -- they accumulate.
+ {
+ "http=http1,http2; http=http3",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ "PROXY http1:80;PROXY http2:80;PROXY http3:80",
+ nullptr,
+ nullptr,
+ nullptr,
+ },
+
+ // Include lists of entries for multiple schemes.
+ {
+ "ftp=ftp1,ftp2,ftp3 ; http=http1,http2; ",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ "PROXY http1:80;PROXY http2:80",
+ nullptr,
+ "PROXY ftp1:80;PROXY ftp2:80;PROXY ftp3:80",
+ nullptr,
+ },
+
+ // Include non-default proxy schemes.
+ {
+ "http=https://secure_proxy; ftp=socks4://socks_proxy; "
+ "https=socks://foo",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ "HTTPS secure_proxy:443",
+ "SOCKS5 foo:1080",
+ "SOCKS socks_proxy:1080",
+ nullptr,
+ },
+
+ // Only SOCKS proxy present, others being blank.
+ {
+ "socks=foopy",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ "SOCKS foopy:1080",
+ },
+
+ // SOCKS proxy present along with other proxies too
+ {
+ "http=httpproxy ; https=httpsproxy ; ftp=ftpproxy ; socks=foopy ",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ "PROXY httpproxy:80",
+ "PROXY httpsproxy:80",
+ "PROXY ftpproxy:80",
+ "SOCKS foopy:1080",
+ },
+
+ // SOCKS proxy (with modifier) present along with some proxies
+ // (FTP being blank)
+ {
+ "http=httpproxy ; https=httpsproxy ; socks=socks5://foopy ",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ "PROXY httpproxy:80",
+ "PROXY httpsproxy:80",
+ nullptr,
+ "SOCKS5 foopy:1080",
+ },
+
+ // Include unsupported schemes -- they are discarded.
+ {
+ "crazy=foopy ; foo=bar ; https=myhttpsproxy",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ nullptr,
+ "PROXY myhttpsproxy:80",
+ nullptr,
+ nullptr,
+ },
+
+ // direct:// as first option for a scheme.
+ {
+ "http=direct://,myhttpproxy; https=direct://",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ "DIRECT;PROXY myhttpproxy:80",
+ "DIRECT",
+ nullptr,
+ nullptr,
+ },
+
+ // direct:// as a second option for a scheme.
+ {
+ "http=myhttpproxy,direct://",
+
+ ProxyConfig::ProxyRules::Type::PROXY_LIST_PER_SCHEME,
+ nullptr,
+ "PROXY myhttpproxy:80;DIRECT",
+ nullptr,
+ nullptr,
+ nullptr,
+ },
};
diff --git a/net/proxy_resolution/proxy_resolution_service.cc b/net/proxy_resolution/proxy_resolution_service.cc
index a657d1ff..133bff3 100644
--- a/net/proxy_resolution/proxy_resolution_service.cc
+++ b/net/proxy_resolution/proxy_resolution_service.cc
@@ -431,7 +431,7 @@
public:
InitProxyResolver()
: proxy_resolver_factory_(nullptr),
- proxy_resolver_(NULL),
+ proxy_resolver_(nullptr),
resolver_using_auto_detected_script_(nullptr),
next_state_(STATE_NONE),
quick_check_enabled_(true) {}
@@ -747,7 +747,7 @@
// Start the PAC file decider to see if anything has changed.
// TODO(eroman): Pass a proper NetLog rather than NULL.
decider_.reset(
- new PacFileDecider(pac_file_fetcher_, dhcp_pac_file_fetcher_, NULL));
+ new PacFileDecider(pac_file_fetcher_, dhcp_pac_file_fetcher_, nullptr));
decider_->set_quick_check_enabled(quick_check_enabled_);
int result = decider_->Start(
config_, TimeDelta(), proxy_resolver_expects_pac_bytes_,
@@ -844,7 +844,7 @@
// static
const ProxyResolutionService::PacPollPolicy*
- ProxyResolutionService::PacFileDeciderPoller::poll_policy_ = NULL;
+ ProxyResolutionService::PacFileDeciderPoller::poll_policy_ = nullptr;
class ProxyResolutionService::RequestImpl
: public ProxyResolutionService::Request {
@@ -1097,7 +1097,7 @@
// TODO(eroman): This isn't quite right, won't work if |pc| specifies
// a PAC script.
return CreateUsingSystemProxyResolver(
- std::make_unique<ProxyConfigServiceFixed>(pc), NULL);
+ std::make_unique<ProxyConfigServiceFixed>(pc), nullptr);
}
// static
@@ -1339,7 +1339,7 @@
base::Unretained(this)),
fetched_config_.value(), resolver_factory_->expects_pac_bytes(),
pac_file_fetcher_.get(), dhcp_pac_file_fetcher_.get(), result,
- init_proxy_resolver_->script_data(), NULL));
+ init_proxy_resolver_->script_data(), nullptr));
script_poller_->set_quick_check_enabled(quick_check_enabled_);
init_proxy_resolver_.reset();
diff --git a/net/proxy_resolution/proxy_resolver_v8.cc b/net/proxy_resolution/proxy_resolver_v8.cc
index 486b08d..2ac6072 100644
--- a/net/proxy_resolution/proxy_resolver_v8.cc
+++ b/net/proxy_resolution/proxy_resolver_v8.cc
@@ -407,7 +407,7 @@
v8::Isolate* GetSharedIsolateWithoutCreating() {
base::AutoLock lock(lock_);
- return holder_ ? holder_->isolate() : NULL;
+ return holder_ ? holder_->isolate() : nullptr;
}
private:
@@ -567,8 +567,8 @@
global_template->Set(ASCIILiteralToV8String(isolate_, "isInNetEx"),
is_in_net_ex_template);
- v8_context_.Reset(
- isolate_, v8::Context::New(isolate_, NULL, global_template));
+ v8_context_.Reset(isolate_,
+ v8::Context::New(isolate_, nullptr, global_template));
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate_, v8_context_);
diff --git a/net/proxy_resolution/proxy_resolver_v8_tracing.cc b/net/proxy_resolution/proxy_resolver_v8_tracing.cc
index 8e16acc..5744166c 100644
--- a/net/proxy_resolution/proxy_resolver_v8_tracing.cc
+++ b/net/proxy_resolution/proxy_resolver_v8_tracing.cc
@@ -412,7 +412,7 @@
event_.Signal();
bindings_.reset();
- owned_self_reference_ = NULL;
+ owned_self_reference_ = nullptr;
}
LoadState Job::GetLoadState() const {
@@ -452,7 +452,7 @@
callback_.Reset();
// For good measure, clear this other user-owned pointer.
- user_results_ = NULL;
+ user_results_ = nullptr;
}
ProxyResolverV8* Job::v8_resolver() {
@@ -499,7 +499,7 @@
std::move(callback).Run(result);
bindings_.reset();
- owned_self_reference_ = NULL;
+ owned_self_reference_ = nullptr;
}
void Job::Start(Operation op,
@@ -632,7 +632,7 @@
return false;
}
- if (!PostDnsOperationAndWait(host, op, NULL))
+ if (!PostDnsOperationAndWait(host, op, nullptr))
return false; // Was cancelled.
CHECK(GetDnsFromLocalCache(host, op, output, &rv));
diff --git a/net/proxy_resolution/proxy_resolver_winhttp.cc b/net/proxy_resolution/proxy_resolver_winhttp.cc
index 4ff81f7e..ecffcd6c 100644
--- a/net/proxy_resolution/proxy_resolver_winhttp.cc
+++ b/net/proxy_resolution/proxy_resolver_winhttp.cc
@@ -76,7 +76,7 @@
ProxyResolverWinHttp::ProxyResolverWinHttp(
const scoped_refptr<PacFileData>& script_data)
- : session_handle_(NULL),
+ : session_handle_(nullptr),
pac_url_(script_data->type() == PacFileData::TYPE_AUTO_DETECT
? GURL("http://wpad/wpad.dat")
: script_data->url()) {}
@@ -186,11 +186,9 @@
bool ProxyResolverWinHttp::OpenWinHttpSession() {
DCHECK(!session_handle_);
- session_handle_ = WinHttpOpen(NULL,
- WINHTTP_ACCESS_TYPE_NO_PROXY,
- WINHTTP_NO_PROXY_NAME,
- WINHTTP_NO_PROXY_BYPASS,
- 0);
+ session_handle_ =
+ WinHttpOpen(nullptr, WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME,
+ WINHTTP_NO_PROXY_BYPASS, 0);
if (!session_handle_)
return false;
@@ -207,7 +205,7 @@
void ProxyResolverWinHttp::CloseWinHttpSession() {
if (session_handle_) {
WinHttpCloseHandle(session_handle_);
- session_handle_ = NULL;
+ session_handle_ = nullptr;
}
}
diff --git a/net/quic/bidirectional_stream_quic_impl_unittest.cc b/net/quic/bidirectional_stream_quic_impl_unittest.cc
index b33a44ec..9b23b54 100644
--- a/net/quic/bidirectional_stream_quic_impl_unittest.cc
+++ b/net/quic/bidirectional_stream_quic_impl_unittest.cc
@@ -1744,9 +1744,9 @@
// Server sends the response headers.
spdy::SpdyHeaderBlock response_headers = ConstructResponseHeaders("200");
size_t spdy_response_headers_frame_length;
- ProcessPacket(
- ConstructResponseHeadersPacket(2, !kFin, std::move(response_headers),
- &spdy_response_headers_frame_length, 0));
+ ProcessPacket(ConstructResponseHeadersPacket(
+ 2, !kFin, std::move(response_headers),
+ &spdy_response_headers_frame_length, nullptr));
delegate->WaitUntilNextCallback(kOnHeadersReceived);
EXPECT_EQ("200", delegate->response_headers().find(":status")->second);
@@ -2117,9 +2117,9 @@
// Server sends the response headers.
spdy::SpdyHeaderBlock response_headers = ConstructResponseHeaders("200");
size_t spdy_response_headers_frame_length;
- ProcessPacket(
- ConstructResponseHeadersPacket(2, !kFin, std::move(response_headers),
- &spdy_response_headers_frame_length, 0));
+ ProcessPacket(ConstructResponseHeadersPacket(
+ 2, !kFin, std::move(response_headers),
+ &spdy_response_headers_frame_length, nullptr));
delegate->WaitUntilNextCallback(kOnHeadersReceived);
EXPECT_EQ("200", delegate->response_headers().find(":status")->second);
diff --git a/net/quic/quic_proxy_client_socket_unittest.cc b/net/quic/quic_proxy_client_socket_unittest.cc
index 182b91a..e0a6bfe 100644
--- a/net/quic/quic_proxy_client_socket_unittest.cc
+++ b/net/quic/quic_proxy_client_socket_unittest.cc
@@ -1420,9 +1420,9 @@
ResumeAndRun();
ASSERT_FALSE(sock_->IsConnected());
- ASSERT_EQ(0, sock_->Read(NULL, 1, CompletionOnceCallback()));
- ASSERT_EQ(0, sock_->Read(NULL, 1, CompletionOnceCallback()));
- ASSERT_EQ(0, sock_->Read(NULL, 1, CompletionOnceCallback()));
+ ASSERT_EQ(0, sock_->Read(nullptr, 1, CompletionOnceCallback()));
+ ASSERT_EQ(0, sock_->Read(nullptr, 1, CompletionOnceCallback()));
+ ASSERT_EQ(0, sock_->Read(nullptr, 1, CompletionOnceCallback()));
ASSERT_FALSE(sock_->IsConnectedAndIdle());
}
@@ -1490,8 +1490,8 @@
ResumeAndRun();
AssertSyncReadEquals(kMsg1, kLen1);
- ASSERT_EQ(0, sock_->Read(NULL, 1, CompletionOnceCallback()));
- ASSERT_EQ(0, sock_->Read(NULL, 1, CompletionOnceCallback()));
+ ASSERT_EQ(0, sock_->Read(nullptr, 1, CompletionOnceCallback()));
+ ASSERT_EQ(0, sock_->Read(nullptr, 1, CompletionOnceCallback()));
sock_->Disconnect();
ASSERT_EQ(ERR_SOCKET_NOT_CONNECTED,
@@ -1753,7 +1753,7 @@
private:
void OnComplete(int result) {
- sock_->reset(NULL);
+ sock_->reset(nullptr);
SetResult(result);
}
diff --git a/net/quic/quic_utils_chromium.h b/net/quic/quic_utils_chromium.h
index 839c6d32..4932bfa 100644
--- a/net/quic/quic_utils_chromium.h
+++ b/net/quic/quic_utils_chromium.h
@@ -61,7 +61,7 @@
const typename Collection::value_type::first_type& key) {
typename Collection::const_iterator it = collection.find(key);
if (it == collection.end()) {
- return 0;
+ return nullptr;
}
return &it->second;
}
@@ -73,7 +73,7 @@
const typename Collection::value_type::first_type& key) {
typename Collection::iterator it = collection.find(key);
if (it == collection.end()) {
- return 0;
+ return nullptr;
}
return &it->second;
}
diff --git a/net/server/http_connection.cc b/net/server/http_connection.cc
index a42f23bc..0cf5d1a1 100644
--- a/net/server/http_connection.cc
+++ b/net/server/http_connection.cc
@@ -19,7 +19,7 @@
}
HttpConnection::ReadIOBuffer::~ReadIOBuffer() {
- data_ = NULL; // base_ owns data_.
+ data_ = nullptr; // base_ owns data_.
}
int HttpConnection::ReadIOBuffer::GetCapacity() const {
@@ -97,7 +97,7 @@
}
HttpConnection::QueuedWriteIOBuffer::~QueuedWriteIOBuffer() {
- data_ = NULL; // pending_data_ owns data_.
+ data_ = nullptr; // pending_data_ owns data_.
}
bool HttpConnection::QueuedWriteIOBuffer::IsEmpty() const {
@@ -134,7 +134,8 @@
data_ += size;
} else { // size == GetSizeToWrite(). Updates data_ to next pending data.
pending_data_.pop();
- data_ = IsEmpty() ? NULL : const_cast<char*>(pending_data_.front()->data());
+ data_ =
+ IsEmpty() ? nullptr : const_cast<char*>(pending_data_.front()->data());
}
total_size_ -= size;
}
diff --git a/net/server/http_server.cc b/net/server/http_server.cc
index 4c84b5d..cf711625c 100644
--- a/net/server/http_server.cc
+++ b/net/server/http_server.cc
@@ -73,7 +73,7 @@
const HttpServerRequestInfo& request,
NetworkTrafficAnnotationTag traffic_annotation) {
HttpConnection* connection = FindConnection(connection_id);
- if (connection == NULL)
+ if (connection == nullptr)
return;
DCHECK(connection->web_socket());
connection->web_socket()->Accept(request, traffic_annotation);
@@ -84,7 +84,7 @@
const std::string& data,
NetworkTrafficAnnotationTag traffic_annotation) {
HttpConnection* connection = FindConnection(connection_id);
- if (connection == NULL)
+ if (connection == nullptr)
return;
DCHECK(connection->web_socket());
connection->web_socket()->Send(data, traffic_annotation);
@@ -94,7 +94,7 @@
const std::string& data,
NetworkTrafficAnnotationTag traffic_annotation) {
HttpConnection* connection = FindConnection(connection_id);
- if (connection == NULL)
+ if (connection == nullptr)
return;
bool writing_in_progress = !connection->write_buf()->IsEmpty();
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc
index 19faad0..06de102f 100644
--- a/net/server/http_server_unittest.cc
+++ b/net/server/http_server_unittest.cc
@@ -67,7 +67,7 @@
int ConnectAndWait(const IPEndPoint& address) {
AddressList addresses(address);
NetLogSource source;
- socket_.reset(new TCPClientSocket(addresses, NULL, NULL, source));
+ socket_.reset(new TCPClientSocket(addresses, nullptr, nullptr, source));
TestCompletionCallback callback;
int rv = socket_->Connect(callback.callback());
@@ -177,7 +177,7 @@
void SetUp() override {
std::unique_ptr<ServerSocket> server_socket(
- new TCPServerSocket(NULL, NetLogSource()));
+ new TCPServerSocket(nullptr, NetLogSource()));
server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1);
server_.reset(new HttpServer(std::move(server_socket), this));
ASSERT_THAT(server_->GetLocalAddress(&server_address_), IsOk());
@@ -544,10 +544,7 @@
class MockStreamSocket : public StreamSocket {
public:
- MockStreamSocket()
- : connected_(true),
- read_buf_(NULL),
- read_buf_len_(0) {}
+ MockStreamSocket() : connected_(true), read_buf_(nullptr), read_buf_len_(0) {}
// StreamSocket
int Connect(CompletionOnceCallback callback) override {
@@ -556,7 +553,7 @@
void Disconnect() override {
connected_ = false;
if (!read_callback_.is_null()) {
- read_buf_ = NULL;
+ read_buf_ = nullptr;
read_buf_len_ = 0;
std::move(read_callback_).Run(ERR_CONNECTION_CLOSED);
}
@@ -625,7 +622,7 @@
int read_len = std::min(data_len, read_buf_len_);
memcpy(read_buf_->data(), data, read_len);
pending_read_data_.assign(data + read_len, data_len - read_len);
- read_buf_ = NULL;
+ read_buf_ = nullptr;
read_buf_len_ = 0;
std::move(read_callback_).Run(read_len);
}
diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc
index 5ee34755..cd9f6f2f 100644
--- a/net/socket/client_socket_handle.cc
+++ b/net/socket/client_socket_handle.cc
@@ -20,8 +20,8 @@
ClientSocketHandle::ClientSocketHandle()
: is_initialized_(false),
- pool_(NULL),
- higher_pool_(NULL),
+ pool_(nullptr),
+ higher_pool_(nullptr),
reuse_type_(ClientSocketHandle::UNUSED),
is_ssl_error_(false) {}
@@ -74,7 +74,7 @@
callback_.Reset();
if (higher_pool_)
RemoveHigherLayeredPool(higher_pool_);
- pool_ = NULL;
+ pool_ = nullptr;
idle_time_ = base::TimeDelta();
// Connection timing is still needed for handling
// ERR_HTTPS_PROXY_TUNNEL_RESPONSE_REDIRECT errors.
@@ -126,7 +126,7 @@
CHECK_EQ(higher_pool_, higher_pool);
if (pool_) {
pool_->RemoveHigherLayeredPool(higher_pool);
- higher_pool_ = NULL;
+ higher_pool_ = nullptr;
}
}
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index caae809..930311e 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -796,7 +796,7 @@
while (true) {
// If we have idle sockets, see if we can give one to the top-stalled group.
std::string top_group_name;
- Group* top_group = NULL;
+ Group* top_group = nullptr;
if (!FindTopStalledGroup(&top_group, &top_group_name))
return;
@@ -823,8 +823,8 @@
Group** group,
std::string* group_name) const {
CHECK((group && group_name) || (!group && !group_name));
- Group* top_group = NULL;
- const std::string* top_group_name = NULL;
+ Group* top_group = nullptr;
+ const std::string* top_group_name = nullptr;
bool has_stalled_group = false;
for (auto i = group_map_.begin(); i != group_map_.end(); ++i) {
Group* curr_group = i->second;
@@ -1018,7 +1018,7 @@
bool ClientSocketPoolBaseHelper::CloseOneIdleSocket() {
if (idle_socket_count() == 0)
return false;
- return CloseOneIdleSocketExceptInGroup(NULL);
+ return CloseOneIdleSocketExceptInGroup(nullptr);
}
bool ClientSocketPoolBaseHelper::CloseOneIdleSocketExceptInGroup(
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h
index 774b5a55..b32e351b 100644
--- a/net/socket/client_socket_pool_base.h
+++ b/net/socket/client_socket_pool_base.h
@@ -296,7 +296,7 @@
private:
// Entry for a persistent socket which became idle at time |start_time|.
struct IdleSocket {
- IdleSocket() : socket(NULL) {}
+ IdleSocket() : socket(nullptr) {}
// An idle socket can't be used if it is disconnected or has been used
// before and has received data unexpectedly (hence no longer idle). The
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index dba6485..14bcc532 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -360,8 +360,8 @@
int ConnectInternal() override {
AddressList ignored;
- client_socket_factory_->CreateTransportClientSocket(ignored, NULL, NULL,
- NetLogSource());
+ client_socket_factory_->CreateTransportClientSocket(
+ ignored, nullptr, nullptr, NetLogSource());
switch (job_type_) {
case kMockJob:
return DoConnect(true /* successful */, false /* sync */,
@@ -537,7 +537,7 @@
net_log,
nullptr /* websocket_endpoint_lock_manager */),
job_type_(TestConnectJob::kMockJob),
- job_types_(NULL),
+ job_types_(nullptr),
client_socket_factory_(client_socket_factory) {}
~TestConnectJobFactory() override = default;
@@ -876,7 +876,7 @@
log.bound()));
EXPECT_FALSE(handle.socket());
EXPECT_FALSE(handle.is_ssl_error());
- EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == NULL);
+ EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == nullptr);
TestLoadTimingInfoNotConnected(handle);
TestNetLogEntry::List entries;
@@ -1885,7 +1885,7 @@
EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", &handle));
EXPECT_THAT(callback.WaitForResult(), IsError(ERR_CONNECTION_FAILED));
EXPECT_FALSE(handle.is_ssl_error());
- EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == NULL);
+ EXPECT_TRUE(handle.ssl_error_response_info().headers.get() == nullptr);
TestNetLogEntry::List entries;
log.GetEntries(&entries);
@@ -2292,7 +2292,7 @@
EXPECT_FALSE(handle.is_initialized());
EXPECT_FALSE(handle.socket());
EXPECT_TRUE(handle.is_ssl_error());
- EXPECT_FALSE(handle.ssl_error_response_info().headers.get() == NULL);
+ EXPECT_FALSE(handle.ssl_error_response_info().headers.get() == nullptr);
}
TEST_F(ClientSocketPoolBaseTest, AdditionalErrorStateAsynchronous) {
@@ -2313,7 +2313,7 @@
EXPECT_FALSE(handle.is_initialized());
EXPECT_FALSE(handle.socket());
EXPECT_TRUE(handle.is_ssl_error());
- EXPECT_FALSE(handle.ssl_error_response_info().headers.get() == NULL);
+ EXPECT_FALSE(handle.ssl_error_response_info().headers.get() == nullptr);
}
// Make sure we can reuse sockets.
@@ -2336,7 +2336,7 @@
ASSERT_THAT(callback.WaitForResult(), IsOk());
// Use and release the socket.
- EXPECT_EQ(1, handle.socket()->Write(NULL, 1, CompletionOnceCallback(),
+ EXPECT_EQ(1, handle.socket()->Write(nullptr, 1, CompletionOnceCallback(),
TRAFFIC_ANNOTATION_FOR_TESTS));
TestLoadTimingInfoConnectedNotReused(handle);
handle.Reset();
@@ -2402,7 +2402,7 @@
handle.Reset();
ASSERT_THAT(callback2.WaitForResult(), IsOk());
// Use the socket.
- EXPECT_EQ(1, handle2.socket()->Write(NULL, 1, CompletionOnceCallback(),
+ EXPECT_EQ(1, handle2.socket()->Write(nullptr, 1, CompletionOnceCallback(),
TRAFFIC_ANNOTATION_FOR_TESTS));
handle2.Reset();
@@ -2666,7 +2666,8 @@
EXPECT_FALSE(req.handle()->is_initialized());
EXPECT_FALSE(req.handle()->socket());
EXPECT_TRUE(req.handle()->is_ssl_error());
- EXPECT_FALSE(req.handle()->ssl_error_response_info().headers.get() == NULL);
+ EXPECT_FALSE(req.handle()->ssl_error_response_info().headers.get() ==
+ nullptr);
}
// http://crbug.com/44724 regression test.
@@ -3203,9 +3204,9 @@
EXPECT_THAT(callback3.WaitForResult(), IsOk());
// Use the socket.
- EXPECT_EQ(1, handle1.socket()->Write(NULL, 1, CompletionOnceCallback(),
+ EXPECT_EQ(1, handle1.socket()->Write(nullptr, 1, CompletionOnceCallback(),
TRAFFIC_ANNOTATION_FOR_TESTS));
- EXPECT_EQ(1, handle3.socket()->Write(NULL, 1, CompletionOnceCallback(),
+ EXPECT_EQ(1, handle3.socket()->Write(nullptr, 1, CompletionOnceCallback(),
TRAFFIC_ANNOTATION_FOR_TESTS));
handle1.Reset();
@@ -3914,7 +3915,7 @@
EXPECT_EQ(1, pool_->NumActiveSocketsInGroup("a"));
// Drain the pending read.
- EXPECT_EQ(1, handle.socket()->Read(NULL, 1, CompletionOnceCallback()));
+ EXPECT_EQ(1, handle.socket()->Read(nullptr, 1, CompletionOnceCallback()));
TestLoadTimingInfoConnectedReused(handle);
handle.Reset();
diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket_pool_manager.cc
index dcfd7f9..d59710b0 100644
--- a/net/socket/client_socket_pool_manager.cc
+++ b/net/socket/client_socket_pool_manager.cc
@@ -129,9 +129,9 @@
resolution_callback);
// Set ssl_params, and unset proxy_tcp_params
ssl_params = new SSLSocketParams(
- proxy_tcp_params, NULL, NULL, proxy_server.host_port_pair(),
+ proxy_tcp_params, nullptr, nullptr, proxy_server.host_port_pair(),
ssl_config_for_proxy, PRIVACY_MODE_DISABLED);
- proxy_tcp_params = NULL;
+ proxy_tcp_params = nullptr;
}
if (!proxy_info.is_quic()) {
@@ -428,7 +428,7 @@
proxy_info, quic::QUIC_VERSION_UNSUPPORTED, ssl_config_for_origin,
ssl_config_for_proxy,
/*force_tunnel=*/false, privacy_mode, SocketTag(), net_log,
- num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL,
+ num_preconnect_streams, nullptr, HttpNetworkSession::NORMAL_SOCKET_POOL,
OnHostResolutionCallback(), CompletionOnceCallback(),
ClientSocketPool::ProxyAuthCallback());
}
diff --git a/net/socket/sequenced_socket_data_unittest.cc b/net/socket/sequenced_socket_data_unittest.cc
index 1d08a05..97562f1 100644
--- a/net/socket/sequenced_socket_data_unittest.cc
+++ b/net/socket/sequenced_socket_data_unittest.cc
@@ -664,7 +664,7 @@
for (int i = 0; i < gtest_failures.size(); ++i) {
const ::testing::TestPartResult& result =
gtest_failures.GetTestPartResult(i);
- EXPECT_TRUE(strstr(result.message(), kExpectedFailures[i]) != NULL);
+ EXPECT_TRUE(strstr(result.message(), kExpectedFailures[i]) != nullptr);
}
set_expect_eof(false);
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index 7ecb940..a234ab5 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -321,8 +321,8 @@
SSLSocketDataProvider::SSLSocketDataProvider(IoMode mode, int result)
: connect(mode, result),
next_proto(kProtoUnknown),
- cert_request_info(NULL),
- channel_id_service(NULL),
+ cert_request_info(nullptr),
+ channel_id_service(nullptr),
expected_ssl_version_min(kDefaultSSLVersionMin),
expected_ssl_version_max(kDefaultSSLVersionMax) {
SSLConnectionStatusSetVersion(SSL_CONNECTION_VERSION_TLS1_3,
@@ -913,7 +913,7 @@
read_data_(SYNCHRONOUS, ERR_UNEXPECTED),
need_read_data_(true),
peer_closed_connection_(false),
- pending_read_buf_(NULL),
+ pending_read_buf_(nullptr),
pending_read_buf_len_(0),
was_used_to_convey_data_(false),
enable_read_if_ready_(false) {
@@ -1482,7 +1482,7 @@
}
void MockSSLClientSocket::Disconnect() {
- if (stream_socket_ != NULL)
+ if (stream_socket_ != nullptr)
stream_socket_->Disconnect();
}
@@ -1582,7 +1582,7 @@
crypto::ECPrivateKey* MockSSLClientSocket::GetChannelIDKey() const {
NOTREACHED();
- return NULL;
+ return nullptr;
}
void MockSSLClientSocket::RunCallbackAsync(CompletionOnceCallback callback,
@@ -1619,7 +1619,7 @@
need_read_data_(true),
source_port_(123),
network_(NetworkChangeNotifier::kInvalidNetworkHandle),
- pending_read_buf_(NULL),
+ pending_read_buf_(nullptr),
pending_read_buf_len_(0),
net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::NONE)),
weak_factory_(this) {
@@ -1903,7 +1903,7 @@
scoped_refptr<IOBuffer> buf = pending_read_buf_;
int buf_len = pending_read_buf_len_;
CompletionOnceCallback callback = std::move(pending_read_callback_);
- pending_read_buf_ = NULL;
+ pending_read_buf_ = nullptr;
pending_read_buf_len_ = 0;
int result = read_data_.result;
@@ -2031,7 +2031,7 @@
if (handle != handle_)
return false;
socket_.reset();
- handle_ = NULL;
+ handle_ = nullptr;
user_callback_.Reset();
return true;
}
@@ -2060,7 +2060,7 @@
handle_->set_connection_attempts(attempts);
}
- handle_ = NULL;
+ handle_ = nullptr;
if (!user_callback_.is_null()) {
std::move(user_callback_).Run(rv);
@@ -2110,7 +2110,7 @@
last_request_priority_ = priority;
std::unique_ptr<StreamSocket> socket =
client_socket_factory_->CreateTransportClientSocket(
- AddressList(), NULL, net_log.net_log(), NetLogSource());
+ AddressList(), nullptr, net_log.net_log(), NetLogSource());
MockConnectJob* job = new MockConnectJob(
std::move(socket), handle, socket_tag, std::move(callback), priority);
job_list_.push_back(base::WrapUnique(job));
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index 4dd63f7..b08ca4a5 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -120,7 +120,7 @@
MockReadWrite()
: mode(SYNCHRONOUS),
result(0),
- data(NULL),
+ data(nullptr),
data_len(0),
sequence_number(0) {}
@@ -128,7 +128,7 @@
MockReadWrite(IoMode io_mode, int result)
: mode(io_mode),
result(result),
- data(NULL),
+ data(nullptr),
data_len(0),
sequence_number(0) {}
@@ -136,7 +136,7 @@
MockReadWrite(IoMode io_mode, int result, int seq)
: mode(io_mode),
result(result),
- data(NULL),
+ data(nullptr),
data_len(0),
sequence_number(seq) {}
diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc
index f497b1a..4d76dd3 100644
--- a/net/socket/socks5_client_socket_unittest.cc
+++ b/net/socket/socks5_client_socket_unittest.cc
@@ -204,7 +204,8 @@
MockRead(SYNCHRONOUS, kSOCKS5OkResponse, kSOCKS5OkResponseLength)
};
- user_sock_ = BuildMockSocket(data_reads, data_writes, hostname, 80, NULL);
+ user_sock_ =
+ BuildMockSocket(data_reads, data_writes, hostname, 80, nullptr);
int rv = user_sock_->Connect(callback_.callback());
EXPECT_THAT(rv, IsOk());
@@ -225,7 +226,7 @@
MockWrite data_writes[] = {MockWrite()};
MockRead data_reads[] = {MockRead()};
user_sock_ =
- BuildMockSocket(data_reads, data_writes, large_host_name, 80, NULL);
+ BuildMockSocket(data_reads, data_writes, large_host_name, 80, nullptr);
// Try to connect -- should fail (without having read/written anything to
// the transport socket first) because the hostname is too long.
diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc
index 14f68216..13838e8 100644
--- a/net/socket/socks_client_socket_unittest.cc
+++ b/net/socket/socks_client_socket_unittest.cc
@@ -386,7 +386,7 @@
MockRead data_reads[] = { MockRead(SYNCHRONOUS, "", 0) };
user_sock_ = BuildMockSocket(data_reads, data_writes, hanging_resolver.get(),
- "foo", 80, NULL);
+ "foo", 80, nullptr);
// Start connecting (will get stuck waiting for the host to resolve).
int rv = user_sock_->Connect(callback_.callback());
@@ -410,7 +410,7 @@
const char kHostName[] = "::1";
user_sock_ = BuildMockSocket(base::span<MockRead>(), base::span<MockWrite>(),
- host_resolver_.get(), kHostName, 80, NULL);
+ host_resolver_.get(), kHostName, 80, nullptr);
EXPECT_EQ(ERR_NAME_NOT_RESOLVED,
callback_.GetResult(user_sock_->Connect(callback_.callback())));
@@ -421,10 +421,10 @@
const char kHostName[] = "::1";
std::unique_ptr<HostResolver> host_resolver(
- HostResolver::CreateSystemResolver(HostResolver::Options(), NULL));
+ HostResolver::CreateSystemResolver(HostResolver::Options(), nullptr));
user_sock_ = BuildMockSocket(base::span<MockRead>(), base::span<MockWrite>(),
- host_resolver.get(), kHostName, 80, NULL);
+ host_resolver.get(), kHostName, 80, nullptr);
EXPECT_EQ(ERR_NAME_NOT_RESOLVED,
callback_.GetResult(user_sock_->Connect(callback_.callback())));
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc
index c49a65e..6389a56f 100644
--- a/net/socket/ssl_client_socket_impl.cc
+++ b/net/socket/ssl_client_socket_impl.cc
@@ -298,10 +298,11 @@
SSLContext() {
crypto::EnsureOpenSSLInit();
- ssl_socket_data_index_ = SSL_get_ex_new_index(0, 0, 0, 0, 0);
+ ssl_socket_data_index_ =
+ SSL_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
DCHECK_NE(ssl_socket_data_index_, -1);
ssl_ctx_.reset(SSL_CTX_new(TLS_with_buffers_method()));
- SSL_CTX_set_cert_cb(ssl_ctx_.get(), ClientCertRequestCallback, NULL);
+ SSL_CTX_set_cert_cb(ssl_ctx_.get(), ClientCertRequestCallback, nullptr);
// Verifies the server certificate even on resumed sessions.
SSL_CTX_set_reverify_on_resume(ssl_ctx_.get(), 1);
@@ -510,9 +511,9 @@
user_connect_callback_.Reset();
user_read_callback_.Reset();
user_write_callback_.Reset();
- user_read_buf_ = NULL;
+ user_read_buf_ = nullptr;
user_read_buf_len_ = 0;
- user_write_buf_ = NULL;
+ user_write_buf_ = nullptr;
user_write_buf_len_ = 0;
stream_socket_->Disconnect();
@@ -741,7 +742,7 @@
} else {
if (rv > 0)
was_ever_used_ = true;
- user_write_buf_ = NULL;
+ user_write_buf_ = nullptr;
user_write_buf_len_ = 0;
}
@@ -875,7 +876,7 @@
std::vector<uint8_t> wire_protos =
SerializeNextProtos(ssl_config_.alpn_protos);
SSL_set_alpn_protos(ssl_.get(),
- wire_protos.empty() ? NULL : &wire_protos[0],
+ wire_protos.empty() ? nullptr : &wire_protos[0],
wire_protos.size());
}
@@ -907,7 +908,7 @@
// up front.
if (rv > 0)
was_ever_used_ = true;
- user_write_buf_ = NULL;
+ user_write_buf_ = nullptr;
user_write_buf_len_ = 0;
std::move(user_write_callback_).Run(rv);
}
@@ -972,7 +973,7 @@
ssl_client_session_cache_->ResetLookupCount(GetSessionCacheKey());
}
- const uint8_t* alpn_proto = NULL;
+ const uint8_t* alpn_proto = nullptr;
unsigned alpn_len = 0;
SSL_get0_alpn_selected(ssl_.get(), &alpn_proto, &alpn_len);
if (alpn_len > 0) {
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index 1eb85616..b7ab581 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -594,7 +594,7 @@
base::Unretained(this)),
TRAFFIC_ANNOTATION_FOR_TESTS);
- pending_write_buf_ = NULL;
+ pending_write_buf_ = nullptr;
pending_write_len_ = -1;
if (rv != ERR_IO_PENDING) {
std::move(pending_write_callback_).Run(rv);
@@ -696,7 +696,7 @@
void OnComplete(int result) {
if (socket_) {
delete socket_;
- socket_ = NULL;
+ socket_ = nullptr;
} else {
ADD_FAILURE() << "Deleting socket twice";
}
@@ -872,7 +872,7 @@
const HostPortPair& host_port_pair,
int* result) {
std::unique_ptr<StreamSocket> transport(
- new TCPClientSocket(addr_, NULL, &log_, NetLogSource()));
+ new TCPClientSocket(addr_, nullptr, &log_, NetLogSource()));
int rv = callback_.GetResult(transport->Connect(callback_.callback()));
if (rv != OK) {
LOG(ERROR) << "Could not connect to SpawnedTestServer";
@@ -996,16 +996,16 @@
SpawnedTestServer spawned_test_server(SpawnedTestServer::TYPE_HTTPS,
ssl_options, base::FilePath());
if (!spawned_test_server.Start())
- return NULL;
+ return nullptr;
AddressList addr;
if (!spawned_test_server.GetAddressList(&addr))
- return NULL;
+ return nullptr;
TestCompletionCallback callback;
TestNetLog log;
std::unique_ptr<StreamSocket> transport(
- new TCPClientSocket(addr, NULL, &log, NetLogSource()));
+ new TCPClientSocket(addr, nullptr, &log, NetLogSource()));
int rv = callback.GetResult(transport->Connect(callback.callback()));
EXPECT_THAT(rv, IsOk());
@@ -1051,7 +1051,7 @@
CHECK(spawned_test_server());
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport)));
int rv = callback->GetResult(transport->Connect(callback->callback()));
@@ -1092,7 +1092,7 @@
ASSERT_TRUE(StartTestServer(server_options));
TestCompletionCallback callback;
- FakeBlockingStreamSocket* raw_transport = NULL;
+ FakeBlockingStreamSocket* raw_transport = nullptr;
std::unique_ptr<SSLClientSocket> sock;
ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived(
client_config, &callback, &raw_transport, &sock));
@@ -1218,7 +1218,7 @@
ssl_config.early_data_enabled = early_data_enabled;
real_transport_.reset(
- new TCPClientSocket(address_, NULL, NULL, NetLogSource()));
+ new TCPClientSocket(address_, nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport_)));
FakeBlockingStreamSocket* raw_transport = transport.get();
@@ -1354,7 +1354,7 @@
TestCompletionCallback callback;
TestNetLog log;
std::unique_ptr<StreamSocket> transport(
- new TCPClientSocket(addr(), NULL, &log, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, &log, NetLogSource()));
int rv = callback.GetResult(transport->Connect(callback.callback()));
EXPECT_THAT(rv, IsOk());
@@ -1532,7 +1532,7 @@
// TODO(davidben): Add a test which requires them and verify the error.
SSLConfig ssl_config;
ssl_config.send_client_cert = true;
- ssl_config.client_cert = NULL;
+ ssl_config.client_cert = nullptr;
int rv;
ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
@@ -1561,7 +1561,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
EXPECT_EQ(0, transport->GetTotalReceivedBytes());
int rv = callback.GetResult(transport->Connect(callback.callback()));
@@ -1618,7 +1618,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<SynchronousErrorStreamSocket> transport(
new SynchronousErrorStreamSocket(std::move(real_transport)));
int rv = callback.GetResult(transport->Connect(callback.callback()));
@@ -1649,7 +1649,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<SynchronousErrorStreamSocket> transport(
new SynchronousErrorStreamSocket(std::move(real_transport)));
int rv = callback.GetResult(transport->Connect(callback.callback()));
@@ -1701,7 +1701,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
// Note: |error_socket|'s ownership is handed to |transport|, but a pointer
// is retained in order to configure additional errors.
std::unique_ptr<SynchronousErrorStreamSocket> error_socket(
@@ -1770,7 +1770,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
// Note: intermediate sockets' ownership are handed to |sock|, but a pointer
// is retained in order to query them.
std::unique_ptr<SynchronousErrorStreamSocket> error_socket(
@@ -1874,7 +1874,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
// Note: |error_socket|'s ownership is handed to |transport|, but a pointer
// is retained in order to configure additional errors.
std::unique_ptr<SynchronousErrorStreamSocket> error_socket(
@@ -1960,7 +1960,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
// Note: |error_socket|'s ownership is handed to |transport|, but a pointer
// is retained in order to configure additional errors.
std::unique_ptr<SynchronousErrorStreamSocket> error_socket(
@@ -2051,7 +2051,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<SynchronousErrorStreamSocket> transport(
new SynchronousErrorStreamSocket(std::move(real_transport)));
int rv = callback.GetResult(transport->Connect(callback.callback()));
@@ -2077,7 +2077,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<SynchronousErrorStreamSocket> transport(
new SynchronousErrorStreamSocket(std::move(real_transport)));
int rv = callback.GetResult(transport->Connect(callback.callback()));
@@ -2110,7 +2110,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<SynchronousErrorStreamSocket> error_socket(
new SynchronousErrorStreamSocket(std::move(real_transport)));
SynchronousErrorStreamSocket* raw_error_socket = error_socket.get();
@@ -2193,7 +2193,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<ReadBufferingStreamSocket> transport(
new ReadBufferingStreamSocket(std::move(real_transport)));
ReadBufferingStreamSocket* raw_transport = transport.get();
@@ -2266,7 +2266,7 @@
TestNetLog log;
log.SetCaptureMode(NetLogCaptureMode::IncludeSocketBytes());
std::unique_ptr<StreamSocket> transport(
- new TCPClientSocket(addr(), NULL, &log, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, &log, NetLogSource()));
int rv = callback.GetResult(transport->Connect(callback.callback()));
EXPECT_THAT(rv, IsOk());
@@ -2335,7 +2335,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> transport(
- new MockTCPClientSocket(addr(), NULL, &data));
+ new MockTCPClientSocket(addr(), nullptr, &data));
int rv = callback.GetResult(transport->Connect(callback.callback()));
EXPECT_THAT(rv, IsOk());
@@ -2380,7 +2380,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
int rv = callback.GetResult(transport->Connect(callback.callback()));
EXPECT_THAT(rv, IsOk());
@@ -2556,7 +2556,7 @@
// Load and install the root for the validated chain.
scoped_refptr<X509Certificate> root_cert = ImportCertFromFile(
GetTestCertsDirectory(), "redundant-validated-chain-root.pem");
- ASSERT_NE(static_cast<X509Certificate*>(NULL), root_cert.get());
+ ASSERT_NE(static_cast<X509Certificate*>(nullptr), root_cert.get());
ScopedTestRoot scoped_root(root_cert.get());
// Set up a test server with CERT_CHAIN_WRONG_ROOT.
@@ -2942,7 +2942,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport)));
FakeBlockingStreamSocket* raw_transport = transport.get();
@@ -3001,7 +3001,7 @@
// Using a different HostPortPair uses a different session cache key.
std::unique_ptr<StreamSocket> transport(
- new TCPClientSocket(addr(), NULL, &log_, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, &log_, NetLogSource()));
TestCompletionCallback callback;
ASSERT_THAT(callback.GetResult(transport->Connect(callback.callback())),
IsOk());
@@ -3104,7 +3104,7 @@
// Failed connections pass through.
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<SynchronousErrorStreamSocket> transport(
new SynchronousErrorStreamSocket(std::move(real_transport)));
rv = callback.GetResult(transport->Connect(callback.callback()));
@@ -3228,7 +3228,7 @@
// Start a handshake up to the server Finished message.
TestCompletionCallback callback;
- FakeBlockingStreamSocket* raw_transport1 = NULL;
+ FakeBlockingStreamSocket* raw_transport1 = nullptr;
std::unique_ptr<SSLClientSocket> sock1;
ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived(
client_config, &callback, &raw_transport1, &sock1));
@@ -3282,7 +3282,7 @@
// Start a handshake up to the server Finished message.
TestCompletionCallback callback;
- FakeBlockingStreamSocket* raw_transport1 = NULL;
+ FakeBlockingStreamSocket* raw_transport1 = nullptr;
std::unique_ptr<SSLClientSocket> sock1;
ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived(
client_config, &callback, &raw_transport1, &sock1));
@@ -4109,7 +4109,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport)));
FakeBlockingStreamSocket* raw_transport = transport.get();
@@ -4142,7 +4142,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport)));
FakeBlockingStreamSocket* raw_transport = transport.get();
@@ -4190,7 +4190,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport)));
FakeBlockingStreamSocket* raw_transport = transport.get();
@@ -4239,7 +4239,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport)));
FakeBlockingStreamSocket* raw_transport = transport.get();
@@ -4289,7 +4289,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport)));
FakeBlockingStreamSocket* raw_transport = transport.get();
@@ -4335,7 +4335,7 @@
TestCompletionCallback callback;
std::unique_ptr<StreamSocket> real_transport(
- new TCPClientSocket(addr(), NULL, NULL, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, nullptr, NetLogSource()));
std::unique_ptr<FakeBlockingStreamSocket> transport(
new FakeBlockingStreamSocket(std::move(real_transport)));
FakeBlockingStreamSocket* raw_transport = transport.get();
@@ -4710,7 +4710,7 @@
TEST_P(SSLClientSocketReadTest, IdleAfterRead) {
// Set up a TCP server.
- TCPServerSocket server_listener(NULL, NetLogSource());
+ TCPServerSocket server_listener(nullptr, NetLogSource());
ASSERT_THAT(
server_listener.Listen(IPEndPoint(IPAddress::IPv4Localhost(), 0), 1),
IsOk());
@@ -4725,7 +4725,7 @@
TestCompletionCallback client_callback;
std::unique_ptr<TCPClientSocket> client_transport(new TCPClientSocket(
- AddressList(server_address), NULL, NULL, NetLogSource()));
+ AddressList(server_address), nullptr, nullptr, NetLogSource()));
int client_rv = client_transport->Connect(client_callback.callback());
EXPECT_THAT(server_callback.GetResult(server_rv), IsOk());
@@ -4790,7 +4790,7 @@
TestNetLog log;
std::unique_ptr<StreamSocket> transport(
- new TCPClientSocket(addr(), NULL, &log, NetLogSource()));
+ new TCPClientSocket(addr(), nullptr, &log, NetLogSource()));
MockTaggingStreamSocket* tagging_sock =
new MockTaggingStreamSocket(std::move(transport));
diff --git a/net/socket/ssl_server_socket_impl.cc b/net/socket/ssl_server_socket_impl.cc
index 6386a1f..bb3e4fc8 100644
--- a/net/socket/ssl_server_socket_impl.cc
+++ b/net/socket/ssl_server_socket_impl.cc
@@ -44,7 +44,8 @@
public:
static SocketDataIndex* GetInstance();
SocketDataIndex() {
- ssl_socket_data_index_ = SSL_get_ex_new_index(0, 0, 0, 0, 0);
+ ssl_socket_data_index_ =
+ SSL_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
}
// This is the index used with SSL_get_ex_data to retrieve the owner
@@ -405,7 +406,7 @@
if (rv == ERR_IO_PENDING) {
user_read_callback_ = std::move(callback);
} else {
- user_read_buf_ = NULL;
+ user_read_buf_ = nullptr;
user_read_buf_len_ = 0;
}
@@ -429,7 +430,7 @@
if (rv == ERR_IO_PENDING) {
user_write_callback_ = std::move(callback);
} else {
- user_write_buf_ = NULL;
+ user_write_buf_ = nullptr;
user_write_buf_len_ = 0;
}
return rv;
@@ -701,7 +702,7 @@
DCHECK(rv != ERR_IO_PENDING);
DCHECK(!user_read_callback_.is_null());
- user_read_buf_ = NULL;
+ user_read_buf_ = nullptr;
user_read_buf_len_ = 0;
std::move(user_read_callback_).Run(rv);
}
@@ -710,7 +711,7 @@
DCHECK(rv != ERR_IO_PENDING);
DCHECK(!user_write_callback_.is_null());
- user_write_buf_ = NULL;
+ user_write_buf_ = nullptr;
user_write_buf_len_ = 0;
std::move(user_write_callback_).Run(rv);
}
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc
index c5d55f6..967d384d 100644
--- a/net/socket/ssl_server_socket_unittest.cc
+++ b/net/socket/ssl_server_socket_unittest.cc
@@ -175,7 +175,7 @@
return;
int copied = PropagateData(read_buf_, read_buf_len_);
- read_buf_ = NULL;
+ read_buf_ = nullptr;
read_buf_len_ = 0;
std::move(read_callback_).Run(copied);
}
diff --git a/net/socket/tcp_client_socket_unittest.cc b/net/socket/tcp_client_socket_unittest.cc
index 766174f..60508c3b 100644
--- a/net/socket/tcp_client_socket_unittest.cc
+++ b/net/socket/tcp_client_socket_unittest.cc
@@ -86,7 +86,7 @@
IPAddress external_ip(72, 14, 213, 105);
TCPClientSocket socket(AddressList::CreateFromIPAddress(external_ip, 80),
- NULL, NULL, NetLogSource());
+ nullptr, nullptr, NetLogSource());
EXPECT_THAT(socket.Bind(IPEndPoint(IPAddress::IPv4Localhost(), 0)), IsOk());
@@ -101,7 +101,7 @@
// Bind a socket to the IPv4 loopback interface and try to connect to
// the IPv6 loopback interface, verify that connection fails.
TEST(TCPClientSocketTest, BindLoopbackToIPv6) {
- TCPServerSocket server(NULL, NetLogSource());
+ TCPServerSocket server(nullptr, NetLogSource());
int listen_result =
server.Listen(IPEndPoint(IPAddress::IPv6Localhost(), 0), 1);
if (listen_result != OK) {
@@ -112,7 +112,7 @@
IPEndPoint server_address;
ASSERT_THAT(server.GetLocalAddress(&server_address), IsOk());
- TCPClientSocket socket(AddressList(server_address), NULL, NULL,
+ TCPClientSocket socket(AddressList(server_address), nullptr, nullptr,
NetLogSource());
EXPECT_THAT(socket.Bind(IPEndPoint(IPAddress::IPv4Localhost(), 0)), IsOk());
@@ -213,7 +213,7 @@
TCPClientSocket socket(
AddressList::CreateFromIPAddressList(ip_list, "example.com"),
- std::move(watcher), NULL, NetLogSource());
+ std::move(watcher), nullptr, NetLogSource());
EXPECT_THAT(socket.Bind(IPEndPoint(IPAddress::IPv4Localhost(), 0)), IsOk());
diff --git a/net/socket/tcp_socket_win.cc b/net/socket/tcp_socket_win.cc
index 6b323b8..3e6ecb8 100644
--- a/net/socket/tcp_socket_win.cc
+++ b/net/socket/tcp_socket_win.cc
@@ -51,8 +51,8 @@
};
DWORD bytes_returned = 0xABAB;
int rv = WSAIoctl(socket, SIO_KEEPALIVE_VALS, &keepalive_vals,
- sizeof(keepalive_vals), NULL, 0,
- &bytes_returned, NULL, NULL);
+ sizeof(keepalive_vals), nullptr, 0, &bytes_returned,
+ nullptr, nullptr);
int os_error = WSAGetLastError();
DCHECK(!rv) << "Could not enable TCP Keep-Alive for socket: " << socket
<< " [error: " << os_error << "].";
@@ -259,8 +259,8 @@
: socket_(INVALID_SOCKET),
socket_performance_watcher_(std::move(socket_performance_watcher)),
accept_event_(WSA_INVALID_EVENT),
- accept_socket_(NULL),
- accept_address_(NULL),
+ accept_socket_(nullptr),
+ accept_address_(nullptr),
waiting_connect_(false),
waiting_read_(false),
waiting_write_(false),
@@ -566,7 +566,7 @@
AssertEventNotSignaled(core_->write_overlapped_.hEvent);
DWORD num;
int rv = WSASend(socket_, &write_buffer, 1, &num, 0,
- &core_->write_overlapped_, NULL);
+ &core_->write_overlapped_, nullptr);
int os_error = WSAGetLastError();
if (rv == 0) {
if (ResetEventIfSignaled(core_->write_overlapped_.hEvent)) {
@@ -786,7 +786,7 @@
return net_error;
}
std::unique_ptr<TCPSocketWin> tcp_socket(
- new TCPSocketWin(NULL, net_log_.net_log(), net_log_.source()));
+ new TCPSocketWin(nullptr, net_log_.net_log(), net_log_.source()));
int adopt_result = tcp_socket->AdoptConnectedSocket(new_socket, ip_end_point);
if (adopt_result != OK) {
net_log_.EndEventWithNetErrorCode(NetLogEventType::TCP_ACCEPT,
@@ -810,8 +810,8 @@
if (ev.lNetworkEvents & FD_ACCEPT) {
int result = AcceptInternal(accept_socket_, accept_address_);
if (result != ERR_IO_PENDING) {
- accept_socket_ = NULL;
- accept_address_ = NULL;
+ accept_socket_ = nullptr;
+ accept_address_ = nullptr;
std::move(accept_callback_).Run(result);
}
} else {
@@ -992,7 +992,7 @@
}
}
- core_->write_iobuffer_ = NULL;
+ core_->write_iobuffer_ = nullptr;
DCHECK_NE(rv, ERR_IO_PENDING);
std::move(write_callback_).Run(rv);
diff --git a/net/socket/transport_client_socket_pool_test_util.cc b/net/socket/transport_client_socket_pool_test_util.cc
index e3c5155ef..d540dd8 100644
--- a/net/socket/transport_client_socket_pool_test_util.cc
+++ b/net/socket/transport_client_socket_pool_test_util.cc
@@ -371,7 +371,7 @@
: net_log_(net_log),
allocation_count_(0),
client_socket_type_(MOCK_CLIENT_SOCKET),
- client_socket_types_(NULL),
+ client_socket_types_(nullptr),
client_socket_index_(0),
client_socket_index_max_(0),
delay_(base::TimeDelta::FromMilliseconds(
diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc
index 9c98a1bf..f1583a6 100644
--- a/net/socket/transport_client_socket_unittest.cc
+++ b/net/socket/transport_client_socket_unittest.cc
@@ -106,7 +106,7 @@
::testing::TestWithParam<ClientSocketTestTypes>::SetUp();
// Open a server socket on an ephemeral port.
- listen_sock_.reset(new TCPServerSocket(NULL, NetLogSource()));
+ listen_sock_.reset(new TCPServerSocket(nullptr, NetLogSource()));
IPEndPoint local_address(IPAddress::IPv4Localhost(), 0);
ASSERT_THAT(listen_sock_->Listen(local_address, 1), IsOk());
// Get the server's address (including the actual port number).
@@ -118,7 +118,7 @@
AddressList addr = AddressList::CreateFromIPAddress(
IPAddress::IPv4Localhost(), listen_port_);
- sock_ = socket_factory_->CreateTransportClientSocket(addr, NULL, &net_log_,
+ sock_ = socket_factory_->CreateTransportClientSocket(addr, nullptr, &net_log_,
NetLogSource());
}
diff --git a/net/socket/udp_socket_unittest.cc b/net/socket/udp_socket_unittest.cc
index 6a994d3..cfe06c7 100644
--- a/net/socket/udp_socket_unittest.cc
+++ b/net/socket/udp_socket_unittest.cc
@@ -542,7 +542,7 @@
TEST_F(UDPSocketTest, ServerGetLocalAddress) {
IPEndPoint bind_address(IPAddress::IPv4Localhost(), 0);
- UDPServerSocket server(NULL, NetLogSource());
+ UDPServerSocket server(nullptr, NetLogSource());
int rv = server.Listen(bind_address);
EXPECT_THAT(rv, IsOk());
@@ -557,7 +557,7 @@
TEST_F(UDPSocketTest, ServerGetPeerAddress) {
IPEndPoint bind_address(IPAddress::IPv4Localhost(), 0);
- UDPServerSocket server(NULL, NetLogSource());
+ UDPServerSocket server(nullptr, NetLogSource());
int rv = server.Listen(bind_address);
EXPECT_THAT(rv, IsOk());
@@ -612,7 +612,7 @@
// Close the socket while read is pending.
TEST_F(UDPSocketTest, CloseWithPendingRead) {
IPEndPoint bind_address(IPAddress::IPv4Localhost(), 0);
- UDPServerSocket server(NULL, NetLogSource());
+ UDPServerSocket server(nullptr, NetLogSource());
int rv = server.Listen(bind_address);
EXPECT_THAT(rv, IsOk());
@@ -1200,7 +1200,7 @@
// Setup the server to listen.
IPEndPoint server_address(IPAddress::IPv4Localhost(), 0 /* port */);
- UDPServerSocket server(NULL, NetLogSource());
+ UDPServerSocket server(nullptr, NetLogSource());
server.AllowAddressReuse();
ASSERT_THAT(server.Listen(server_address), IsOk());
// Get bound port.
@@ -1241,7 +1241,7 @@
// Setup the server to listen.
IPEndPoint server_address(IPAddress::IPv4Localhost(), 0 /* port */);
- UDPServerSocket server(NULL, NetLogSource());
+ UDPServerSocket server(nullptr, NetLogSource());
server.AllowAddressReuse();
ASSERT_THAT(server.Listen(server_address), IsOk());
// Get bound port.
diff --git a/net/socket/udp_socket_win.cc b/net/socket/udp_socket_win.cc
index f2d99ab..8bc2497 100644
--- a/net/socket/udp_socket_win.cc
+++ b/net/socket/udp_socket_win.cc
@@ -1333,7 +1333,7 @@
if (qos_handle_) {
api_->CloseHandle(qos_handle_);
- qos_handle_ = NULL;
+ qos_handle_ = nullptr;
}
handle_is_initializing_ = true;
@@ -1349,7 +1349,7 @@
version.MajorVersion = 1;
version.MinorVersion = 0;
- HANDLE handle = NULL;
+ HANDLE handle = nullptr;
// No access to net_log_ so swallow any errors here.
api->CreateHandle(&version, &handle);
diff --git a/net/socket/udp_socket_win.h b/net/socket/udp_socket_win.h
index 28adb1a0..0d6b448 100644
--- a/net/socket/udp_socket_win.h
+++ b/net/socket/udp_socket_win.h
@@ -141,7 +141,7 @@
// The remote addresses currently in the flow.
std::set<IPEndPoint> configured_;
- HANDLE qos_handle_ = NULL;
+ HANDLE qos_handle_ = nullptr;
bool handle_is_initializing_ = false;
// 0 means no flow has been constructed.
QOS_FLOWID flow_id_ = 0;
diff --git a/net/spdy/buffered_spdy_framer.cc b/net/spdy/buffered_spdy_framer.cc
index bef1ffe..ec01527 100644
--- a/net/spdy/buffered_spdy_framer.cc
+++ b/net/spdy/buffered_spdy_framer.cc
@@ -24,7 +24,7 @@
const NetLogWithSource& net_log,
TimeFunc time_func)
: spdy_framer_(spdy::SpdyFramer::ENABLE_COMPRESSION),
- visitor_(NULL),
+ visitor_(nullptr),
frames_received_(0),
max_header_list_size_(max_header_list_size),
net_log_(net_log),
@@ -138,7 +138,7 @@
<< control_frame_fields_->type;
break;
}
- control_frame_fields_.reset(NULL);
+ control_frame_fields_.reset(nullptr);
}
void BufferedSpdyFramer::OnSettings() {
diff --git a/net/spdy/spdy_buffer.cc b/net/spdy/spdy_buffer.cc
index 0342cc6..f286b28e 100644
--- a/net/spdy/spdy_buffer.cc
+++ b/net/spdy/spdy_buffer.cc
@@ -51,7 +51,7 @@
private:
~SharedFrameIOBuffer() override {
// Prevent ~IOBuffer() from trying to delete |data_|.
- data_ = NULL;
+ data_ = nullptr;
}
const scoped_refptr<SharedFrame> shared_frame_;
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index a4ef27f..8d7ea84 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -111,8 +111,8 @@
closed_stream_id_(0),
closed_stream_received_bytes_(0),
closed_stream_sent_bytes_(0),
- request_info_(NULL),
- response_info_(NULL),
+ request_info_(nullptr),
+ response_info_(nullptr),
response_headers_complete_(false),
upload_stream_in_progress_(false),
user_buffer_len_(0),
@@ -312,7 +312,7 @@
*response = *(push_response_info_.get());
push_response_info_.reset();
} else {
- DCHECK_EQ(static_cast<HttpResponseInfo*>(NULL), response_info_);
+ DCHECK_EQ(static_cast<HttpResponseInfo*>(nullptr), response_info_);
}
response_info_ = response;
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 36bb9bcb..55b1355 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -2057,14 +2057,15 @@
spdy::SpdySerializedFrame rst(
spdy_util_.ConstructSpdyRstStream(1, spdy::ERROR_CODE_CANCEL));
MockWrite writes[] = {
- CreateMockWrite(req, 0, SYNCHRONOUS), MockWrite(SYNCHRONOUS, 0, 0, 2),
+ CreateMockWrite(req, 0, SYNCHRONOUS),
+ MockWrite(SYNCHRONOUS, nullptr, 0, 2),
CreateMockWrite(rst, 3, SYNCHRONOUS),
};
spdy::SpdySerializedFrame resp(
spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
MockRead reads[] = {
- CreateMockRead(resp, 1, ASYNC), MockRead(ASYNC, 0, 0, 4) // EOF
+ CreateMockRead(resp, 1, ASYNC), MockRead(ASYNC, nullptr, 0, 4) // EOF
};
SequencedSocketData data(reads, writes);
@@ -2270,7 +2271,7 @@
spdy::SpdySerializedFrame resp(
spdy_util_.ConstructSpdyGetReply(nullptr, 0, 1));
MockRead reads[] = {
- CreateMockRead(resp, 1, ASYNC), MockRead(ASYNC, 0, 0, 3) // EOF
+ CreateMockRead(resp, 1, ASYNC), MockRead(ASYNC, nullptr, 0, 3) // EOF
};
SequencedSocketData data(reads, writes);
@@ -2317,10 +2318,10 @@
MockRead(ASYNC, reinterpret_cast<const char*>(kGetBodyFrame2),
base::size(kGetBodyFrame2), 3),
MockRead(ASYNC, ERR_IO_PENDING, 4), // Force a pause
- MockRead(ASYNC, 0, 0, 5), // EOF
+ MockRead(ASYNC, nullptr, 0, 5), // EOF
};
MockRead reads2[] = {
- CreateMockRead(resp, 1), MockRead(ASYNC, 0, 0, 2), // EOF
+ CreateMockRead(resp, 1), MockRead(ASYNC, nullptr, 0, 2), // EOF
};
SequencedSocketData data(reads, writes);
@@ -2368,8 +2369,8 @@
spdy::SpdySerializedFrame body(spdy_util_.ConstructSpdyDataFrame(1, true));
MockRead reads[] = {
CreateMockRead(resp, 1),
- MockRead(ASYNC, ERR_IO_PENDING, 2), // Force a pause
- CreateMockRead(body, 3), MockRead(ASYNC, 0, 0, 4), // EOF
+ MockRead(ASYNC, ERR_IO_PENDING, 2), // Force a pause
+ CreateMockRead(body, 3), MockRead(ASYNC, nullptr, 0, 4), // EOF
};
SequencedSocketData data(reads, writes);
@@ -2423,7 +2424,7 @@
MockRead response_headers(CreateMockRead(resp, 1));
MockRead reads[] = {
response_headers, CreateMockRead(response_body_frame, 2),
- MockRead(ASYNC, 0, 0, 3) // EOF
+ MockRead(ASYNC, nullptr, 0, 3) // EOF
};
SequencedSocketData data(reads, writes);
@@ -5125,7 +5126,7 @@
MockRead(SYNCHRONOUS, kHTTP200, base::size(kHTTP200) - 1, 1),
CreateMockRead(resp, 3),
CreateMockRead(body, 4),
- MockRead(ASYNC, 0, 0, 5),
+ MockRead(ASYNC, nullptr, 0, 5),
};
SequencedSocketData data(reads, writes);
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index a8df026..e25c7be 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -67,7 +67,7 @@
}
const HttpResponseInfo* SpdyProxyClientSocket::GetConnectResponseInfo() const {
- return response_.headers.get() ? &response_ : NULL;
+ return response_.headers.get() ? &response_ : nullptr;
}
const scoped_refptr<HttpAuthController>&
@@ -121,7 +121,7 @@
void SpdyProxyClientSocket::Disconnect() {
read_buffer_queue_.Clear();
- user_buffer_ = NULL;
+ user_buffer_ = nullptr;
user_buffer_len_ = 0;
read_callback_.Reset();
@@ -464,7 +464,7 @@
read_buffer_queue_.Enqueue(std::move(buffer));
} else {
net_log_.AddByteTransferEvent(NetLogEventType::SOCKET_BYTES_RECEIVED, 0,
- NULL);
+ nullptr);
}
if (read_callback_) {
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc
index f4103f1..7252716 100644
--- a/net/spdy/spdy_proxy_client_socket_unittest.cc
+++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -205,7 +205,7 @@
};
SpdyProxyClientSocketTest::SpdyProxyClientSocketTest()
- : read_buf_(NULL),
+ : read_buf_(nullptr),
connect_data_(SYNCHRONOUS, OK),
user_agent_(kUserAgent),
url_(kRequestUrl),
@@ -280,7 +280,7 @@
CreateStreamSynchronously(
SPDY_BIDIRECTIONAL_STREAM, spdy_session_, url_, LOWEST,
net_log_.bound()));
- ASSERT_TRUE(spdy_stream.get() != NULL);
+ ASSERT_TRUE(spdy_stream.get() != nullptr);
// Create the SpdyProxyClientSocket.
sock_ = std::make_unique<SpdyProxyClientSocket>(
@@ -313,7 +313,7 @@
void SpdyProxyClientSocketTest::AssertConnectionEstablished() {
const HttpResponseInfo* response = sock_->GetConnectResponseInfo();
- ASSERT_TRUE(response != NULL);
+ ASSERT_TRUE(response != nullptr);
ASSERT_EQ(200, response->headers->response_code());
}
@@ -528,7 +528,7 @@
AssertConnectFails(ERR_PROXY_AUTH_REQUESTED);
const HttpResponseInfo* response = sock_->GetConnectResponseInfo();
- ASSERT_TRUE(response != NULL);
+ ASSERT_TRUE(response != nullptr);
ASSERT_EQ(407, response->headers->response_code());
}
@@ -569,7 +569,7 @@
AssertConnectFails(ERR_HTTPS_PROXY_TUNNEL_RESPONSE_REDIRECT);
const HttpResponseInfo* response = sock_->GetConnectResponseInfo();
- ASSERT_TRUE(response != NULL);
+ ASSERT_TRUE(response != nullptr);
const HttpResponseHeaders* headers = response->headers.get();
ASSERT_EQ(302, headers->response_code());
@@ -1166,10 +1166,10 @@
if (use_read_if_ready()) {
ASSERT_EQ(ERR_SOCKET_NOT_CONNECTED,
- sock_->ReadIfReady(NULL, 1, CompletionOnceCallback()));
+ sock_->ReadIfReady(nullptr, 1, CompletionOnceCallback()));
} else {
ASSERT_EQ(ERR_SOCKET_NOT_CONNECTED,
- sock_->Read(NULL, 1, CompletionOnceCallback()));
+ sock_->Read(nullptr, 1, CompletionOnceCallback()));
}
// Let the RST_STREAM write while |rst| is in-scope.
@@ -1202,11 +1202,11 @@
ASSERT_EQ(kLen1, sock_->Read(buf.get(), kLen1, CompletionOnceCallback()));
ASSERT_EQ(std::string(kMsg1, kLen1), std::string(buf->data(), kLen1));
- ASSERT_EQ(0, sock_->Read(NULL, 1, CompletionOnceCallback()));
- ASSERT_EQ(0, sock_->Read(NULL, 1, CompletionOnceCallback()));
+ ASSERT_EQ(0, sock_->Read(nullptr, 1, CompletionOnceCallback()));
+ ASSERT_EQ(0, sock_->Read(nullptr, 1, CompletionOnceCallback()));
sock_->Disconnect();
ASSERT_EQ(ERR_SOCKET_NOT_CONNECTED,
- sock_->Read(NULL, 1, CompletionOnceCallback()));
+ sock_->Read(nullptr, 1, CompletionOnceCallback()));
}
// Calling Write() on a closed socket is an error
@@ -1484,7 +1484,7 @@
private:
void OnComplete(int result) {
- sock_->reset(NULL);
+ sock_->reset(nullptr);
SetResult(result);
}
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index f14d05f..294f6aef9 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -841,7 +841,7 @@
NetLog* net_log)
: in_io_loop_(false),
spdy_session_key_(spdy_session_key),
- pool_(NULL),
+ pool_(nullptr),
http_server_properties_(http_server_properties),
transport_security_state_(transport_security_state),
ssl_config_service_(ssl_config_service),
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc
index d294ff9..39d24c6 100644
--- a/net/spdy/spdy_session_pool_unittest.cc
+++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -53,7 +53,7 @@
SPDY_POOL_CLOSE_IDLE_SESSIONS,
};
- SpdySessionPoolTest() : spdy_session_pool_(NULL) {}
+ SpdySessionPoolTest() : spdy_session_pool_(nullptr) {}
void CreateNetworkSession() {
http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_);
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index f871d64..d09d808 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -100,7 +100,7 @@
recv_window_size_(max_recv_window_size),
unacked_recv_window_bytes_(0),
session_(session),
- delegate_(NULL),
+ delegate_(nullptr),
request_headers_valid_(false),
pending_send_status_(MORE_DATA_TO_SEND),
request_time_(base::Time::Now()),
@@ -167,7 +167,7 @@
std::unique_ptr<SpdyBuffer> buffer = std::move(pending_recv_data_.at(0));
pending_recv_data_.erase(pending_recv_data_.begin());
- bool eof = (buffer == NULL);
+ bool eof = (buffer == nullptr);
CHECK(delegate_);
delegate_->OnDataReceived(std::move(buffer));
@@ -204,7 +204,7 @@
void SpdyStream::DetachDelegate() {
DCHECK(!IsClosed());
- delegate_ = NULL;
+ delegate_ = nullptr;
Cancel(ERR_ABORTED);
}
@@ -533,7 +533,7 @@
if (buffer) {
pending_recv_data_.push_back(std::move(buffer));
} else {
- pending_recv_data_.push_back(NULL);
+ pending_recv_data_.push_back(nullptr);
// Note: we leave the stream open in the session until the stream
// is claimed.
}
@@ -663,7 +663,7 @@
QueueNextDataFrame();
return ERR_IO_PENDING;
} else {
- pending_send_data_ = NULL;
+ pending_send_data_ = nullptr;
return OK;
}
}
@@ -686,7 +686,7 @@
}
}
Delegate* delegate = delegate_;
- delegate_ = NULL;
+ delegate_ = nullptr;
if (delegate)
delegate->OnClose(status);
// Unset |stream_id_| last so that the delegate can look it up.
diff --git a/net/ssl/channel_id_service.cc b/net/ssl/channel_id_service.cc
index cfe70ca..cd7e891 100644
--- a/net/ssl/channel_id_service.cc
+++ b/net/ssl/channel_id_service.cc
@@ -158,8 +158,7 @@
bool create_if_missing_;
};
-ChannelIDService::Request::Request() : service_(NULL) {
-}
+ChannelIDService::Request::Request() : service_(nullptr) {}
ChannelIDService::Request::~Request() {
Cancel();
@@ -170,7 +169,7 @@
callback_.Reset();
job_->CancelRequest(this);
- service_ = NULL;
+ service_ = nullptr;
}
}
@@ -179,7 +178,7 @@
CompletionOnceCallback callback,
std::unique_ptr<crypto::ECPrivateKey>* key,
ChannelIDServiceJob* job) {
- DCHECK(service_ == NULL);
+ DCHECK(service_ == nullptr);
service_ = service;
callback_ = std::move(callback);
key_ = key;
@@ -189,7 +188,7 @@
void ChannelIDService::Request::Post(
int error,
std::unique_ptr<crypto::ECPrivateKey> key) {
- service_ = NULL;
+ service_ = nullptr;
DCHECK(!callback_.is_null());
if (key)
*key_ = std::move(key);
diff --git a/net/ssl/channel_id_service_unittest.cc b/net/ssl/channel_id_service_unittest.cc
index 97373cb..4e48cb8 100644
--- a/net/ssl/channel_id_service_unittest.cc
+++ b/net/ssl/channel_id_service_unittest.cc
@@ -44,7 +44,7 @@
: public DefaultChannelIDStore {
public:
MockChannelIDStoreWithAsyncGet()
- : DefaultChannelIDStore(NULL), channel_id_count_(0) {}
+ : DefaultChannelIDStore(nullptr), channel_id_count_(0) {}
int GetChannelID(const std::string& server_identifier,
std::unique_ptr<crypto::ECPrivateKey>* key_result,
@@ -91,7 +91,7 @@
class ChannelIDServiceTest : public TestWithScopedTaskEnvironment {
public:
ChannelIDServiceTest()
- : service_(new ChannelIDService(new DefaultChannelIDStore(NULL))) {}
+ : service_(new ChannelIDService(new DefaultChannelIDStore(nullptr))) {}
protected:
std::unique_ptr<ChannelIDService> service_;
diff --git a/net/ssl/client_cert_store_win.cc b/net/ssl/client_cert_store_win.cc
index 6e3845d..fed21b8f 100644
--- a/net/ssl/client_cert_store_win.cc
+++ b/net/ssl/client_cert_store_win.cc
@@ -93,7 +93,7 @@
}
// Verify the current time is within the certificate's validity period.
- if (CertVerifyTimeValidity(NULL, cert_context->pCertInfo) != 0)
+ if (CertVerifyTimeValidity(nullptr, cert_context->pCertInfo) != 0)
return FALSE;
// Verify private key metadata is associated with this certificate.
@@ -102,7 +102,7 @@
// CertFindChainInStore()?
DWORD size = 0;
if (!CertGetCertificateContextProperty(
- cert_context, CERT_KEY_PROV_INFO_PROP_ID, NULL, &size)) {
+ cert_context, CERT_KEY_PROV_INFO_PROP_ID, nullptr, &size)) {
return FALSE;
}
@@ -134,7 +134,7 @@
reinterpret_cast<CERT_NAME_BLOB*>(issuers.data());
find_by_issuer_para.pfnFindCallback = ClientCertFindCallback;
- PCCERT_CHAIN_CONTEXT chain_context = NULL;
+ PCCERT_CHAIN_CONTEXT chain_context = nullptr;
DWORD find_flags = CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_FLAG |
CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG;
for (;;) {
@@ -155,10 +155,9 @@
PCCERT_CONTEXT cert_context =
chain_context->rgpChain[0]->rgpElement[0]->pCertContext;
// Copy the certificate, so that it is valid after |cert_store| is closed.
- PCCERT_CONTEXT cert_context2 = NULL;
- BOOL ok = CertAddCertificateContextToStore(NULL, cert_context,
- CERT_STORE_ADD_USE_EXISTING,
- &cert_context2);
+ PCCERT_CONTEXT cert_context2 = nullptr;
+ BOOL ok = CertAddCertificateContextToStore(
+ nullptr, cert_context, CERT_STORE_ADD_USE_EXISTING, &cert_context2);
if (!ok) {
NOTREACHED();
continue;
@@ -169,8 +168,8 @@
for (DWORD i = 1; i < chain_context->rgpChain[0]->cElement; ++i) {
PCCERT_CONTEXT chain_intermediate =
chain_context->rgpChain[0]->rgpElement[i]->pCertContext;
- PCCERT_CONTEXT copied_intermediate = NULL;
- ok = CertAddCertificateContextToStore(NULL, chain_intermediate,
+ PCCERT_CONTEXT copied_intermediate = nullptr;
+ ok = CertAddCertificateContextToStore(nullptr, chain_intermediate,
CERT_STORE_ADD_USE_EXISTING,
&copied_intermediate);
if (ok)
@@ -270,15 +269,15 @@
const CertificateList& input_certs,
const SSLCertRequestInfo& request,
ClientCertIdentityList* selected_identities) {
- ScopedHCERTSTORE test_store(CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, 0,
- NULL));
+ ScopedHCERTSTORE test_store(
+ CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, 0, nullptr));
if (!test_store)
return false;
// Add available certificates to the test store.
for (const auto& input_cert : input_certs) {
// Add the certificate to the test store.
- PCCERT_CONTEXT cert = NULL;
+ PCCERT_CONTEXT cert = nullptr;
if (!CertAddEncodedCertificateToStore(
test_store, X509_ASN_ENCODING,
reinterpret_cast<const BYTE*>(
diff --git a/net/ssl/default_channel_id_store_unittest.cc b/net/ssl/default_channel_id_store_unittest.cc
index 0ec71ced..1fbe5e8 100644
--- a/net/ssl/default_channel_id_store_unittest.cc
+++ b/net/ssl/default_channel_id_store_unittest.cc
@@ -163,7 +163,7 @@
//TODO(mattm): add more tests of without a persistent store?
TEST_F(DefaultChannelIDStoreTest, TestSettingAndGetting) {
// No persistent store, all calls will be synchronous.
- DefaultChannelIDStore store(NULL);
+ DefaultChannelIDStore store(nullptr);
std::unique_ptr<crypto::ECPrivateKey> expected_key(
crypto::ECPrivateKey::Create());
diff --git a/net/ssl/openssl_ssl_util.cc b/net/ssl/openssl_ssl_util.cc
index 0e4e0ac..16b5f1d 100644
--- a/net/ssl/openssl_ssl_util.cc
+++ b/net/ssl/openssl_ssl_util.cc
@@ -138,7 +138,7 @@
dict->SetInteger("error_lib", ERR_GET_LIB(error_info.error_code));
dict->SetInteger("error_reason", ERR_GET_REASON(error_info.error_code));
}
- if (error_info.file != NULL)
+ if (error_info.file != nullptr)
dict->SetString("file", error_info.file);
if (error_info.line != 0)
dict->SetInteger("line", error_info.line);
diff --git a/net/ssl/openssl_ssl_util.h b/net/ssl/openssl_ssl_util.h
index a511a82..e205d56 100644
--- a/net/ssl/openssl_ssl_util.h
+++ b/net/ssl/openssl_ssl_util.h
@@ -48,7 +48,7 @@
// Helper struct to store information about an OpenSSL error stack entry.
struct OpenSSLErrorInfo {
- OpenSSLErrorInfo() : error_code(0), file(NULL), line(0) {}
+ OpenSSLErrorInfo() : error_code(0), file(nullptr), line(0) {}
uint32_t error_code;
const char* file;
diff --git a/net/ssl/ssl_info.h b/net/ssl/ssl_info.h
index d9d0a3e..d126ef1 100644
--- a/net/ssl/ssl_info.h
+++ b/net/ssl/ssl_info.h
@@ -43,7 +43,7 @@
void Reset();
- bool is_valid() const { return cert.get() != NULL; }
+ bool is_valid() const { return cert.get() != nullptr; }
// Adds the specified |error| to the cert status.
void SetCertError(int error);
diff --git a/net/ssl/ssl_platform_key_win.cc b/net/ssl/ssl_platform_key_win.cc
index f028084225..04a6b11 100644
--- a/net/ssl/ssl_platform_key_win.cc
+++ b/net/ssl/ssl_platform_key_win.cc
@@ -249,8 +249,8 @@
return ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED;
}
- BCRYPT_PKCS1_PADDING_INFO pkcs1_padding_info = {0};
- BCRYPT_PSS_PADDING_INFO pss_padding_info = {0};
+ BCRYPT_PKCS1_PADDING_INFO pkcs1_padding_info = {nullptr};
+ BCRYPT_PSS_PADDING_INFO pss_padding_info = {nullptr};
void* padding_info = nullptr;
DWORD flags = 0;
if (SSL_get_signature_algorithm_key_type(algorithm) == EVP_PKEY_RSA) {
diff --git a/net/ssl/test_ssl_private_key.cc b/net/ssl/test_ssl_private_key.cc
index a0d2aa9..aad199d 100644
--- a/net/ssl/test_ssl_private_key.cc
+++ b/net/ssl/test_ssl_private_key.cc
@@ -55,7 +55,8 @@
}
}
size_t sig_len = 0;
- if (!EVP_DigestSign(ctx.get(), NULL, &sig_len, input.data(), input.size()))
+ if (!EVP_DigestSign(ctx.get(), nullptr, &sig_len, input.data(),
+ input.size()))
return ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED;
signature->resize(sig_len);
if (!EVP_DigestSign(ctx.get(), signature->data(), &sig_len, input.data(),
diff --git a/net/test/cert_test_util.cc b/net/test/cert_test_util.cc
index 0e96958..415d685 100644
--- a/net/test/cert_test_util.cc
+++ b/net/test/cert_test_util.cc
@@ -51,7 +51,7 @@
CertificateList certs = CreateCertificateListFromFile(
certs_dir, cert_file, format);
if (certs.empty())
- return NULL;
+ return nullptr;
std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> intermediates;
for (size_t i = 1; i < certs.size(); ++i)
@@ -69,13 +69,13 @@
base::FilePath cert_path = certs_dir.AppendASCII(cert_file);
std::string cert_data;
if (!base::ReadFileToString(cert_path, &cert_data))
- return NULL;
+ return nullptr;
CertificateList certs_in_file =
X509Certificate::CreateCertificateListFromBytes(
cert_data.data(), cert_data.size(), X509Certificate::FORMAT_AUTO);
if (certs_in_file.empty())
- return NULL;
+ return nullptr;
return certs_in_file[0];
}
diff --git a/net/test/ct_test_util.cc b/net/test/ct_test_util.cc
index 9013684..28f6ca3a 100644
--- a/net/test/ct_test_util.cc
+++ b/net/test/ct_test_util.cc
@@ -216,7 +216,7 @@
}
void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) {
- CHECK(sct_ref != NULL);
+ CHECK(sct_ref != nullptr);
*sct_ref = new SignedCertificateTimestamp();
SignedCertificateTimestamp *const sct(sct_ref->get());
sct->version = ct::SignedCertificateTimestamp::V1;
@@ -233,7 +233,7 @@
}
void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) {
- CHECK(sct_ref != NULL);
+ CHECK(sct_ref != nullptr);
*sct_ref = new SignedCertificateTimestamp();
SignedCertificateTimestamp *const sct(sct_ref->get());
sct->version = ct::SignedCertificateTimestamp::V1;
diff --git a/net/test/embedded_test_server/embedded_test_server.h b/net/test/embedded_test_server/embedded_test_server.h
index c467cea0..e758c06 100644
--- a/net/test/embedded_test_server/embedded_test_server.h
+++ b/net/test/embedded_test_server/embedded_test_server.h
@@ -161,9 +161,7 @@
bool ShutdownAndWaitUntilComplete() WARN_UNUSED_RESULT;
// Checks if the server has started listening for incoming connections.
- bool Started() const {
- return listen_socket_.get() != NULL;
- }
+ bool Started() const { return listen_socket_.get() != nullptr; }
static base::FilePath GetRootCertPemPath();
diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc
index 318fd6e4..85155ca1 100644
--- a/net/test/embedded_test_server/embedded_test_server_unittest.cc
+++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc
@@ -318,7 +318,7 @@
std::unique_ptr<StreamSocket> socket =
ClientSocketFactory::GetDefaultFactory()->CreateTransportClientSocket(
- address_list, NULL, &net_log, NetLogSource());
+ address_list, nullptr, &net_log, NetLogSource());
TestCompletionCallback callback;
ASSERT_THAT(callback.GetResult(socket->Connect(callback.callback())), IsOk());
diff --git a/net/test/net_test_suite.cc b/net/test/net_test_suite.cc
index ff4a288..6ef5f7c8 100644
--- a/net/test/net_test_suite.cc
+++ b/net/test/net_test_suite.cc
@@ -41,7 +41,7 @@
}
void NetTestSuite::InitializeTestThreadNoNetworkChangeNotifier() {
- host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL);
+ host_resolver_proc_ = new net::RuleBasedHostResolverProc(nullptr);
scoped_host_resolver_proc_.Init(host_resolver_proc_.get());
// In case any attempts are made to resolve host names, force them all to
// be mapped to localhost. This prevents DNS queries from being sent in
diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc
index 48ad354..1236b8b 100644
--- a/net/test/spawned_test_server/base_test_server.cc
+++ b/net/test/spawned_test_server/base_test_server.cc
@@ -354,7 +354,7 @@
DCHECK(address_list);
std::unique_ptr<HostResolver> resolver(
- HostResolver::CreateDefaultResolver(NULL));
+ HostResolver::CreateDefaultResolver(nullptr));
// Limit the lookup to IPv4 (DnsQueryType::A). When started with the default
// address of kLocalhost, testserver.py only supports IPv4.
diff --git a/net/test/spawned_test_server/local_test_server.cc b/net/test/spawned_test_server/local_test_server.cc
index 84a03055..c430773 100644
--- a/net/test/spawned_test_server/local_test_server.cc
+++ b/net/test/spawned_test_server/local_test_server.cc
@@ -205,7 +205,7 @@
// Add arguments from a list.
if (value.is_list()) {
- const base::ListValue* list = NULL;
+ const base::ListValue* list = nullptr;
if (!value.GetAsList(&list) || !list || list->empty())
return false;
for (auto list_it = list->begin(); list_it != list->end(); ++list_it) {
diff --git a/net/test/spawned_test_server/local_test_server_win.cc b/net/test/spawned_test_server/local_test_server_win.cc
index 06a9401..e6fcbf7 100644
--- a/net/test/spawned_test_server/local_test_server_win.cc
+++ b/net/test/spawned_test_server/local_test_server_win.cc
@@ -34,8 +34,7 @@
DWORD bytes_written = 0;
LOG(WARNING) << "Timeout reached; unblocking pipe by writing "
<< size << " bytes";
- CHECK(WriteFile(handle, unblock_data.data(), size, &bytes_written,
- NULL));
+ CHECK(WriteFile(handle, unblock_data.data(), size, &bytes_written, nullptr));
CHECK_EQ(size, bytes_written);
*unblocked = true;
}
@@ -61,7 +60,7 @@
while (bytes_read < bytes_max) {
DWORD num_bytes;
if (!ReadFile(read_fd, buffer + bytes_read, bytes_max - bytes_read,
- &num_bytes, NULL)) {
+ &num_bytes, nullptr)) {
PLOG(ERROR) << "ReadFile failed";
return false;
}
@@ -97,9 +96,9 @@
if (!AddCommandLineArguments(&python_command))
return false;
- HANDLE child_read = NULL;
- HANDLE child_write = NULL;
- if (!CreatePipe(&child_read, &child_write, NULL, 0)) {
+ HANDLE child_read = nullptr;
+ HANDLE child_write = nullptr;
+ if (!CreatePipe(&child_read, &child_write, nullptr, 0)) {
PLOG(ERROR) << "Failed to create pipe";
return false;
}
diff --git a/net/test/url_request/url_request_slow_download_job.cc b/net/test/url_request/url_request_slow_download_job.cc
index efce74d7..3b54373 100644
--- a/net/test/url_request/url_request_slow_download_job.cc
+++ b/net/test/url_request/url_request_slow_download_job.cc
@@ -216,12 +216,12 @@
void URLRequestSlowDownloadJob::CheckDoneStatus() {
if (should_finish_download_) {
VLOG(10) << __FUNCTION__ << " called w/ should_finish_download_ set.";
- DCHECK(NULL != buffer_.get());
+ DCHECK(nullptr != buffer_.get());
int bytes_written = 0;
ReadStatus status =
FillBufferHelper(buffer_.get(), buffer_size_, &bytes_written);
DCHECK_EQ(BUFFER_FILLED, status);
- buffer_ = NULL; // Release the reference.
+ buffer_ = nullptr; // Release the reference.
ReadRawDataComplete(bytes_written);
} else if (should_error_download_) {
VLOG(10) << __FUNCTION__ << " called w/ should_finish_ownload_ set.";
diff --git a/net/third_party/uri_template/uri_template.h b/net/third_party/uri_template/uri_template.h
index 00d7b9a..c091252a 100644
--- a/net/third_party/uri_template/uri_template.h
+++ b/net/third_party/uri_template/uri_template.h
@@ -49,7 +49,7 @@
const string& template_uri,
const std::unordered_map<string, string>& parameters,
string* target,
- std::set<string>* vars_found = NULL);
+ std::set<string>* vars_found = nullptr);
} // namespace uri_template
diff --git a/net/third_party/uri_template/uri_template_test.cc b/net/third_party/uri_template/uri_template_test.cc
index b2e6909e..3dfc772 100644
--- a/net/third_party/uri_template/uri_template_test.cc
+++ b/net/third_party/uri_template/uri_template_test.cc
@@ -43,7 +43,7 @@
void CheckExpansion(const string& uri_template,
const string& expected_expansion,
bool expected_validity = true,
- const std::set<string>* expected_vars = NULL) {
+ const std::set<string>* expected_vars = nullptr) {
string result;
std::set<string> vars_found;
EXPECT_EQ(expected_validity,
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc
index dad16a25..aea9609 100644
--- a/net/tools/crash_cache/crash_cache.cc
+++ b/net/tools/crash_cache/crash_cache.cc
@@ -272,7 +272,7 @@
// Work with a tiny index table (16 entries).
disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(
- path, 0xf, cache_thread->task_runner().get(), NULL);
+ path, 0xf, cache_thread->task_runner().get(), nullptr);
if (!cache->SetMaxSize(0x100000))
return GENERIC;
diff --git a/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc b/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc
index 395ab97..cd3f9a3 100644
--- a/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc
+++ b/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc
@@ -36,7 +36,7 @@
void CrashNullPointerDereference(void) {
// Cause the program to segfault with a NULL pointer dereference
- int *p = NULL;
+ int* p = nullptr;
*p = 0;
}
diff --git a/net/tools/dump_cache/dump_files.cc b/net/tools/dump_cache/dump_files.cc
index 0a8ec28..6ff0c87c 100644
--- a/net/tools/dump_cache/dump_files.cc
+++ b/net/tools/dump_cache/dump_files.cc
@@ -161,10 +161,9 @@
explicit CacheDumper(const base::FilePath& path)
: path_(path),
block_files_(path),
- index_(NULL),
+ index_(nullptr),
current_hash_(0),
- next_addr_(0) {
- }
+ next_addr_(0) {}
bool Init();
diff --git a/net/tools/stress_cache/stress_cache.cc b/net/tools/stress_cache/stress_cache.cc
index 2483cebe..e7ead12 100644
--- a/net/tools/stress_cache/stress_cache.cc
+++ b/net/tools/stress_cache/stress_cache.cc
@@ -312,7 +312,7 @@
g_data = new Data();
g_data->iteration = iteration;
g_data->cache = new disk_cache::BackendImpl(
- path, mask, cache_thread.task_runner().get(), NULL);
+ path, mask, cache_thread.task_runner().get(), nullptr);
g_data->cache->SetMaxSize(cache_size);
g_data->cache->SetFlags(disk_cache::kNoLoadProtection);
diff --git a/net/url_request/test_url_fetcher_factory.cc b/net/url_request/test_url_fetcher_factory.cc
index 39e1f73..d72be290 100644
--- a/net/url_request/test_url_fetcher_factory.cc
+++ b/net/url_request/test_url_fetcher_factory.cc
@@ -38,15 +38,15 @@
ScopedURLFetcherFactory::~ScopedURLFetcherFactory() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(URLFetcherImpl::factory());
- URLFetcherImpl::set_factory(NULL);
+ URLFetcherImpl::set_factory(nullptr);
}
TestURLFetcher::TestURLFetcher(int id, const GURL& url, URLFetcherDelegate* d)
- : owner_(NULL),
+ : owner_(nullptr),
id_(id),
original_url_(url),
delegate_(d),
- delegate_for_tests_(NULL),
+ delegate_for_tests_(nullptr),
did_receive_last_chunk_(false),
fake_load_flags_(0),
fake_response_code_(-1),
@@ -328,9 +328,8 @@
TestURLFetcherFactory::TestURLFetcherFactory()
: ScopedURLFetcherFactory(this),
- delegate_for_tests_(NULL),
- remove_fetcher_on_delete_(false) {
-}
+ delegate_for_tests_(nullptr),
+ remove_fetcher_on_delete_(false) {}
TestURLFetcherFactory::~TestURLFetcherFactory() = default;
@@ -452,10 +451,10 @@
NetworkTrafficAnnotationTag traffic_annotation) {
FakeResponseMap::const_iterator it = fake_responses_.find(url);
if (it == fake_responses_.end()) {
- if (default_factory_ == NULL) {
+ if (default_factory_ == nullptr) {
// If we don't have a baked response for that URL we return NULL.
DLOG(ERROR) << "No baked response for URL: " << url.spec();
- return NULL;
+ return nullptr;
} else {
return default_factory_->CreateURLFetcher(id, url, request_type, d,
traffic_annotation);
diff --git a/net/url_request/test_url_request_interceptor.cc b/net/url_request/test_url_request_interceptor.cc
index 6644369..333e5ba 100644
--- a/net/url_request/test_url_request_interceptor.cc
+++ b/net/url_request/test_url_request_interceptor.cc
@@ -102,7 +102,7 @@
DCHECK(network_task_runner_->RunsTasksInCurrentSequence());
if (request->url().scheme() != scheme_ ||
request->url().host() != hostname_) {
- return NULL;
+ return nullptr;
}
auto it = responses_.find(request->url());
@@ -116,7 +116,7 @@
}
it = ignore_query_responses_.find(url);
if (it == ignore_query_responses_.end())
- return NULL;
+ return nullptr;
}
{
base::AutoLock auto_lock(hit_count_lock_);
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index 98b1c32..b3d0a24 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -81,7 +81,7 @@
load_flags_(LOAD_NORMAL),
allow_credentials_(base::nullopt),
response_code_(URLFetcher::RESPONSE_CODE_INVALID),
- url_request_data_key_(NULL),
+ url_request_data_key_(nullptr),
was_fetched_via_proxy_(false),
was_cached_(false),
received_response_content_length_(0),
@@ -126,8 +126,8 @@
if (delegate_task_runner_) // May be NULL in tests.
DCHECK(delegate_task_runner_->RunsTasksInCurrentSequence());
- delegate_ = NULL;
- fetcher_ = NULL;
+ delegate_ = nullptr;
+ fetcher_ = nullptr;
if (!network_task_runner_.get())
return;
if (network_task_runner_->RunsTasksInCurrentSequence()) {
@@ -368,7 +368,7 @@
bool URLFetcherCore::GetResponseAsString(
std::string* out_response_string) const {
URLFetcherStringWriter* string_writer =
- response_writer_ ? response_writer_->AsStringWriter() : NULL;
+ response_writer_ ? response_writer_->AsStringWriter() : nullptr;
if (!string_writer)
return false;
@@ -381,7 +381,7 @@
DCHECK(delegate_task_runner_->RunsTasksInCurrentSequence());
URLFetcherFileWriter* file_writer =
- response_writer_ ? response_writer_->AsFileWriter() : NULL;
+ response_writer_ ? response_writer_->AsFileWriter() : nullptr;
if (!file_writer)
return false;
@@ -714,9 +714,9 @@
// references to URLFetcher::Core at this point so it may take a while to
// delete the object, but we cannot delay the destruction of the request
// context.
- request_context_getter_ = NULL;
+ request_context_getter_ = nullptr;
initiator_.reset();
- url_request_data_key_ = NULL;
+ url_request_data_key_ = nullptr;
url_request_create_data_callback_.Reset();
was_cancelled_ = true;
}
@@ -805,9 +805,9 @@
return;
}
- request_context_getter_ = NULL;
+ request_context_getter_ = nullptr;
initiator_.reset();
- url_request_data_key_ = NULL;
+ url_request_data_key_ = nullptr;
url_request_create_data_callback_.Reset();
bool posted = delegate_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&URLFetcherCore::OnCompletedURLRequest, this,
diff --git a/net/url_request/url_fetcher_impl.cc b/net/url_request/url_fetcher_impl.cc
index fa72292..6bf491f 100644
--- a/net/url_request/url_fetcher_impl.cc
+++ b/net/url_request/url_fetcher_impl.cc
@@ -15,7 +15,7 @@
namespace net {
-static URLFetcherFactory* g_factory = NULL;
+static URLFetcherFactory* g_factory = nullptr;
URLFetcherImpl::URLFetcherImpl(
const GURL& url,
diff --git a/net/url_request/url_fetcher_response_writer.cc b/net/url_request/url_fetcher_response_writer.cc
index ca0e9f9..02960db 100644
--- a/net/url_request/url_fetcher_response_writer.cc
+++ b/net/url_request/url_fetcher_response_writer.cc
@@ -19,11 +19,11 @@
namespace net {
URLFetcherStringWriter* URLFetcherResponseWriter::AsStringWriter() {
- return NULL;
+ return nullptr;
}
URLFetcherFileWriter* URLFetcherResponseWriter::AsFileWriter() {
- return NULL;
+ return nullptr;
}
URLFetcherStringWriter::URLFetcherStringWriter() = default;
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 66a54b3..9507dc7 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -211,7 +211,7 @@
}
bool URLRequest::has_upload() const {
- return upload_data_stream_.get() != NULL;
+ return upload_data_stream_.get() != nullptr;
}
void URLRequest::SetExtraRequestHeaderByName(const string& name,
@@ -1186,7 +1186,7 @@
is_redirecting_ = false;
has_notified_completion_ = true;
if (network_delegate_)
- network_delegate_->NotifyCompleted(this, job_.get() != NULL,
+ network_delegate_->NotifyCompleted(this, job_.get() != nullptr,
status_.error());
}
diff --git a/net/url_request/url_request_data_job.cc b/net/url_request/url_request_data_job.cc
index fabf6983..559027c 100644
--- a/net/url_request/url_request_data_job.cc
+++ b/net/url_request/url_request_data_job.cc
@@ -59,7 +59,7 @@
// TODO(tyoshino): Get the headers and export via
// URLRequestJob::GetResponseInfo().
- return BuildResponse(url, mime_type, charset, data, NULL);
+ return BuildResponse(url, mime_type, charset, data, nullptr);
}
URLRequestDataJob::~URLRequestDataJob() = default;
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 3a610bfe..bdb7a27 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -134,7 +134,7 @@
base::FilePath new_path = file_path_;
bool resolved;
- resolved = base::win::ResolveShortcut(new_path, &new_path, NULL);
+ resolved = base::win::ResolveShortcut(new_path, &new_path, nullptr);
// If shortcut is not resolved successfully, do not redirect.
if (!resolved)
@@ -322,7 +322,7 @@
}
OnReadComplete(buf.get(), result);
- buf = NULL;
+ buf = nullptr;
ReadRawDataComplete(result);
}
diff --git a/net/url_request/url_request_file_job_unittest.cc b/net/url_request/url_request_file_job_unittest.cc
index 94d14d8..21fa911c 100644
--- a/net/url_request/url_request_file_job_unittest.cc
+++ b/net/url_request/url_request_file_job_unittest.cc
@@ -324,15 +324,15 @@
}
TEST_F(URLRequestFileJobEventsTest, TinyFile) {
- RunSuccessfulRequestWithString(std::string("hello world"), NULL);
+ RunSuccessfulRequestWithString(std::string("hello world"), nullptr);
}
TEST_F(URLRequestFileJobEventsTest, SmallFile) {
- RunSuccessfulRequestWithString(MakeContentOfSize(17 * 1024), NULL);
+ RunSuccessfulRequestWithString(MakeContentOfSize(17 * 1024), nullptr);
}
TEST_F(URLRequestFileJobEventsTest, BigFile) {
- RunSuccessfulRequestWithString(MakeContentOfSize(3 * 1024 * 1024), NULL);
+ RunSuccessfulRequestWithString(MakeContentOfSize(3 * 1024 * 1024), nullptr);
}
TEST_F(URLRequestFileJobEventsTest, Range) {
diff --git a/net/url_request/url_request_filter.cc b/net/url_request/url_request_filter.cc
index f2cf018e..5a8a7209 100644
--- a/net/url_request/url_request_filter.cc
+++ b/net/url_request/url_request_filter.cc
@@ -36,7 +36,7 @@
} // namespace
-URLRequestFilter* URLRequestFilter::shared_instance_ = NULL;
+URLRequestFilter* URLRequestFilter::shared_instance_ = nullptr;
// static
URLRequestFilter* URLRequestFilter::GetInstance() {
@@ -114,9 +114,9 @@
URLRequest* request,
NetworkDelegate* network_delegate) const {
DCHECK(base::MessageLoopCurrentForIO::Get());
- URLRequestJob* job = NULL;
+ URLRequestJob* job = nullptr;
if (!request->url().is_valid())
- return NULL;
+ return nullptr;
// Check the hostname map first.
const std::string hostname = request->url().host();
@@ -149,7 +149,7 @@
URLRequestFilter::~URLRequestFilter() {
DCHECK(OnMessageLoopForInterceptorRemoval());
- URLRequestJobFactoryImpl::SetInterceptorForTesting(NULL);
+ URLRequestJobFactoryImpl::SetInterceptorForTesting(nullptr);
}
} // namespace net
diff --git a/net/url_request/url_request_filter_unittest.cc b/net/url_request/url_request_filter_unittest.cc
index a34c501..6a88e83 100644
--- a/net/url_request/url_request_filter_unittest.cc
+++ b/net/url_request/url_request_filter_unittest.cc
@@ -73,18 +73,20 @@
kUrl1, std::unique_ptr<URLRequestInterceptor>(interceptor)));
{
std::unique_ptr<URLRequestJob> found(
- filter->MaybeInterceptRequest(request1.get(), NULL));
+ filter->MaybeInterceptRequest(request1.get(), nullptr));
EXPECT_TRUE(interceptor->WasLastJobCreated(found.get()));
}
EXPECT_EQ(filter->hit_count(), 1);
// Check we don't match other URLs.
- EXPECT_TRUE(filter->MaybeInterceptRequest(request2.get(), NULL) == NULL);
+ EXPECT_TRUE(filter->MaybeInterceptRequest(request2.get(), nullptr) ==
+ nullptr);
EXPECT_EQ(1, filter->hit_count());
// Check we can remove URL matching.
filter->RemoveUrlHandler(kUrl1);
- EXPECT_TRUE(filter->MaybeInterceptRequest(request1.get(), NULL) == NULL);
+ EXPECT_TRUE(filter->MaybeInterceptRequest(request1.get(), nullptr) ==
+ nullptr);
EXPECT_EQ(1, filter->hit_count());
// Check hostname matching.
@@ -96,18 +98,20 @@
std::unique_ptr<URLRequestInterceptor>(interceptor));
{
std::unique_ptr<URLRequestJob> found(
- filter->MaybeInterceptRequest(request1.get(), NULL));
+ filter->MaybeInterceptRequest(request1.get(), nullptr));
EXPECT_TRUE(interceptor->WasLastJobCreated(found.get()));
}
EXPECT_EQ(1, filter->hit_count());
// Check we don't match other hostnames.
- EXPECT_TRUE(filter->MaybeInterceptRequest(request2.get(), NULL) == NULL);
+ EXPECT_TRUE(filter->MaybeInterceptRequest(request2.get(), nullptr) ==
+ nullptr);
EXPECT_EQ(1, filter->hit_count());
// Check we can remove hostname matching.
filter->RemoveHostnameHandler(kUrl1.scheme(), kUrl1.host());
- EXPECT_TRUE(filter->MaybeInterceptRequest(request1.get(), NULL) == NULL);
+ EXPECT_TRUE(filter->MaybeInterceptRequest(request1.get(), nullptr) ==
+ nullptr);
EXPECT_EQ(1, filter->hit_count());
filter->ClearHandlers();
diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc
index ebfc053..3f5633142 100644
--- a/net/url_request/url_request_ftp_job.cc
+++ b/net/url_request/url_request_ftp_job.cc
@@ -47,7 +47,7 @@
priority_(DEFAULT_PRIORITY),
proxy_resolution_service_(
request_->context()->proxy_resolution_service()),
- http_response_info_(NULL),
+ http_response_info_(nullptr),
read_in_progress_(false),
ftp_transaction_factory_(ftp_transaction_factory),
ftp_auth_cache_(ftp_auth_cache),
@@ -146,7 +146,7 @@
}
void URLRequestFtpJob::OnResolveProxyComplete(int result) {
- proxy_resolve_request_ = NULL;
+ proxy_resolve_request_ = nullptr;
if (result != OK) {
OnStartCompletedAsync(result);
@@ -383,7 +383,7 @@
}
auth_data_->state = AUTH_STATE_NEED_AUTH;
- FtpAuthCache::Entry* cached_auth = NULL;
+ FtpAuthCache::Entry* cached_auth = nullptr;
if (ftp_transaction_ && ftp_transaction_->GetResponseInfo()->needs_auth)
cached_auth = ftp_auth_cache_->Lookup(origin);
if (cached_auth) {
diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc
index 22f1c45..26239d0 100644
--- a/net/url_request/url_request_ftp_job_unittest.cc
+++ b/net/url_request/url_request_ftp_job_unittest.cc
@@ -126,7 +126,7 @@
void RemoveObserver(Observer* observer) override {
if (observer_ == observer) {
- observer_ = NULL;
+ observer_ = nullptr;
}
}
@@ -148,7 +148,7 @@
TestURLRequestFtpJob(URLRequest* request,
FtpTransactionFactory* ftp_factory,
FtpAuthCache* ftp_auth_cache)
- : URLRequestFtpJob(request, NULL, ftp_factory, ftp_auth_cache) {}
+ : URLRequestFtpJob(request, nullptr, ftp_factory, ftp_auth_cache) {}
~TestURLRequestFtpJob() override = default;
using URLRequestFtpJob::SetPriority;
@@ -165,8 +165,8 @@
protected:
URLRequestFtpJobPriorityTest()
: proxy_resolution_service_(std::make_unique<SimpleProxyConfigService>(),
- NULL,
- NULL),
+ nullptr,
+ nullptr),
req_(context_.CreateRequest(GURL("ftp://ftp.example.com"),
DEFAULT_PRIORITY,
&delegate_,
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 5d55790..b0fac02 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -1239,7 +1239,7 @@
}
// These will be reset in OnStartCompleted.
- response_info_ = NULL;
+ response_info_ = nullptr;
receive_headers_end_ = base::TimeTicks::Now();
// TODO(davidben,mmenke): We should either reset override_response_headers_
// here or not call NotifyHeadersReceived a second time on the same response
@@ -1387,7 +1387,7 @@
void URLRequestHttpJob::DoneReadingRedirectResponse() {
if (transaction_) {
- if (transaction_->GetResponseInfo()->headers->IsRedirect(NULL)) {
+ if (transaction_->GetResponseInfo()->headers->IsRedirect(nullptr)) {
// If the original headers indicate a redirect, go ahead and cache the
// response, even if the |override_response_headers_| are a redirect to
// another location.
@@ -1396,7 +1396,7 @@
// Otherwise, |override_response_headers_| must be non-NULL and contain
// bogus headers indicating a redirect.
DCHECK(override_response_headers_.get());
- DCHECK(override_response_headers_->IsRedirect(NULL));
+ DCHECK(override_response_headers_->IsRedirect(nullptr));
transaction_->StopCaching();
}
}
diff --git a/net/url_request/url_request_job_factory_impl.cc b/net/url_request/url_request_job_factory_impl.cc
index c8f540a..c98a0b24 100644
--- a/net/url_request/url_request_job_factory_impl.cc
+++ b/net/url_request/url_request_job_factory_impl.cc
@@ -14,7 +14,7 @@
namespace {
-URLRequestInterceptor* g_interceptor_for_testing = NULL;
+URLRequestInterceptor* g_interceptor_for_testing = nullptr;
} // namespace
@@ -56,7 +56,7 @@
auto it = protocol_handler_map_.find(scheme);
if (it == protocol_handler_map_.end())
- return NULL;
+ return nullptr;
return it->second->MaybeCreateJob(request, network_delegate);
}
diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc
index 7fe0edf2..da609d2 100644
--- a/net/url_request/url_request_job_manager.cc
+++ b/net/url_request/url_request_job_manager.cc
@@ -99,15 +99,15 @@
DCHECK(IsAllowedThread());
if (!request->url().is_valid() ||
request->status().status() == URLRequestStatus::CANCELED) {
- return NULL;
+ return nullptr;
}
- const URLRequestJobFactory* job_factory = NULL;
+ const URLRequestJobFactory* job_factory = nullptr;
job_factory = request->context()->job_factory();
const std::string& scheme = request->url().scheme(); // already lowercase
if (!job_factory->IsHandledProtocol(scheme))
- return NULL;
+ return nullptr;
URLRequestJob* job =
request->context()->job_factory()->MaybeInterceptRedirect(
@@ -115,7 +115,7 @@
if (job)
return job;
- return NULL;
+ return nullptr;
}
URLRequestJob* URLRequestJobManager::MaybeInterceptResponse(
@@ -123,15 +123,15 @@
DCHECK(IsAllowedThread());
if (!request->url().is_valid() ||
request->status().status() == URLRequestStatus::CANCELED) {
- return NULL;
+ return nullptr;
}
- const URLRequestJobFactory* job_factory = NULL;
+ const URLRequestJobFactory* job_factory = nullptr;
job_factory = request->context()->job_factory();
const std::string& scheme = request->url().scheme(); // already lowercase
if (!job_factory->IsHandledProtocol(scheme))
- return NULL;
+ return nullptr;
URLRequestJob* job =
request->context()->job_factory()->MaybeInterceptResponse(
@@ -139,7 +139,7 @@
if (job)
return job;
- return NULL;
+ return nullptr;
}
// static
diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc
index c516761..bfd3bbe 100644
--- a/net/url_request/url_request_job_unittest.cc
+++ b/net/url_request/url_request_job_unittest.cc
@@ -111,7 +111,7 @@
TEST_MODE_NORMAL,
nullptr,
nullptr,
- 0,
+ nullptr,
0,
OK,
OK,
@@ -131,7 +131,7 @@
TEST_MODE_NORMAL,
nullptr,
nullptr,
- 0,
+ nullptr,
0,
OK,
OK,
diff --git a/net/url_request/url_request_redirect_job.cc b/net/url_request/url_request_redirect_job.cc
index 6a2c2c6..e53413a 100644
--- a/net/url_request/url_request_redirect_job.cc
+++ b/net/url_request/url_request_redirect_job.cc
@@ -114,7 +114,7 @@
fake_headers_ = new HttpResponseHeaders(
HttpUtil::AssembleRawHeaders(header_string.c_str(),
header_string.length()));
- DCHECK(fake_headers_->IsRedirect(NULL));
+ DCHECK(fake_headers_->IsRedirect(nullptr));
request()->net_log().AddEvent(
NetLogEventType::URL_REQUEST_FAKE_RESPONSE_HEADERS_CREATED,
diff --git a/net/url_request/url_request_simple_job_unittest.cc b/net/url_request/url_request_simple_job_unittest.cc
index 214dcf9..7a0bc59 100644
--- a/net/url_request/url_request_simple_job_unittest.cc
+++ b/net/url_request/url_request_simple_job_unittest.cc
@@ -143,7 +143,7 @@
} // namespace
TEST_F(URLRequestSimpleJobTest, SimpleRequest) {
- StartRequest(NULL);
+ StartRequest(nullptr);
EXPECT_THAT(delegate_.request_status(), IsOk());
EXPECT_EQ(kTestData, delegate_.data_received());
}
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc
index 6e7c1b7..e0eacca 100644
--- a/net/url_request/url_request_test_job.cc
+++ b/net/url_request/url_request_test_job.cc
@@ -154,7 +154,7 @@
stage_(WAITING),
priority_(DEFAULT_PRIORITY),
offset_(0),
- async_buf_(NULL),
+ async_buf_(nullptr),
async_buf_size_(0),
response_headers_length_(0),
async_reads_(false),
diff --git a/net/url_request/url_request_throttler_entry.cc b/net/url_request/url_request_throttler_entry.cc
index 7af8e9a..7a1d7fc 100644
--- a/net/url_request/url_request_throttler_entry.cc
+++ b/net/url_request/url_request_throttler_entry.cc
@@ -148,7 +148,7 @@
}
void URLRequestThrottlerEntry::DetachManager() {
- manager_ = NULL;
+ manager_ = nullptr;
}
bool URLRequestThrottlerEntry::ShouldRejectRequest(
diff --git a/net/url_request/url_request_throttler_manager.cc b/net/url_request/url_request_throttler_manager.cc
index cf2b0c31..aa35994b 100644
--- a/net/url_request/url_request_throttler_manager.cc
+++ b/net/url_request/url_request_throttler_manager.cc
@@ -38,7 +38,7 @@
// entries, detach the entries' back-pointer to the manager.
auto i = url_entries_.begin();
while (i != url_entries_.end()) {
- if (i->second.get() != NULL) {
+ if (i->second.get() != nullptr) {
i->second->DetachManager();
}
++i;
@@ -66,11 +66,11 @@
// aggressively (i.e. this resets the error count when the entry's URL
// hasn't been requested in long enough).
if (entry.get() && entry->IsEntryOutdated()) {
- entry = NULL;
+ entry = nullptr;
}
// Create the entry if needed.
- if (entry.get() == NULL) {
+ if (entry.get() == nullptr) {
entry = new URLRequestThrottlerEntry(this, url_id);
// We only disable back-off throttling on an entry that we have
diff --git a/net/url_request/url_request_throttler_simulation_unittest.cc b/net/url_request/url_request_throttler_simulation_unittest.cc
index b52ce78..e26e150 100644
--- a/net/url_request/url_request_throttler_simulation_unittest.cc
+++ b/net/url_request/url_request_throttler_simulation_unittest.cc
@@ -127,7 +127,7 @@
max_experienced_queries_per_tick_(0),
mock_request_(context_.CreateRequest(GURL(),
DEFAULT_PRIORITY,
- NULL,
+ nullptr,
TRAFFIC_ANNOTATION_FOR_TESTS)) {}
void SetDowntime(const TimeTicks& start_time, const TimeDelta& duration) {
@@ -598,8 +598,8 @@
if (!enable_throttling)
throttler_entry->DisableBackoffThrottling();
- Requester requester(
- throttler_entry.get(), average_client_interval, &server, NULL);
+ Requester requester(throttler_entry.get(), average_client_interval, &server,
+ nullptr);
requester.SetStartupJitter(duration / 3);
requester.SetRequestJitter(average_client_interval);
diff --git a/net/url_request/url_request_throttler_unittest.cc b/net/url_request/url_request_throttler_unittest.cc
index b9add85..5090c87 100644
--- a/net/url_request/url_request_throttler_unittest.cc
+++ b/net/url_request/url_request_throttler_unittest.cc
@@ -164,7 +164,7 @@
URLRequestThrottlerEntryTest()
: request_(context_.CreateRequest(GURL(),
DEFAULT_PRIORITY,
- NULL,
+ nullptr,
TRAFFIC_ANNOTATION_FOR_TESTS)) {}
void SetUp() override;
@@ -315,7 +315,7 @@
URLRequestThrottlerManagerTest()
: request_(context_.CreateRequest(GURL(),
DEFAULT_PRIORITY,
- NULL,
+ nullptr,
TRAFFIC_ANNOTATION_FOR_TESTS)) {}
void SetUp() override { request_->SetLoadFlags(0); }
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index c6323ed..eb1c0157 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -555,10 +555,9 @@
retval_(OK),
auth_retval_(AUTH_REQUIRED_RESPONSE_NO_ACTION),
block_on_(0),
- target_auth_credentials_(NULL),
+ target_auth_credentials_(nullptr),
stage_blocked_for_callback_(NOT_BLOCKED),
- weak_factory_(this) {
-}
+ weak_factory_(this) {}
void BlockingNetworkDelegate::RunUntilBlocked() {
base::RunLoop run_loop;
@@ -605,7 +604,7 @@
void BlockingNetworkDelegate::RunAuthCallback(AuthRequiredResponse response,
AuthCallback callback) {
if (auth_retval_ == AUTH_REQUIRED_RESPONSE_SET_AUTH) {
- ASSERT_TRUE(target_auth_credentials_ != NULL);
+ ASSERT_TRUE(target_auth_credentials_ != nullptr);
*target_auth_credentials_ = auth_credentials_;
}
std::move(callback).Run(response);
@@ -1338,7 +1337,7 @@
}
// Take out mock resource provider.
- NetModule::SetResourceProvider(NULL);
+ NetModule::SetResourceProvider(nullptr);
}
TEST_F(URLRequestTest, FileDirOutputSanity) {
@@ -1461,7 +1460,7 @@
{
Microsoft::WRL::ComPtr<IShellLink> shell;
ASSERT_TRUE(SUCCEEDED(::CoCreateInstance(
- CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shell))));
+ CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shell))));
Microsoft::WRL::ComPtr<IPersistFile> persist;
ASSERT_TRUE(SUCCEEDED(shell.CopyTo(persist.GetAddressOf())));
EXPECT_TRUE(SUCCEEDED(shell->SetPath(base::as_wcstr(app_path.value()))));
@@ -1484,14 +1483,14 @@
GetFileAttributesEx(base::as_wcstr(app_path.value()), GetFileExInfoStandard,
&data);
HANDLE file = CreateFile(base::as_wcstr(app_path.value()), GENERIC_READ,
- FILE_SHARE_READ, NULL, OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL, NULL);
+ FILE_SHARE_READ, nullptr, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, nullptr);
EXPECT_NE(INVALID_HANDLE_VALUE, file);
std::unique_ptr<char[]> buffer(new char[data.nFileSizeLow]);
DWORD read_size;
BOOL result;
- result = ReadFile(file, buffer.get(), data.nFileSizeLow,
- &read_size, NULL);
+ result =
+ ReadFile(file, buffer.get(), data.nFileSizeLow, &read_size, nullptr);
std::string content(buffer.get(), read_size);
CloseHandle(file);
@@ -1827,8 +1826,7 @@
// Inherit PlatformTest since we require the autorelease pool on Mac OS X.
class URLRequestInterceptorTest : public URLRequestTest {
public:
- URLRequestInterceptorTest() : URLRequestTest(), interceptor_(NULL) {
- }
+ URLRequestInterceptorTest() : URLRequestTest(), interceptor_(nullptr) {}
~URLRequestInterceptorTest() override {
// URLRequestJobs may post clean-up tasks on destruction.
@@ -4541,8 +4539,8 @@
EXPECT_EQ(307, r->GetResponseCode());
EXPECT_EQ(307, r->response_headers()->response_code());
std::string location;
- ASSERT_TRUE(r->response_headers()->EnumerateHeader(NULL, "Location",
- &location));
+ ASSERT_TRUE(
+ r->response_headers()->EnumerateHeader(nullptr, "Location", &location));
EXPECT_EQ(redirect_url, GURL(location));
// Let the request finish.
@@ -4596,8 +4594,8 @@
EXPECT_EQ(307, r->GetResponseCode());
EXPECT_EQ(307, r->response_headers()->response_code());
std::string location;
- ASSERT_TRUE(r->response_headers()->EnumerateHeader(NULL, "Location",
- &location));
+ ASSERT_TRUE(
+ r->response_headers()->EnumerateHeader(nullptr, "Location", &location));
EXPECT_EQ(redirect_url, GURL(location));
// Let the request finish.
@@ -4660,8 +4658,8 @@
EXPECT_EQ(307, r->GetResponseCode());
EXPECT_EQ(307, r->response_headers()->response_code());
std::string location;
- ASSERT_TRUE(r->response_headers()->EnumerateHeader(NULL, "Location",
- &location));
+ ASSERT_TRUE(
+ r->response_headers()->EnumerateHeader(nullptr, "Location", &location));
EXPECT_EQ(redirect_url, GURL(location));
// Let the request finish.
@@ -5812,7 +5810,7 @@
TestDelegate request_delegate;
TestURLRequestContext context(true);
- context.set_network_delegate(NULL);
+ context.set_network_delegate(nullptr);
context.set_net_log(&net_log_);
context.Init();
@@ -6048,7 +6046,7 @@
AsyncLoggingUrlRequestDelegate request_delegate(
AsyncLoggingUrlRequestDelegate::NO_CANCEL);
TestURLRequestContext context(true);
- context.set_network_delegate(NULL);
+ context.set_network_delegate(nullptr);
context.set_net_log(&net_log_);
context.Init();
@@ -6107,7 +6105,7 @@
AsyncLoggingUrlRequestDelegate request_delegate(
AsyncLoggingUrlRequestDelegate::NO_CANCEL);
TestURLRequestContext context(true);
- context.set_network_delegate(NULL);
+ context.set_network_delegate(nullptr);
context.set_net_log(&net_log_);
context.Init();
@@ -6165,7 +6163,7 @@
AsyncLoggingUrlRequestDelegate request_delegate(cancel_stage);
TestNetLog net_log;
TestURLRequestContext context(true);
- context.set_network_delegate(NULL);
+ context.set_network_delegate(nullptr);
context.set_net_log(&net_log);
context.Init();
@@ -8944,7 +8942,7 @@
context.Init();
// We override the HttpUserAgentSettings after initialization because empty
// entries get overridden by Init().
- context.set_http_user_agent_settings(NULL);
+ context.set_http_user_agent_settings(nullptr);
struct {
const char* request;
@@ -9207,8 +9205,8 @@
// TODO(bengr): Merge this with the URLRequestInterceptorHTTPTest fixture,
// ideally remove the dependency on URLRequestTestJob, and maybe move these
// tests into the factory tests.
- URLRequestInterceptorTestHTTP() : URLRequestTestHTTP(), interceptor_(NULL) {
- }
+ URLRequestInterceptorTestHTTP()
+ : URLRequestTestHTTP(), interceptor_(nullptr) {}
void SetUpFactory() override {
interceptor_ = new MockURLRequestInterceptor();
@@ -9988,11 +9986,12 @@
const HttpResponseHeaders* headers = req->response_headers();
std::string redirect_location;
- EXPECT_TRUE(headers->EnumerateHeader(NULL, "Location", &redirect_location));
+ EXPECT_TRUE(
+ headers->EnumerateHeader(nullptr, "Location", &redirect_location));
EXPECT_EQ(hsts_https_url.spec(), redirect_location);
std::string received_cors_header;
- EXPECT_TRUE(headers->EnumerateHeader(NULL, "Access-Control-Allow-Origin",
+ EXPECT_TRUE(headers->EnumerateHeader(nullptr, "Access-Control-Allow-Origin",
&received_cors_header));
EXPECT_EQ(kOriginHeaderValue, received_cors_header);
}
@@ -10745,7 +10744,7 @@
scoped_refptr<X509Certificate> root_cert =
ImportCertFromFile(GetTestCertsDirectory(), "ocsp-test-root.pem");
- CHECK_NE(static_cast<X509Certificate*>(NULL), root_cert.get());
+ CHECK_NE(static_cast<X509Certificate*>(nullptr), root_cert.get());
test_root_.reset(new ScopedTestRoot(root_cert.get()));
#if defined(OS_ANDROID) || defined(USE_BUILTIN_CERT_VERIFIER)
diff --git a/net/websockets/websocket_basic_stream.cc b/net/websockets/websocket_basic_stream.cc
index d9d45b65..0fa933d 100644
--- a/net/websockets/websocket_basic_stream.cc
+++ b/net/websockets/websocket_basic_stream.cc
@@ -107,7 +107,7 @@
generate_websocket_masking_key_(&GenerateWebSocketMaskingKey) {
// http_read_buffer_ should not be set if it contains no data.
if (http_read_buffer_.get() && http_read_buffer_->offset() == 0)
- http_read_buffer_ = NULL;
+ http_read_buffer_ = nullptr;
DCHECK(connection_->is_initialized());
}
@@ -321,10 +321,10 @@
int WebSocketBasicStream::ConvertChunkToFrame(
std::unique_ptr<WebSocketFrameChunk> chunk,
std::unique_ptr<WebSocketFrame>* frame) {
- DCHECK(frame->get() == NULL);
+ DCHECK(frame->get() == nullptr);
bool is_first_chunk = false;
if (chunk->header) {
- DCHECK(current_frame_header_ == NULL)
+ DCHECK(current_frame_header_ == nullptr)
<< "Received the header for a new frame without notification that "
<< "the previous frame was complete (bug in WebSocketFrameParser?)";
is_first_chunk = true;
@@ -384,7 +384,7 @@
memcpy(body->data(),
incomplete_control_frame_body_->StartOfBuffer(),
body_size);
- incomplete_control_frame_body_ = NULL; // Frame now complete.
+ incomplete_control_frame_body_ = nullptr; // Frame now complete.
DCHECK(is_final_chunk);
*frame = CreateFrame(is_final_chunk, body);
return OK;
diff --git a/net/websockets/websocket_channel.cc b/net/websockets/websocket_channel.cc
index f8045bff..69bcd78 100644
--- a/net/websockets/websocket_channel.cc
+++ b/net/websockets/websocket_channel.cc
@@ -888,7 +888,7 @@
// This call is not redundant when size == 0 because it tells us what
// the current state is.
StreamingUtf8Validator::State state = incoming_utf8_validator_.AddBytes(
- size ? data_buffer->data() : NULL, static_cast<size_t>(size));
+ size ? data_buffer->data() : nullptr, static_cast<size_t>(size));
if (state == StreamingUtf8Validator::INVALID ||
(state == StreamingUtf8Validator::VALID_MIDPOINT && final)) {
FailChannel("Could not decode a text frame as UTF-8.",
diff --git a/net/websockets/websocket_deflate_stream.cc b/net/websockets/websocket_deflate_stream.cc
index ac20c1b..aefc853 100644
--- a/net/websockets/websocket_deflate_stream.cc
+++ b/net/websockets/websocket_deflate_stream.cc
@@ -284,7 +284,7 @@
frames->swap(frames_passed);
for (size_t i = 0; i < frames_passed.size(); ++i) {
std::unique_ptr<WebSocketFrame> frame(std::move(frames_passed[i]));
- frames_passed[i] = NULL;
+ frames_passed[i] = nullptr;
DVLOG(3) << "Input frame: opcode=" << frame->header.opcode
<< " final=" << frame->header.final
<< " reserved1=" << frame->header.reserved1
diff --git a/net/websockets/websocket_deflate_stream_test.cc b/net/websockets/websocket_deflate_stream_test.cc
index 1caa4cd0..0b98bb5 100644
--- a/net/websockets/websocket_deflate_stream_test.cc
+++ b/net/websockets/websocket_deflate_stream_test.cc
@@ -243,9 +243,7 @@
class WebSocketDeflateStreamTest : public ::testing::Test {
public:
- WebSocketDeflateStreamTest()
- : mock_stream_(NULL),
- predictor_(NULL) {}
+ WebSocketDeflateStreamTest() : mock_stream_(nullptr), predictor_(nullptr) {}
~WebSocketDeflateStreamTest() override = default;
void SetUp() override {
diff --git a/net/websockets/websocket_deflater.cc b/net/websockets/websocket_deflater.cc
index 27b3399..e79926c 100644
--- a/net/websockets/websocket_deflater.cc
+++ b/net/websockets/websocket_deflater.cc
@@ -21,7 +21,7 @@
WebSocketDeflater::~WebSocketDeflater() {
if (stream_) {
deflateEnd(stream_.get());
- stream_.reset(NULL);
+ stream_.reset(nullptr);
}
}
@@ -92,7 +92,7 @@
ResetContext();
return true;
}
- stream_->next_in = NULL;
+ stream_->next_in = nullptr;
stream_->avail_in = 0;
int result = Deflate(Z_SYNC_FLUSH);
diff --git a/net/websockets/websocket_frame_parser_test.cc b/net/websockets/websocket_frame_parser_test.cc
index 6ff9668..61c0be5 100644
--- a/net/websockets/websocket_frame_parser_test.cc
+++ b/net/websockets/websocket_frame_parser_test.cc
@@ -56,9 +56,9 @@
EXPECT_EQ(kWebSocketNormalClosure, parser.websocket_error());
ASSERT_EQ(1u, frames.size());
WebSocketFrameChunk* frame = frames[0].get();
- ASSERT_TRUE(frame != NULL);
+ ASSERT_TRUE(frame != nullptr);
const WebSocketFrameHeader* header = frame->header.get();
- EXPECT_TRUE(header != NULL);
+ EXPECT_TRUE(header != nullptr);
if (header) {
EXPECT_TRUE(header->final);
EXPECT_FALSE(header->reserved1);
@@ -83,9 +83,9 @@
EXPECT_EQ(kWebSocketNormalClosure, parser.websocket_error());
ASSERT_EQ(1u, frames.size());
WebSocketFrameChunk* frame = frames[0].get();
- ASSERT_TRUE(frame != NULL);
+ ASSERT_TRUE(frame != nullptr);
const WebSocketFrameHeader* header = frame->header.get();
- EXPECT_TRUE(header != NULL);
+ EXPECT_TRUE(header != nullptr);
if (header) {
EXPECT_TRUE(header->final);
EXPECT_FALSE(header->reserved1);
@@ -143,7 +143,7 @@
for (int i = 0; i < kNumInputs; ++i) {
WebSocketFrameChunk* frame = frames[i].get();
- EXPECT_TRUE(frame != NULL);
+ EXPECT_TRUE(frame != nullptr);
if (!frame)
continue;
EXPECT_TRUE(frame->final_chunk);
@@ -155,7 +155,7 @@
frame->data->data()));
const WebSocketFrameHeader* header = frame->header.get();
- EXPECT_TRUE(header != NULL);
+ EXPECT_TRUE(header != nullptr);
if (!header)
continue;
EXPECT_TRUE(header->final);
@@ -189,7 +189,7 @@
if (frames1.size() != 1u)
continue;
WebSocketFrameChunk* frame1 = frames1[0].get();
- EXPECT_TRUE(frame1 != NULL);
+ EXPECT_TRUE(frame1 != nullptr);
if (!frame1)
continue;
EXPECT_FALSE(frame1->final_chunk);
@@ -201,7 +201,7 @@
std::equal(expected1.begin(), expected1.end(), frame1->data->data()));
}
const WebSocketFrameHeader* header1 = frame1->header.get();
- EXPECT_TRUE(header1 != NULL);
+ EXPECT_TRUE(header1 != nullptr);
if (!header1)
continue;
EXPECT_TRUE(header1->final);
@@ -219,7 +219,7 @@
if (frames2.size() != 1u)
continue;
WebSocketFrameChunk* frame2 = frames2[0].get();
- EXPECT_TRUE(frame2 != NULL);
+ EXPECT_TRUE(frame2 != nullptr);
if (!frame2)
continue;
EXPECT_TRUE(frame2->final_chunk);
@@ -231,7 +231,7 @@
std::equal(expected2.begin(), expected2.end(), frame2->data->data()));
}
const WebSocketFrameHeader* header2 = frame2->header.get();
- EXPECT_TRUE(header2 == NULL);
+ EXPECT_TRUE(header2 == nullptr);
}
}
@@ -256,7 +256,7 @@
if (frames1.size() != 1u)
continue;
WebSocketFrameChunk* frame1 = frames1[0].get();
- EXPECT_TRUE(frame1 != NULL);
+ EXPECT_TRUE(frame1 != nullptr);
if (!frame1)
continue;
EXPECT_FALSE(frame1->final_chunk);
@@ -268,7 +268,7 @@
std::equal(expected1.begin(), expected1.end(), frame1->data->data()));
}
const WebSocketFrameHeader* header1 = frame1->header.get();
- EXPECT_TRUE(header1 != NULL);
+ EXPECT_TRUE(header1 != nullptr);
if (!header1)
continue;
EXPECT_TRUE(header1->final);
@@ -286,7 +286,7 @@
if (frames2.size() != 1u)
continue;
WebSocketFrameChunk* frame2 = frames2[0].get();
- EXPECT_TRUE(frame2 != NULL);
+ EXPECT_TRUE(frame2 != nullptr);
if (!frame2)
continue;
EXPECT_TRUE(frame2->final_chunk);
@@ -298,7 +298,7 @@
std::equal(expected2.begin(), expected2.end(), frame2->data->data()));
}
const WebSocketFrameHeader* header2 = frame2->header.get();
- EXPECT_TRUE(header2 == NULL);
+ EXPECT_TRUE(header2 == nullptr);
}
}
@@ -328,7 +328,7 @@
if (frames.size() != 1u)
continue;
WebSocketFrameChunk* frame = frames[0].get();
- EXPECT_TRUE(frame != NULL);
+ EXPECT_TRUE(frame != nullptr);
if (!frame)
continue;
if (frame_length == input_payload_size) {
@@ -347,7 +347,7 @@
frame->data->data()));
}
const WebSocketFrameHeader* header = frame->header.get();
- EXPECT_TRUE(header != NULL);
+ EXPECT_TRUE(header != nullptr);
if (!header)
continue;
EXPECT_TRUE(header->final);
@@ -392,7 +392,7 @@
if (frames.size() != 1u)
continue;
WebSocketFrameChunk* frame = frames[0].get();
- EXPECT_TRUE(frame != NULL);
+ EXPECT_TRUE(frame != nullptr);
if (!frame)
continue;
if (frame_length == 0u) {
@@ -402,7 +402,7 @@
}
EXPECT_EQ(NULL, frame->data.get());
const WebSocketFrameHeader* header = frame->header.get();
- EXPECT_TRUE(header != NULL);
+ EXPECT_TRUE(header != nullptr);
if (!header)
continue;
EXPECT_TRUE(header->final);
@@ -494,13 +494,13 @@
if (frames.size() != 1u)
continue;
WebSocketFrameChunk* frame = frames[0].get();
- EXPECT_TRUE(frame != NULL);
+ EXPECT_TRUE(frame != nullptr);
if (!frame)
continue;
EXPECT_TRUE(frame->final_chunk);
EXPECT_EQ(NULL, frame->data.get());
const WebSocketFrameHeader* header = frame->header.get();
- EXPECT_TRUE(header != NULL);
+ EXPECT_TRUE(header != nullptr);
if (!header)
continue;
EXPECT_TRUE(header->final);
@@ -550,13 +550,13 @@
if (frames.size() != 1u)
continue;
WebSocketFrameChunk* frame = frames[0].get();
- EXPECT_TRUE(frame != NULL);
+ EXPECT_TRUE(frame != nullptr);
if (!frame)
continue;
EXPECT_TRUE(frame->final_chunk);
EXPECT_EQ(NULL, frame->data.get());
const WebSocketFrameHeader* header = frame->header.get();
- EXPECT_TRUE(header != NULL);
+ EXPECT_TRUE(header != nullptr);
if (!header)
continue;
EXPECT_EQ(final, header->final);
diff --git a/net/websockets/websocket_frame_test.cc b/net/websockets/websocket_frame_test.cc
index 24fa405..9184155 100644
--- a/net/websockets/websocket_frame_test.cc
+++ b/net/websockets/websocket_frame_test.cc
@@ -44,8 +44,8 @@
kTests[i].frame_header + kTests[i].frame_header_length);
std::vector<char> output(expected_output.size());
EXPECT_EQ(static_cast<int>(expected_output.size()),
- WriteWebSocketFrameHeader(
- header, NULL, &output.front(), output.size()));
+ WriteWebSocketFrameHeader(header, nullptr, &output.front(),
+ output.size()));
EXPECT_EQ(expected_output, output);
}
}
@@ -132,8 +132,8 @@
kTests[i].frame_header + kTests[i].frame_header_length);
std::vector<char> output(expected_output.size());
EXPECT_EQ(static_cast<int>(expected_output.size()),
- WriteWebSocketFrameHeader(
- header, NULL, &output.front(), output.size()));
+ WriteWebSocketFrameHeader(header, nullptr, &output.front(),
+ output.size()));
EXPECT_EQ(expected_output, output);
}
}
@@ -171,8 +171,8 @@
kTests[i].frame_header + kTests[i].frame_header_length);
std::vector<char> output(expected_output.size());
EXPECT_EQ(static_cast<int>(expected_output.size()),
- WriteWebSocketFrameHeader(
- header, NULL, &output.front(), output.size()));
+ WriteWebSocketFrameHeader(header, nullptr, &output.front(),
+ output.size()));
EXPECT_EQ(expected_output, output);
}
}
@@ -208,10 +208,9 @@
char dummy_buffer[14];
// Set an insufficient size to |buffer_size|.
- EXPECT_EQ(
- ERR_INVALID_ARGUMENT,
- WriteWebSocketFrameHeader(
- header, NULL, dummy_buffer, kTests[i].expected_header_size - 1));
+ EXPECT_EQ(ERR_INVALID_ARGUMENT,
+ WriteWebSocketFrameHeader(header, nullptr, dummy_buffer,
+ kTests[i].expected_header_size - 1));
}
}
@@ -247,10 +246,9 @@
kTests[i].input + kTests[i].data_length);
std::vector<char> expected_output(kTests[i].output,
kTests[i].output + kTests[i].data_length);
- MaskWebSocketFramePayload(masking_key,
- kTests[i].frame_offset,
- frame_data.empty() ? NULL : &frame_data.front(),
- frame_data.size());
+ MaskWebSocketFramePayload(
+ masking_key, kTests[i].frame_offset,
+ frame_data.empty() ? nullptr : &frame_data.front(), frame_data.size());
EXPECT_EQ(expected_output, frame_data);
}
}
diff --git a/net/websockets/websocket_inflater.cc b/net/websockets/websocket_inflater.cc
index 7f04781..6b61f497 100644
--- a/net/websockets/websocket_inflater.cc
+++ b/net/websockets/websocket_inflater.cc
@@ -96,7 +96,7 @@
num_bytes_copied += num_bytes_to_copy;
int result = InflateChokedInput();
if (result != Z_OK && result != Z_BUF_ERROR)
- return NULL;
+ return nullptr;
}
buffer->Shrink(num_bytes_copied);
return buffer;
@@ -144,7 +144,7 @@
int WebSocketInflater::InflateChokedInput() {
if (input_queue_.IsEmpty())
- return InflateWithFlush(NULL, 0);
+ return InflateWithFlush(nullptr, 0);
int result = Z_BUF_ERROR;
while (!input_queue_.IsEmpty()) {