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/y2019/jevois/camera/reader.cc b/y2019/jevois/camera/reader.cc
index 14faa24..259e650 100644
--- a/y2019/jevois/camera/reader.cc
+++ b/y2019/jevois/camera/reader.cc
@@ -1,17 +1,18 @@
#include "y2019/jevois/camera/reader.h"
-#include <errno.h>
#include <fcntl.h>
#include <malloc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
#include "aos/time/time.h"
#include "glog/logging.h"
diff --git a/y2019/jevois/camera/reader.h b/y2019/jevois/camera/reader.h
index c5498fe..ef4f34d 100644
--- a/y2019/jevois/camera/reader.h
+++ b/y2019/jevois/camera/reader.h
@@ -1,7 +1,7 @@
#ifndef AOS_VISION_IMAGE_READER_H_
#define AOS_VISION_IMAGE_READER_H_
-#include <inttypes.h>
+#include <cinttypes>
#include <functional>
#include <string>
diff --git a/y2019/jevois/cobs.h b/y2019/jevois/cobs.h
index 0e92ed6..75761c9 100644
--- a/y2019/jevois/cobs.h
+++ b/y2019/jevois/cobs.h
@@ -1,10 +1,9 @@
#ifndef Y2019_JEVOIS_COBS_H_
#define Y2019_JEVOIS_COBS_H_
-#include <stdint.h>
-
#include <algorithm>
#include <array>
+#include <cstdint>
#include "third_party/GSL/include/gsl/gsl"
diff --git a/y2019/jevois/spi.h b/y2019/jevois/spi.h
index 8b16d5c..59e321a 100644
--- a/y2019/jevois/spi.h
+++ b/y2019/jevois/spi.h
@@ -1,12 +1,11 @@
#ifndef Y2019_JEVOIS_SPI_H_
#define Y2019_JEVOIS_SPI_H_
-#include <stdint.h>
-
#include <array>
+#include <cstdint>
+#include <optional>
#include "third_party/GSL/include/gsl/gsl"
-#include <optional>
#include "y2019/jevois/structures.h"
// This file manages serializing and deserializing the various structures for
diff --git a/y2019/jevois/spi_test.cc b/y2019/jevois/spi_test.cc
index 84938f0..c600869 100644
--- a/y2019/jevois/spi_test.cc
+++ b/y2019/jevois/spi_test.cc
@@ -1,6 +1,6 @@
#include "y2019/jevois/spi.h"
-#include <stdint.h>
+#include <cstdint>
#include "gtest/gtest.h"
diff --git a/y2019/jevois/structures.h b/y2019/jevois/structures.h
index fcf1ebe..b4bd755 100644
--- a/y2019/jevois/structures.h
+++ b/y2019/jevois/structures.h
@@ -1,14 +1,12 @@
#ifndef Y2019_JEVOIS_STRUCTURES_H_
#define Y2019_JEVOIS_STRUCTURES_H_
-#include <stdint.h>
-
#include <array>
#include <bitset>
#include <chrono>
+#include <cstdint>
#include "Eigen/Dense"
-
#include "aos/containers/sized_array.h"
#include "aos/time/time.h"
#include "third_party/GSL/include/gsl/gsl"
@@ -58,9 +56,7 @@
}
return true;
}
- bool operator!=(const Target &other) const {
- return !(*this == other);
- }
+ bool operator!=(const Target &other) const { return !(*this == other); }
// Distance to the target in meters. Specifically, the distance from the
// center of the camera's image plane to the center of the target.
@@ -95,9 +91,7 @@
}
return true;
}
- bool operator!=(const CameraFrame &other) const {
- return !(*this == other);
- }
+ bool operator!=(const CameraFrame &other) const { return !(*this == other); }
// The top most interesting targets found in this frame.
aos::SizedArray<Target, 3> targets;
@@ -120,9 +114,7 @@
}
return true;
}
- bool operator!=(const RoborioFrame &other) const {
- return !(*this == other);
- }
+ bool operator!=(const RoborioFrame &other) const { return !(*this == other); }
// The top most interesting targets found in this frame.
aos::SizedArray<Target, 3> targets;
diff --git a/y2019/jevois/teensy.cc b/y2019/jevois/teensy.cc
index 4da89a8..038ece9 100644
--- a/y2019/jevois/teensy.cc
+++ b/y2019/jevois/teensy.cc
@@ -1,6 +1,5 @@
-#include <inttypes.h>
-#include <stdio.h>
-
+#include <cinttypes>
+#include <cstdio>
#include <optional>
#include "aos/time/time.h"
@@ -17,8 +16,8 @@
#include "y2019/jevois/uart.h"
#include "y2019/vision/constants.h"
-using frc971::teensy::InterruptBufferedUart;
using frc971::teensy::InterruptBufferedSpi;
+using frc971::teensy::InterruptBufferedUart;
// All indices here refer to the ports as numbered on the PCB.
@@ -126,7 +125,8 @@
}
const auto now = aos::monotonic_clock::now();
if (TransferTimedOut(now)) {
- printf("SPI timeout with %d left\n", static_cast<int>(to_receive_.size()));
+ printf("SPI timeout with %d left\n",
+ static_cast<int>(to_receive_.size()));
WaitForNextTransfer();
return std::nullopt;
}
@@ -138,7 +138,8 @@
}
}
if (DeassertHappened(now)) {
- printf("CS deasserted with %d left\n", static_cast<int>(to_receive_.size()));
+ printf("CS deasserted with %d left\n",
+ static_cast<int>(to_receive_.size()));
WaitForNextTransfer();
return std::nullopt;
}
@@ -441,9 +442,7 @@
global_spi_instance->HandleInterrupt(disable_interrupts);
}
-void porta_isr(void) {
- SpiQueue::global_instance->HandleInterrupt();
-}
+void porta_isr(void) { SpiQueue::global_instance->HandleInterrupt(); }
} // extern "C"
@@ -1016,9 +1015,7 @@
extern "C" {
-int main(void) {
- return Main();
-}
+int main(void) { return Main(); }
} // extern "C"
diff --git a/y2019/jevois/uart_test.cc b/y2019/jevois/uart_test.cc
index 4f58e73..ff02f08 100644
--- a/y2019/jevois/uart_test.cc
+++ b/y2019/jevois/uart_test.cc
@@ -1,6 +1,6 @@
#include "y2019/jevois/uart.h"
-#include <stdint.h>
+#include <cstdint>
#include "gtest/gtest.h"