Replace use of deprecated C Standard library headers in C++ code.

Change-Id: I9fa6630c7e4bdb2897df34d417635d8c7d8253bc
Signed-off-by: Tyler Chatow <tchatow@gmail.com>
diff --git a/aos/util/bitpacking.h b/aos/util/bitpacking.h
index df6ad16..f6d1e4e 100644
--- a/aos/util/bitpacking.h
+++ b/aos/util/bitpacking.h
@@ -1,8 +1,7 @@
 #ifndef AOS_UTIL_BITPACKING_H_
 #define AOS_UTIL_BITPACKING_H_
 
-#include <assert.h>
-
+#include <cassert>
 #include <type_traits>
 
 #include "third_party/GSL/include/gsl/gsl"
@@ -68,7 +67,8 @@
 
 template <typename Integer, size_t bits, size_t offset>
 typename std::enable_if<std::is_unsigned<Integer>::value &&
-                        sizeof(Integer) * 8 >= bits, Integer>::type
+                            sizeof(Integer) * 8 >= bits,
+                        Integer>::type
 UnpackBits(const gsl::span<const char> source) {
   Integer result = 0;
   assert(static_cast<size_t>(source.size()) * 8u >= bits + offset);
diff --git a/aos/util/bitpacking_test.cc b/aos/util/bitpacking_test.cc
index 013e911..584804b 100644
--- a/aos/util/bitpacking_test.cc
+++ b/aos/util/bitpacking_test.cc
@@ -1,6 +1,6 @@
 #include "aos/util/bitpacking.h"
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "gtest/gtest.h"
 
diff --git a/aos/util/death_test_log_implementation.h b/aos/util/death_test_log_implementation.h
index f061c61..7065141 100644
--- a/aos/util/death_test_log_implementation.h
+++ b/aos/util/death_test_log_implementation.h
@@ -1,7 +1,7 @@
 #ifndef AOS_UTIL_DEATH_TEST_LOG_IMPLEMENTATION_H_
 #define AOS_UTIL_DEATH_TEST_LOG_IMPLEMENTATION_H_
 
-#include <stdlib.h>
+#include <cstdlib>
 
 #include "aos/logging/implementations.h"
 
@@ -11,7 +11,8 @@
 // Prints all FATAL messages to stderr and then abort(3)s before the regular
 // stuff can print out anything else. Ignores all other messages.
 // This is useful in death tests that expect a LOG(FATAL) to cause the death.
-class DeathTestLogImplementation : public logging::HandleMessageLogImplementation {
+class DeathTestLogImplementation
+    : public logging::HandleMessageLogImplementation {
  public:
   virtual void HandleMessage(const logging::LogMessage &message) override {
     if (message.level == FATAL) {
diff --git a/aos/util/file_test.cc b/aos/util/file_test.cc
index 6851302..7c93fb3 100644
--- a/aos/util/file_test.cc
+++ b/aos/util/file_test.cc
@@ -1,7 +1,6 @@
 #include "aos/util/file.h"
 
-#include <stdlib.h>
-
+#include <cstdlib>
 #include <string>
 
 #include "gtest/gtest.h"
diff --git a/aos/util/run_command.cc b/aos/util/run_command.cc
index 40782da..2711e8b 100644
--- a/aos/util/run_command.cc
+++ b/aos/util/run_command.cc
@@ -1,11 +1,12 @@
 #include "aos/util/run_command.h"
 
-#include <signal.h>
+#include <fcntl.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
+
+#include <csignal>
 
 #include "aos/logging/logging.h"
 
@@ -43,19 +44,19 @@
   const pid_t pid = fork();
   switch (pid) {
     case 0:  // in child
-      {
-        int new_stdin = open("/dev/null", O_RDONLY);
-        if (new_stdin == -1) _exit(127);
-        int new_stdout = open("/dev/null", O_WRONLY);
-        if (new_stdout == -1) _exit(127);
-        int new_stderr = open("/dev/null", O_WRONLY);
-        if (new_stderr == -1) _exit(127);
-        if (dup2(new_stdin, 0) != 0) _exit(127);
-        if (dup2(new_stdout, 1) != 1) _exit(127);
-        if (dup2(new_stderr, 2) != 2) _exit(127);
-        execl("/bin/sh", "sh", "-c", command, nullptr);
-        _exit(127);
-      }
+    {
+      int new_stdin = open("/dev/null", O_RDONLY);
+      if (new_stdin == -1) _exit(127);
+      int new_stdout = open("/dev/null", O_WRONLY);
+      if (new_stdout == -1) _exit(127);
+      int new_stderr = open("/dev/null", O_WRONLY);
+      if (new_stderr == -1) _exit(127);
+      if (dup2(new_stdin, 0) != 0) _exit(127);
+      if (dup2(new_stdout, 1) != 1) _exit(127);
+      if (dup2(new_stderr, 2) != 2) _exit(127);
+      execl("/bin/sh", "sh", "-c", command, nullptr);
+      _exit(127);
+    }
     case -1:
       return -1;
     default:
diff --git a/aos/util/wrapping_counter.h b/aos/util/wrapping_counter.h
index a327dd8..ea79ec6 100644
--- a/aos/util/wrapping_counter.h
+++ b/aos/util/wrapping_counter.h
@@ -1,7 +1,7 @@
 #ifndef AOS_UTIL_WRAPPING_COUNTER_H_
 #define AOS_UTIL_WRAPPING_COUNTER_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 namespace aos {
 namespace util {
diff --git a/aos/util/wrapping_counter_test.cc b/aos/util/wrapping_counter_test.cc
index e5c58f3..3ef503b 100644
--- a/aos/util/wrapping_counter_test.cc
+++ b/aos/util/wrapping_counter_test.cc
@@ -1,6 +1,6 @@
 #include "aos/util/wrapping_counter.h"
 
-#include <limits.h>
+#include <climits>
 
 #include "gtest/gtest.h"
 
@@ -36,7 +36,7 @@
     EXPECT_EQ(i, test_counter.Update(i & 0xFF));
   }
 }
-}
+}  // namespace
 
 // This tests the basic wrapping functionality.
 TEST(WrappingCounterTest, ReasonableWrapping) {