[adb] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: Ia8c4deacafed2f3b7dbc3d4c3c77c6c632e3de81
diff --git a/adb/services.cpp b/adb/services.cpp
index a757d90..1fa7ecc 100644
--- a/adb/services.cpp
+++ b/adb/services.cpp
@@ -352,7 +352,7 @@
while (true) {
bool is_ambiguous = false;
std::string error = "unknown error";
- const char* serial = sinfo->serial.length() ? sinfo->serial.c_str() : NULL;
+ const char* serial = sinfo->serial.length() ? sinfo->serial.c_str() : nullptr;
atransport* t = acquire_one_transport(sinfo->transport_type, serial, sinfo->transport_id,
&is_ambiguous, &error);
if (t != nullptr && (sinfo->state == kCsAny || sinfo->state == t->GetConnectionState())) {
@@ -389,8 +389,8 @@
return;
}
- int console_port = strtol(pieces[0].c_str(), NULL, 0);
- int adb_port = strtol(pieces[1].c_str(), NULL, 0);
+ int console_port = strtol(pieces[0].c_str(), nullptr, 0);
+ int adb_port = strtol(pieces[1].c_str(), nullptr, 0);
if (console_port <= 0 || adb_port <= 0) {
*response = android::base::StringPrintf("Invalid port numbers: %s", port_spec.c_str());
return;
@@ -494,6 +494,6 @@
}
return create_local_socket(fd);
}
- return NULL;
+ return nullptr;
}
#endif /* ADB_HOST */