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/frc971/analysis/py_log_reader.cc b/frc971/analysis/py_log_reader.cc
index 6a6c767..4485cca 100644
--- a/frc971/analysis/py_log_reader.cc
+++ b/frc971/analysis/py_log_reader.cc
@@ -17,8 +17,8 @@
 // Note that Python.h needs to be included before anything else.
 #include <Python.h>
 
+#include <cerrno>
 #include <memory>
-#include <errno.h>
 
 #include "aos/configuration.h"
 #include "aos/events/logging/log_reader.h"
@@ -69,7 +69,7 @@
 }
 
 PyObject *LogReader_new(PyTypeObject *type, PyObject * /*args*/,
-                            PyObject * /*kwds*/) {
+                        PyObject * /*kwds*/) {
   LogReaderType *self;
   self = (LogReaderType *)type->tp_alloc(type, 0);
   if (self != nullptr) {
@@ -117,9 +117,8 @@
   return 0;
 }
 
-PyObject *LogReader_get_data_for_channel(LogReaderType *self,
-                                                PyObject *args,
-                                                PyObject *kwds) {
+PyObject *LogReader_get_data_for_channel(LogReaderType *self, PyObject *args,
+                                         PyObject *kwds) {
   const char *kwlist[] = {"name", "type", nullptr};
 
   const char *name;
@@ -140,8 +139,7 @@
   for (const auto &channel : tools->channel_data) {
     if (channel.name == name && channel.type == type) {
       PyObject *list = PyList_New(channel.messages.size());
-      for (size_t ii = 0; ii < channel.messages.size(); ++ii)
-      {
+      for (size_t ii = 0; ii < channel.messages.size(); ++ii) {
         const auto &message = channel.messages[ii];
         PyObject *monotonic_time = PyLong_FromLongLong(
             std::chrono::duration_cast<std::chrono::nanoseconds>(
@@ -168,7 +166,7 @@
 }
 
 PyObject *LogReader_subscribe(LogReaderType *self, PyObject *args,
-                                     PyObject *kwds) {
+                              PyObject *kwds) {
   const char *kwlist[] = {"name", "type", nullptr};
 
   const char *name;
@@ -192,8 +190,7 @@
     return Py_False;
   }
   const int index = tools->channel_data.size();
-  tools->channel_data.push_back(
-      {.name = name, .type = type, .messages = {}});
+  tools->channel_data.push_back({.name = name, .type = type, .messages = {}});
   tools->event_loop->MakeRawWatcher(
       channel, [channel, index, tools](const aos::Context &context,
                                        const void *message) {
diff --git a/frc971/autonomous/base_autonomous_actor.cc b/frc971/autonomous/base_autonomous_actor.cc
index e691d03..8a5b60e 100644
--- a/frc971/autonomous/base_autonomous_actor.cc
+++ b/frc971/autonomous/base_autonomous_actor.cc
@@ -1,14 +1,12 @@
 #include "frc971/autonomous/base_autonomous_actor.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
+#include "aos/logging/logging.h"
 #include "aos/util/math.h"
 #include "aos/util/phased_loop.h"
-#include "aos/logging/logging.h"
-
 #include "frc971/control_loops/control_loops_generated.h"
 #include "frc971/control_loops/drivetrain/drivetrain_goal_generated.h"
 #include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
@@ -316,8 +314,9 @@
         (Eigen::Matrix<double, 7, 1>()
              << initial_drivetrain_.left -
                     drivetrain_status_fetcher_->profiled_left_position_goal(),
-         0.0, initial_drivetrain_.right -
-                  drivetrain_status_fetcher_->profiled_right_position_goal(),
+         0.0,
+         initial_drivetrain_.right -
+             drivetrain_status_fetcher_->profiled_right_position_goal(),
          0.0, 0.0, 0.0, 0.0)
             .finished();
     const Eigen::Matrix<double, 2, 1> linear_error =
@@ -352,8 +351,9 @@
         (Eigen::Matrix<double, 7, 1>()
              << initial_drivetrain_.left -
                     drivetrain_status_fetcher_->profiled_left_position_goal(),
-         0.0, initial_drivetrain_.right -
-                  drivetrain_status_fetcher_->profiled_right_position_goal(),
+         0.0,
+         initial_drivetrain_.right -
+             drivetrain_status_fetcher_->profiled_right_position_goal(),
          0.0, 0.0, 0.0, 0.0)
             .finished();
     const Eigen::Matrix<double, 2, 1> angular_error =
diff --git a/frc971/control_loops/control_loop-tmpl.h b/frc971/control_loops/control_loop-tmpl.h
index f6fd0af..0db1786 100644
--- a/frc971/control_loops/control_loop-tmpl.h
+++ b/frc971/control_loops/control_loop-tmpl.h
@@ -1,5 +1,5 @@
-#include <stddef.h>
-#include <inttypes.h>
+#include <cinttypes>
+#include <cstddef>
 
 #include "aos/logging/logging.h"
 
@@ -19,7 +19,8 @@
 
 template <class GoalType, class PositionType, class StatusType,
           class OutputType>
-void ControlLoop<GoalType, PositionType, StatusType, OutputType>::ZeroOutputs() {
+void ControlLoop<GoalType, PositionType, StatusType,
+                 OutputType>::ZeroOutputs() {
   typename ::aos::Sender<OutputType>::Builder builder =
       output_sender_.MakeBuilder();
   builder.Send(Zero(&builder));
diff --git a/frc971/control_loops/control_loop.h b/frc971/control_loops/control_loop.h
index 741b32f..80b0bca 100644
--- a/frc971/control_loops/control_loop.h
+++ b/frc971/control_loops/control_loop.h
@@ -1,9 +1,8 @@
 #ifndef AOS_CONTROL_LOOP_CONTROL_LOOP_H_
 #define AOS_CONTROL_LOOP_CONTROL_LOOP_H_
 
-#include <string.h>
-
 #include <atomic>
+#include <cstring>
 
 #include "aos/events/event_loop.h"
 #include "aos/time/time.h"
diff --git a/frc971/control_loops/drivetrain/drivetrain.cc b/frc971/control_loops/drivetrain/drivetrain.cc
index 5242550..2cc9f35 100644
--- a/frc971/control_loops/drivetrain/drivetrain.cc
+++ b/frc971/control_loops/drivetrain/drivetrain.cc
@@ -1,9 +1,9 @@
 #include "frc971/control_loops/drivetrain/drivetrain.h"
 
 #include <sched.h>
-#include <stdio.h>
 
 #include <cmath>
+#include <cstdio>
 #include <memory>
 
 #include "Eigen/Dense"
diff --git a/frc971/control_loops/drivetrain/drivetrain_uc.q.cc b/frc971/control_loops/drivetrain/drivetrain_uc.q.cc
index 5f8bce4..2a2870c 100644
--- a/frc971/control_loops/drivetrain/drivetrain_uc.q.cc
+++ b/frc971/control_loops/drivetrain/drivetrain_uc.q.cc
@@ -1,5 +1,6 @@
 #include "frc971/control_loops/drivetrain/drivetrain_uc.q.h"
-#include <inttypes.h>
+
+#include <cinttypes>
 
 namespace frc971 {
 namespace control_loops {
diff --git a/frc971/control_loops/hall_effect_tracker.h b/frc971/control_loops/hall_effect_tracker.h
index 084c9a7..c18d2af 100644
--- a/frc971/control_loops/hall_effect_tracker.h
+++ b/frc971/control_loops/hall_effect_tracker.h
@@ -1,7 +1,7 @@
 #ifndef FRC971_CONTROL_LOOPS_HALL_EFFECT_H_
 #define FRC971_CONTROL_LOOPS_HALL_EFFECT_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "frc971/control_loops/control_loops_generated.h"
 
diff --git a/frc971/control_loops/hybrid_state_feedback_loop.h b/frc971/control_loops/hybrid_state_feedback_loop.h
index 4dab950..6285024 100644
--- a/frc971/control_loops/hybrid_state_feedback_loop.h
+++ b/frc971/control_loops/hybrid_state_feedback_loop.h
@@ -1,21 +1,19 @@
 #ifndef FRC971_CONTROL_LOOPS_HYBRID_STATE_FEEDBACK_LOOP_H_
 #define FRC971_CONTROL_LOOPS_HYBRID_STATE_FEEDBACK_LOOP_H_
 
-#include <assert.h>
-
+#include <cassert>
 #include <chrono>
 #include <memory>
 #include <utility>
 #include <vector>
 
 #include "Eigen/Dense"
-#include "unsupported/Eigen/MatrixFunctions"
-
-#include "frc971/control_loops/control_loop.h"
 #include "aos/logging/logging.h"
 #include "aos/macros.h"
 #include "frc971/control_loops/c2d.h"
+#include "frc971/control_loops/control_loop.h"
 #include "frc971/control_loops/state_feedback_loop.h"
+#include "unsupported/Eigen/MatrixFunctions"
 
 template <int number_of_states, int number_of_inputs, int number_of_outputs,
           typename Scalar = double>
diff --git a/frc971/control_loops/state_feedback_loop.h b/frc971/control_loops/state_feedback_loop.h
index 50edf0d..4250df2 100644
--- a/frc971/control_loops/state_feedback_loop.h
+++ b/frc971/control_loops/state_feedback_loop.h
@@ -1,8 +1,7 @@
 #ifndef FRC971_CONTROL_LOOPS_STATE_FEEDBACK_LOOP_H_
 #define FRC971_CONTROL_LOOPS_STATE_FEEDBACK_LOOP_H_
 
-#include <assert.h>
-
+#include <cassert>
 #include <chrono>
 #include <memory>
 #include <utility>
diff --git a/frc971/control_loops/voltage_cap/voltage_cap.h b/frc971/control_loops/voltage_cap/voltage_cap.h
index 49aa9e8..ad4e4c6c 100644
--- a/frc971/control_loops/voltage_cap/voltage_cap.h
+++ b/frc971/control_loops/voltage_cap/voltage_cap.h
@@ -1,29 +1,29 @@
 #ifndef FRC971_CONTROL_LOOPS_VOLTAGE_CAP_VOLTAGE_CAP_H_
 #define FRC971_CONTROL_LOOPS_VOLTAGE_CAP_VOLTAGE_CAP_H_
 
-#include <stdio.h>
+#include <cstdio>
 
 namespace frc971 {
 namespace control_loops {
 
-// This function maintains the difference of power between two voltages passed in
-//   that are outside of our range of possible voltage output.
-// This is because we figured that maintaining the difference rather than the ratio
-//   between the voltages would get us to our goal as fast as possible.
+// This function maintains the difference of power between two voltages passed
+// in that are outside of our range of possible voltage output.
+// This is because we figured that maintaining the difference rather than the
+// ratio between the voltages would get us to our goal as fast as possible.
 //
 //
 // The 'box' is a box formed on a graph by the maximum and minimun voltages of
-//   voltage_one and voltage_two with
-//   voltage_one on the y-axis and voltage_two on the x-axis.
+//   voltage_one and voltage_two with voltage_one on the y-axis and voltage_two
+//   on the x-axis.
 // If a line with a slope of one(45degrees) is plotted from the point formed
-//   by graphing voltage_one(y) and voltage_two(x), the first intersecting point of
-//   the box is the maximum voltage that we can output to get to the goal as
+//   by graphing voltage_one(y) and voltage_two(x), the first intersecting point
+//   of the box is the maximum voltage that we can output to get to the goal as
 //   fast as possible.
 // If the line does not intersect the box, then we use the closest corner of
 //   the box to the line in either quadrant two or quadrant four of the graph.
 void VoltageCap(double max_voltage, double voltage_one, double voltage_two,
                 double *out_voltage_one, double *out_voltage_two);
-  // Defaults to 12v if no voltage is specified.
+// Defaults to 12v if no voltage is specified.
 void VoltageCap(double voltage_one, double voltage_two, double *out_voltage_one,
                 double *out_voltage_two);
 
diff --git a/frc971/input/drivetrain_input.cc b/frc971/input/drivetrain_input.cc
index cefb113..b062ceb 100644
--- a/frc971/input/drivetrain_input.cc
+++ b/frc971/input/drivetrain_input.cc
@@ -1,10 +1,8 @@
 #include "frc971/input/drivetrain_input.h"
 
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 
 #include "aos/commonmath.h"
 #include "aos/logging/logging.h"
diff --git a/frc971/input/drivetrain_input.h b/frc971/input/drivetrain_input.h
index 9e450d5..3419ea7 100644
--- a/frc971/input/drivetrain_input.h
+++ b/frc971/input/drivetrain_input.h
@@ -1,11 +1,9 @@
 #ifndef AOS_INPUT_DRIVETRAIN_INPUT_H_
 #define AOS_INPUT_DRIVETRAIN_INPUT_H_
 
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <memory>
 
 #include "aos/logging/logging.h"
diff --git a/frc971/input/joystick_input.cc b/frc971/input/joystick_input.cc
index c92d567..d0d9bc0 100644
--- a/frc971/input/joystick_input.cc
+++ b/frc971/input/joystick_input.cc
@@ -1,8 +1,7 @@
 #include "frc971/input/joystick_input.h"
 
-#include <string.h>
-
 #include <atomic>
+#include <cstring>
 
 #include "aos/logging/logging.h"
 #include "frc971/input/robot_state_generated.h"
diff --git a/frc971/wpilib/ADIS16448.cc b/frc971/wpilib/ADIS16448.cc
index b104840..b479970 100644
--- a/frc971/wpilib/ADIS16448.cc
+++ b/frc971/wpilib/ADIS16448.cc
@@ -3,9 +3,9 @@
 #include "frc971/wpilib/ahal/InterruptableSensorBase.h"
 #undef ERROR
 
-#include <inttypes.h>
-#include <math.h>
 #include <chrono>
+#include <cinttypes>
+#include <cmath>
 
 #include "aos/init.h"
 #include "aos/time/time.h"
@@ -137,9 +137,9 @@
 
   // NI's SPI driver defaults to SCHED_OTHER.  Find it's PID with ps, and change
   // it to a RT priority of 33.
-  AOS_PCHECK(
-      system("busybox ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs chrt -f -p "
-             "33") == 0);
+  AOS_PCHECK(system("busybox ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | "
+                    "xargs chrt -f -p "
+                    "33") == 0);
 
   event_loop->set_name("IMU");
   event_loop_->SetRuntimeRealtimePriority(33);
diff --git a/frc971/wpilib/ADIS16448.h b/frc971/wpilib/ADIS16448.h
index 59f9aa8..6d5eb28 100644
--- a/frc971/wpilib/ADIS16448.h
+++ b/frc971/wpilib/ADIS16448.h
@@ -1,9 +1,8 @@
 #ifndef FRC971_WPILIB_ADIS16448_H_
 #define FRC971_WPILIB_ADIS16448_H_
 
-#include <stdint.h>
-
 #include <atomic>
+#include <cstdint>
 #include <memory>
 
 #include "frc971/wpilib/ahal/DigitalInput.h"
diff --git a/frc971/wpilib/ADIS16470.cc b/frc971/wpilib/ADIS16470.cc
index 8a56d96..151f3e0 100644
--- a/frc971/wpilib/ADIS16470.cc
+++ b/frc971/wpilib/ADIS16470.cc
@@ -1,11 +1,10 @@
 #include "frc971/wpilib/ADIS16470.h"
 
-#include <inttypes.h>
-
-#include "glog/logging.h"
+#include <cinttypes>
 
 #include "aos/containers/sized_array.h"
 #include "aos/time/time.h"
+#include "glog/logging.h"
 #include "hal/HAL.h"
 
 namespace frc971 {
@@ -139,23 +138,39 @@
 // position because we don't care if it's one cycle stale.
 constexpr uint8_t kAutospiPacket[] = {
     // X
-    registers::X_GYRO_OUT, 0,
-    registers::X_ACCL_OUT, 0, registers::X_ACCL_LOW, 0,
+    registers::X_GYRO_OUT,
+    0,
+    registers::X_ACCL_OUT,
+    0,
+    registers::X_ACCL_LOW,
+    0,
     // Y
-    registers::Y_GYRO_OUT, 0,
-    registers::Y_ACCL_OUT, 0, registers::Y_ACCL_LOW, 0,
+    registers::Y_GYRO_OUT,
+    0,
+    registers::Y_ACCL_OUT,
+    0,
+    registers::Y_ACCL_LOW,
+    0,
     // Z
-    registers::Z_GYRO_OUT, 0,
-    registers::Z_ACCL_OUT, 0, registers::Z_ACCL_LOW, 0,
+    registers::Z_GYRO_OUT,
+    0,
+    registers::Z_ACCL_OUT,
+    0,
+    registers::Z_ACCL_LOW,
+    0,
     // Other
-    registers::TEMP_OUT, 0, registers::DIAG_STAT, 0,
+    registers::TEMP_OUT,
+    0,
+    registers::DIAG_STAT,
+    0,
 };
 // clang-format on
 
 static_assert((sizeof(kAutospiPacket) % 2) == 0,
               "Need a whole number of register reads");
 
-static constexpr size_t kAutospiDataSize = sizeof(kAutospiPacket) + 1 /* timestamp */;
+static constexpr size_t kAutospiDataSize =
+    sizeof(kAutospiPacket) + 1 /* timestamp */;
 
 // radian/second/LSB for the gyros (for just the 16-bit value).
 constexpr double kGyroLsbRadianSecond =
@@ -195,12 +210,12 @@
 
   // NI's SPI driver defaults to SCHED_OTHER.  Find it's PID with ps, and change
   // it to a RT priority of 33.
-  PCHECK(
-      system("busybox ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs chrt -f -p "
-             "33") == 0);
-  PCHECK(
-      system("busybox ps -ef | grep '\\[spi1\\]' | awk '{print $1}' | xargs chrt -f -p "
-             "33") == 0);
+  PCHECK(system("busybox ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs "
+                "chrt -f -p "
+                "33") == 0);
+  PCHECK(system("busybox ps -ef | grep '\\[spi1\\]' | awk '{print $1}' | xargs "
+                "chrt -f -p "
+                "33") == 0);
 
   event_loop_->OnRun([this]() { BeginInitialization(); });
 }
@@ -271,8 +286,7 @@
       // margin on top of that.
       initialize_timer_->Setup(event_loop_->monotonic_now() +
                                chrono::milliseconds(250));
-    }
-    break;
+    } break;
 
     case State::kWaitForReset: {
       flatbuffers::Offset<ADIS16470DiagStat> start_diag_stat;
@@ -326,7 +340,7 @@
                 1 /* toggle CS every 2 8-bit bytes */);
 
             // Read any data queued up by the FPGA.
-            while (true){
+            while (true) {
               uint32_t buffer;
               if (spi_->ReadAutoReceivedData(&buffer, 1, 0 /* don't block */) ==
                   0) {
@@ -380,8 +394,7 @@
       } else {
         BeginInitialization();
       }
-    }
-    break;
+    } break;
 
     case State::kRunning:
       LOG(FATAL) << "Not a reset state";
diff --git a/frc971/wpilib/ahal/ControllerPower.cc b/frc971/wpilib/ahal/ControllerPower.cc
index 9637d17..413f324 100644
--- a/frc971/wpilib/ahal/ControllerPower.cc
+++ b/frc971/wpilib/ahal/ControllerPower.cc
@@ -7,11 +7,11 @@
 
 #include "frc971/wpilib/ahal/ControllerPower.h"
 
-#include <stdint.h>
+#include <cstdint>
 
+#include "frc971/wpilib/ahal/ErrorBase.h"
 #include "hal/HAL.h"
 #include "hal/Power.h"
-#include "frc971/wpilib/ahal/ErrorBase.h"
 
 using namespace frc;
 
diff --git a/frc971/wpilib/ahal/CounterBase.h b/frc971/wpilib/ahal/CounterBase.h
index 868dbe6..553575f 100644
--- a/frc971/wpilib/ahal/CounterBase.h
+++ b/frc971/wpilib/ahal/CounterBase.h
@@ -7,7 +7,7 @@
 
 #pragma once
 
-#include <stdint.h>
+#include <cstdint>
 
 namespace frc {
 
diff --git a/frc971/wpilib/ahal/DigitalInput.h b/frc971/wpilib/ahal/DigitalInput.h
index 2053e4e..cd26773 100644
--- a/frc971/wpilib/ahal/DigitalInput.h
+++ b/frc971/wpilib/ahal/DigitalInput.h
@@ -7,8 +7,7 @@
 
 #pragma once
 
-#include <stdint.h>
-
+#include <cstdint>
 #include <memory>
 #include <string>
 
diff --git a/frc971/wpilib/ahal/SPI.h b/frc971/wpilib/ahal/SPI.h
index d7c6b95..1d439b2 100644
--- a/frc971/wpilib/ahal/SPI.h
+++ b/frc971/wpilib/ahal/SPI.h
@@ -7,14 +7,13 @@
 
 #pragma once
 
-#include <stdint.h>
-
-#include <memory>
-
 #include <hal/SPITypes.h>
 #include <wpi/ArrayRef.h>
 #include <wpi/deprecated.h>
 
+#include <cstdint>
+#include <memory>
+
 namespace frc {
 
 class DigitalSource;
@@ -39,8 +38,8 @@
 
   ~SPI();
 
-  SPI(SPI&&) = default;
-  SPI& operator=(SPI&&) = default;
+  SPI(SPI &&) = default;
+  SPI &operator=(SPI &&) = default;
 
   /**
    * Configure the rate of the generated clock signal.
@@ -119,7 +118,7 @@
    * If not running in output only mode, also saves the data received
    * on the MISO input during the transfer into the receive FIFO.
    */
-  virtual int Write(uint8_t* data, int size);
+  virtual int Write(uint8_t *data, int size);
 
   /**
    * Read a word from the receive FIFO.
@@ -134,7 +133,7 @@
    *                 that data is already in the receive FIFO from a previous
    *                 write.
    */
-  virtual int Read(bool initiate, uint8_t* dataReceived, int size);
+  virtual int Read(bool initiate, uint8_t *dataReceived, int size);
 
   /**
    * Perform a simultaneous read/write transaction with the device
@@ -143,7 +142,7 @@
    * @param dataReceived Buffer to receive data from the device
    * @param size         The length of the transaction, in bytes
    */
-  virtual int Transaction(uint8_t* dataToSend, uint8_t* dataReceived, int size);
+  virtual int Transaction(uint8_t *dataToSend, uint8_t *dataReceived, int size);
 
   /**
    * Initialize automatic SPI transfer engine.
@@ -191,7 +190,7 @@
    * @param rising trigger on the rising edge
    * @param falling trigger on the falling edge
    */
-  void StartAutoTrigger(DigitalSource& source, bool rising, bool falling);
+  void StartAutoTrigger(DigitalSource &source, bool rising, bool falling);
 
   /**
    * Stop running the automatic SPI transfer engine.
@@ -222,7 +221,7 @@
    * @param timeout timeout in seconds (ms resolution)
    * @return Number of words remaining to be read
    */
-  int ReadAutoReceivedData(uint32_t* buffer, int numToRead, double timeout);
+  int ReadAutoReceivedData(uint32_t *buffer, int numToRead, double timeout);
 
   /**
    * Get the number of bytes dropped by the automatic SPI transfer engine due
diff --git a/frc971/wpilib/ahal/SensorBase.h b/frc971/wpilib/ahal/SensorBase.h
index 1d95330..a4de9cc 100644
--- a/frc971/wpilib/ahal/SensorBase.h
+++ b/frc971/wpilib/ahal/SensorBase.h
@@ -7,7 +7,7 @@
 
 #pragma once
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "frc971/wpilib/ahal/ErrorBase.h"
 
diff --git a/frc971/wpilib/ahal/Utility.h b/frc971/wpilib/ahal/Utility.h
index be8dc35..196dfce 100644
--- a/frc971/wpilib/ahal/Utility.h
+++ b/frc971/wpilib/ahal/Utility.h
@@ -11,8 +11,7 @@
  * Contains global utility functions
  */
 
-#include <stdint.h>
-
+#include <cstdint>
 #include <string>
 
 #include "wpi/StringRef.h"
diff --git a/frc971/wpilib/ahal/WPIErrors.h b/frc971/wpilib/ahal/WPIErrors.h
index da72d00..482240c 100644
--- a/frc971/wpilib/ahal/WPIErrors.h
+++ b/frc971/wpilib/ahal/WPIErrors.h
@@ -7,7 +7,7 @@
 
 #pragma once
 
-#include <stdint.h>
+#include <cstdint>
 
 #ifdef WPI_ERRORS_DEFINE_STRINGS
 #define S(label, offset, message)            \
diff --git a/frc971/wpilib/buffered_pcm.cc b/frc971/wpilib/buffered_pcm.cc
index 3123add..7f6cb37 100644
--- a/frc971/wpilib/buffered_pcm.cc
+++ b/frc971/wpilib/buffered_pcm.cc
@@ -1,6 +1,6 @@
 #include "frc971/wpilib/buffered_pcm.h"
 
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "aos/logging/logging.h"
 #include "hal/HAL.h"
diff --git a/frc971/wpilib/dma.cc b/frc971/wpilib/dma.cc
index b990532..432b77b 100644
--- a/frc971/wpilib/dma.cc
+++ b/frc971/wpilib/dma.cc
@@ -1,8 +1,7 @@
 #include "frc971/wpilib/dma.h"
 
-#include <string.h>
-
 #include <algorithm>
+#include <cstring>
 #include <type_traits>
 
 #include "frc971/wpilib/ahal/AnalogInput.h"
@@ -333,9 +332,7 @@
 #endif
 }
 
-uint64_t DMASample::GetTime() const {
-  return fpga_timestamp_;
-}
+uint64_t DMASample::GetTime() const { return fpga_timestamp_; }
 
 double DMASample::GetTimestamp() const {
   return static_cast<double>(GetTime()) * 0.000001;
diff --git a/frc971/wpilib/dma.h b/frc971/wpilib/dma.h
index 6d82af8..46e1f71 100644
--- a/frc971/wpilib/dma.h
+++ b/frc971/wpilib/dma.h
@@ -4,9 +4,8 @@
 // Interface to the roboRIO FPGA's DMA features.
 // TODO(Brian): Make this less wpilib-like and more frc971-like.
 
-#include <stdint.h>
-
 #include <array>
+#include <cstdint>
 #include <memory>
 
 #include "hal/ChipObject.h"
diff --git a/frc971/wpilib/gyro_interface.cc b/frc971/wpilib/gyro_interface.cc
index eeacfce..7ed24b7 100644
--- a/frc971/wpilib/gyro_interface.cc
+++ b/frc971/wpilib/gyro_interface.cc
@@ -1,7 +1,7 @@
 #include "frc971/wpilib/gyro_interface.h"
 
-#include <inttypes.h>
 #include <chrono>
+#include <cinttypes>
 
 #include "aos/logging/logging.h"
 #include "aos/time/time.h"
diff --git a/frc971/wpilib/gyro_sender.cc b/frc971/wpilib/gyro_sender.cc
index 3061c3b..9f25d04 100644
--- a/frc971/wpilib/gyro_sender.cc
+++ b/frc971/wpilib/gyro_sender.cc
@@ -1,11 +1,11 @@
 #include "frc971/wpilib/gyro_sender.h"
 
 #include <fcntl.h>
-#include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
 #include <chrono>
+#include <cinttypes>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/frc971/wpilib/gyro_sender.h b/frc971/wpilib/gyro_sender.h
index 91257c9..4abfeaa 100644
--- a/frc971/wpilib/gyro_sender.h
+++ b/frc971/wpilib/gyro_sender.h
@@ -1,9 +1,8 @@
 #ifndef FRC971_WPILIB_GYRO_H_
 #define FRC971_WPILIB_GYRO_H_
 
-#include <stdint.h>
-
 #include <atomic>
+#include <cstdint>
 
 #include "aos/events/event_loop.h"
 #include "aos/events/shm_event_loop.h"
diff --git a/frc971/wpilib/sensor_reader.cc b/frc971/wpilib/sensor_reader.cc
index dea4760..d8377d8 100644
--- a/frc971/wpilib/sensor_reader.cc
+++ b/frc971/wpilib/sensor_reader.cc
@@ -1,8 +1,9 @@
 #include "frc971/wpilib/sensor_reader.h"
 
-#include <inttypes.h>
 #include <unistd.h>
 
+#include <cinttypes>
+
 #include "aos/init.h"
 #include "aos/logging/logging.h"
 #include "aos/util/compiler_memory_barrier.h"
diff --git a/frc971/wpilib/spi_rx_clearer.cc b/frc971/wpilib/spi_rx_clearer.cc
index 245f073..1faa3f6 100644
--- a/frc971/wpilib/spi_rx_clearer.cc
+++ b/frc971/wpilib/spi_rx_clearer.cc
@@ -1,10 +1,11 @@
 #include "frc971/wpilib/spi_rx_clearer.h"
 
 #include <fcntl.h>
-#include <inttypes.h>
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <cinttypes>
+
 #include "aos/logging/logging.h"
 
 namespace frc971 {
diff --git a/frc971/wpilib/spi_rx_clearer.h b/frc971/wpilib/spi_rx_clearer.h
index 17936ab..e385d21 100644
--- a/frc971/wpilib/spi_rx_clearer.h
+++ b/frc971/wpilib/spi_rx_clearer.h
@@ -1,7 +1,7 @@
 #ifndef FRC971_WPILIB_SPI_RX_CLEARER_H_
 #define FRC971_WPILIB_SPI_RX_CLEARER_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 namespace frc971 {
 namespace wpilib {
@@ -38,4 +38,4 @@
 }  // namespace wpilib
 }  // namespace frc971
 
-#endif // FRC971_WPILIB_SPI_RX_CLEARER_H_
+#endif  // FRC971_WPILIB_SPI_RX_CLEARER_H_
diff --git a/frc971/wpilib/wpilib_interface.h b/frc971/wpilib/wpilib_interface.h
index 8ab92ef..b992aa3 100644
--- a/frc971/wpilib/wpilib_interface.h
+++ b/frc971/wpilib/wpilib_interface.h
@@ -1,7 +1,7 @@
 #ifndef FRC971_WPILIB_WPILIB_INTERFACE_H_
 #define FRC971_WPILIB_WPILIB_INTERFACE_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "aos/events/event_loop.h"
 #include "frc971/input/robot_state_generated.h"
diff --git a/frc971/zeroing/averager.h b/frc971/zeroing/averager.h
index 23a1b06..0e15d13 100644
--- a/frc971/zeroing/averager.h
+++ b/frc971/zeroing/averager.h
@@ -3,7 +3,7 @@
 
 #include <algorithm>
 #include <array>
-#include <stdint.h>
+#include <cstdint>
 
 #include "Eigen/Dense"
 #include "glog/logging.h"