Fix a number of clang-tidy warnings

No functional changes. There are still plenty of atoi() warnings,
but most of those should go away as we convert all remaining
commands to binder.

Test: atest netd_integration_test netd_utils_test netd_integration_test
Change-Id: I15d6fd9523debf996dec9d0b3c3d7c11ae6444f3
diff --git a/server/TcpSocketMonitor.cpp b/server/TcpSocketMonitor.cpp
index 3e620b1..9439d77 100644
--- a/server/TcpSocketMonitor.cpp
+++ b/server/TcpSocketMonitor.cpp
@@ -16,7 +16,8 @@
 
 #define LOG_TAG "TcpSocketMonitor"
 
-#include <iomanip>
+#include <chrono>
+#include <cinttypes>
 #include <thread>
 #include <vector>
 
@@ -110,7 +111,7 @@
     if (!mNetworkStats.empty()) {
         dw.blankline();
         dw.println("Network stats:");
-        for (const auto& stats : mNetworkStats) {
+        for (const std::pair<uint32_t, TcpStats>& stats : mNetworkStats) {
             if (stats.second.nSockets == 0) {
                 continue;
             }
@@ -126,9 +127,9 @@
     if (!mSocketEntries.empty()) {
         dw.blankline();
         dw.println("Socket entries:");
-        for (const auto& stats : mSocketEntries) {
-            dw.println("netId=%u uid=%u cookie=%llu",
-                    stats.second.mark.netId, stats.second.uid, (unsigned long long) stats.first);
+        for (const std::pair<uint64_t, SocketEntry>& stats : mSocketEntries) {
+            dw.println("netId=%u uid=%u cookie=%" PRIu64, stats.second.mark.netId, stats.second.uid,
+                       stats.first);
         }
     }
 
diff --git a/server/ndc.cpp b/server/ndc.cpp
index 836e802..ec59637 100644
--- a/server/ndc.cpp
+++ b/server/ndc.cpp
@@ -156,12 +156,10 @@
 
         for (i = 0; i < rc; i++) {
             if (buffer[i] == '\0') {
-                int code;
                 char tmp[4];
-
                 strncpy(tmp, buffer + offset, 3);
                 tmp[3] = '\0';
-                code = atoi(tmp);
+                long code = strtol(tmp, nullptr, 10);
 
                 printf("%s\n", buffer + offset);
                 if (stop_after_cmd) {