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/y2020/actors/autonomous_actor.cc b/y2020/actors/autonomous_actor.cc
index da64408..794d1e7 100644
--- a/y2020/actors/autonomous_actor.cc
+++ b/y2020/actors/autonomous_actor.cc
@@ -1,8 +1,7 @@
#include "y2020/actors/autonomous_actor.h"
-#include <inttypes.h>
-
#include <chrono>
+#include <cinttypes>
#include <cmath>
#include "aos/logging/logging.h"
@@ -89,10 +88,9 @@
std::placeholders::_1),
SplineDirection::kForward);
} else if (FLAGS_spline_auto) {
- test_spline_ =
- PlanSpline(std::bind(&AutonomousSplines::TestSpline, &auto_splines_,
- std::placeholders::_1),
- SplineDirection::kForward);
+ test_spline_ = PlanSpline(std::bind(&AutonomousSplines::TestSpline,
+ &auto_splines_, std::placeholders::_1),
+ SplineDirection::kForward);
}
}
@@ -305,16 +303,16 @@
}
superstructure::Goal::Builder superstructure_builder =
- builder.MakeBuilder<superstructure::Goal>();
+ builder.MakeBuilder<superstructure::Goal>();
superstructure_builder.add_intake(intake_offset);
superstructure_builder.add_roller_voltage(roller_voltage_);
- superstructure_builder.add_roller_speed_compensation(kRollerSpeedCompensation);
+ superstructure_builder.add_roller_speed_compensation(
+ kRollerSpeedCompensation);
if (!builder.Send(superstructure_builder.Finish())) {
AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
}
-
}
void AutonomousActor::RetractIntake() {
diff --git a/y2020/actors/autonomous_actor_main.cc b/y2020/actors/autonomous_actor_main.cc
index dcd0133..f9decd6 100644
--- a/y2020/actors/autonomous_actor_main.cc
+++ b/y2020/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
diff --git a/y2020/constants.cc b/y2020/constants.cc
index 07d10ee..893613a 100644
--- a/y2020/constants.cc
+++ b/y2020/constants.cc
@@ -1,7 +1,6 @@
#include "y2020/constants.h"
-#include <inttypes.h>
-
+#include <cinttypes>
#include <map>
#if __has_feature(address_sanitizer)
diff --git a/y2020/constants.h b/y2020/constants.h
index 85f9768..77f78f4 100644
--- a/y2020/constants.h
+++ b/y2020/constants.h
@@ -1,10 +1,9 @@
#ifndef y2020_CONSTANTS_H_
#define y2020_CONSTANTS_H_
-#include <math.h>
-#include <stdint.h>
-
#include <array>
+#include <cmath>
+#include <cstdint>
#include "frc971/constants.h"
#include "frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h"
@@ -191,10 +190,11 @@
struct ShotParams {
// Measured in radians
double hood_angle;
- // Angular velocity in radians per second of the slowest (lowest) wheel in the kicker.
- // Positive is shooting the ball.
+ // Angular velocity in radians per second of the slowest (lowest) wheel in
+ // the kicker. Positive is shooting the ball.
double accelerator_power;
- // Angular velocity in radians per seconds of the flywheel. Positive is shooting.
+ // Angular velocity in radians per seconds of the flywheel. Positive is
+ // shooting.
double finisher_power;
static ShotParams BlendY(double coefficient, ShotParams a1, ShotParams a2) {
@@ -207,8 +207,7 @@
};
// { distance_to_target, { hood_angle, accelerator_power, finisher_power }}
- InterpolationTable<ShotParams>
- shot_interpolation_table;
+ InterpolationTable<ShotParams> shot_interpolation_table;
};
// Creates (once) a Values instance for ::aos::network::GetTeamNumber() and
diff --git a/y2020/joystick_reader.cc b/y2020/joystick_reader.cc
index 3e828cf..44d8a42 100644
--- a/y2020/joystick_reader.cc
+++ b/y2020/joystick_reader.cc
@@ -1,8 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
#include <unistd.h>
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
#include "aos/actions/actions.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
diff --git a/y2020/vision/sift/sift971.cc b/y2020/vision/sift/sift971.cc
index 93d71e4..788ae23 100644
--- a/y2020/vision/sift/sift971.cc
+++ b/y2020/vision/sift/sift971.cc
@@ -106,13 +106,13 @@
#include "y2020/vision/sift/sift971.h"
+#include <cstdarg>
#include <iostream>
#include <mutex>
-#include <stdarg.h>
#include <opencv2/core/hal/hal.hpp>
#include <opencv2/imgproc.hpp>
-#include "glog/logging.h"
+#include "glog/logging.h"
#include "y2020/vision/sift/fast_gaussian.h"
using namespace cv;
diff --git a/y2020/wpilib_interface.cc b/y2020/wpilib_interface.cc
index 4e623d6..914c9c6 100644
--- a/y2020/wpilib_interface.cc
+++ b/y2020/wpilib_interface.cc
@@ -1,15 +1,15 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
#include <unistd.h>
#include <array>
#include <chrono>
+#include <cinttypes>
#include <cmath>
+#include <cstdio>
+#include <cstring>
#include <functional>
+#include <memory>
#include <mutex>
#include <thread>
-#include <memory>
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Counter.h"