update_engine: Replace NULL with nullptr

Replaced the usage of NULL with nullptr. This also makes it possible to
use standard gtest macros to compare pointers in Update Manager's unit tests.
So, there is no need in custom UMTEST_... macros which are replaced with the
gtest macros (see change in update_engine/update_manager/umtest_utils.h):

UMTEST_ASSERT_NULL(p)      => ASSERT_EQ(nullptr, p)
UMTEST_ASSERT_NOT_NULL(p)  => ASSERT_NE(nullptr, p)
UMTEST_EXPECT_NULL(p)      => EXPECT_EQ(nullptr, p)
UMTEST_EXPECT_NOT_NULL(p)  => EXPECT_NE(nullptr, p)

BUG=None
TEST=FEATURES=test emerge-link update_engine
     USE="clang asan" FEATURES=test emerge-link update_engine

Change-Id: I77a42a1e9ce992bb2f9f263db5cf75fe6110a4ec
Reviewed-on: https://chromium-review.googlesource.com/215136
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/download_action.cc b/download_action.cc
index 0d4354b..5b3ffeb 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -32,9 +32,9 @@
     : prefs_(prefs),
       system_state_(system_state),
       http_fetcher_(http_fetcher),
-      writer_(NULL),
+      writer_(nullptr),
       code_(ErrorCode::kSuccess),
-      delegate_(NULL),
+      delegate_(nullptr),
       bytes_received_(0),
       p2p_sharing_fd_(-1),
       p2p_visible_(true) {}
@@ -188,7 +188,7 @@
     delegate_->SetDownloadStatus(true);  // Set to active.
   }
 
-  if (system_state_ != NULL) {
+  if (system_state_ != nullptr) {
     string file_id = utils::CalculateP2PFileId(install_plan_.payload_hash,
                                                install_plan_.payload_size);
     if (system_state_->request_params()->use_p2p_for_sharing()) {
@@ -216,7 +216,7 @@
 
   // Tweak timeouts on the HTTP fetcher if we're downloading from a
   // local peer.
-  if (system_state_ != NULL &&
+  if (system_state_ != nullptr &&
       system_state_->request_params()->use_p2p_for_downloading() &&
       system_state_->request_params()->p2p_url() ==
       install_plan_.download_url) {
@@ -233,7 +233,7 @@
 void DownloadAction::TerminateProcessing() {
   if (writer_) {
     writer_->Close();
-    writer_ = NULL;
+    writer_ = nullptr;
   }
   if (delegate_) {
     delegate_->SetDownloadStatus(false);  // Set to inactive.
@@ -285,7 +285,7 @@
 void DownloadAction::TransferComplete(HttpFetcher *fetcher, bool successful) {
   if (writer_) {
     LOG_IF(WARNING, writer_->Close() != 0) << "Error closing the writer.";
-    writer_ = NULL;
+    writer_ = nullptr;
   }
   if (delegate_) {
     delegate_->SetDownloadStatus(false);  // Set to inactive.