Added std:: prefix to more C standard library uses (#106)

This commit is contained in:
Tyler Veness
2016-06-19 00:19:45 -07:00
committed by Peter Johnson
parent daa0260a4e
commit cee9b2609d
14 changed files with 69 additions and 68 deletions

View File

@@ -33,7 +33,7 @@ void AnalogGyro::InitAnalogGyro(int channel) {
SetPIDSourceType(PIDSourceType::kDisplacement);
char buffer[50];
int n = sprintf(buffer, "analog/%d", channel);
int n = std::sprintf(buffer, "analog/%d", channel);
impl = new SimGyro(buffer);
LiveWindow::GetInstance()->AddSensor("AnalogGyro", channel, this);

View File

@@ -20,7 +20,7 @@
AnalogInput::AnalogInput(uint32_t channel) {
m_channel = channel;
char buffer[50];
int n = sprintf(buffer, "analog/%d", channel);
int n = std::sprintf(buffer, "analog/%d", channel);
m_impl = new SimFloatInput(buffer);
LiveWindow::GetInstance()->AddSensor("AnalogInput", channel, this);

View File

@@ -20,7 +20,7 @@
DigitalInput::DigitalInput(uint32_t channel) {
char buf[64];
m_channel = channel;
int n = sprintf(buf, "dio/%d", channel);
int n = std::sprintf(buf, "dio/%d", channel);
m_impl = new SimDigitalInput(buf);
}

View File

@@ -36,8 +36,8 @@ DoubleSolenoid::DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel,
m_reversed = true;
}
char buffer[50];
int n = sprintf(buffer, "pneumatic/%d/%d/%d/%d", moduleNumber, forwardChannel,
moduleNumber, reverseChannel);
int n = std::sprintf(buffer, "pneumatic/%d/%d/%d/%d", moduleNumber,
forwardChannel, moduleNumber, reverseChannel);
m_impl = new SimContinuousOutput(buffer);
LiveWindow::GetInstance()->AddActuator("DoubleSolenoid", moduleNumber,

View File

@@ -52,7 +52,7 @@ void Encoder::InitEncoder(int32_t channelA, int32_t channelB,
m_reverseDirection = reverseDirection;
}
char buffer[50];
int n = sprintf(buffer, "dio/%d/%d", channelA, channelB);
int n = std::sprintf(buffer, "dio/%d/%d", channelA, channelB);
impl = new SimEncoder(buffer);
impl->Start();
}

View File

@@ -177,7 +177,7 @@ bool IterativeRobot::NextPeriodReady() {
* exactly 1 time.
*/
void IterativeRobot::RobotInit() {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
}
/**
@@ -187,7 +187,7 @@ void IterativeRobot::RobotInit() {
* called each time the robot enters disabled mode.
*/
void IterativeRobot::DisabledInit() {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
}
/**
@@ -197,7 +197,7 @@ void IterativeRobot::DisabledInit() {
* called each time the robot enters autonomous mode.
*/
void IterativeRobot::AutonomousInit() {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
}
/**
@@ -207,7 +207,7 @@ void IterativeRobot::AutonomousInit() {
* called each time the robot enters teleop mode.
*/
void IterativeRobot::TeleopInit() {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
}
/**
@@ -217,7 +217,7 @@ void IterativeRobot::TeleopInit() {
* called each time the robot enters test mode.
*/
void IterativeRobot::TestInit() {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
}
/**
@@ -229,7 +229,7 @@ void IterativeRobot::TestInit() {
void IterativeRobot::DisabledPeriodic() {
static bool firstRun = true;
if (firstRun) {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
firstRun = false;
}
}
@@ -243,7 +243,7 @@ void IterativeRobot::DisabledPeriodic() {
void IterativeRobot::AutonomousPeriodic() {
static bool firstRun = true;
if (firstRun) {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
firstRun = false;
}
}
@@ -257,7 +257,7 @@ void IterativeRobot::AutonomousPeriodic() {
void IterativeRobot::TeleopPeriodic() {
static bool firstRun = true;
if (firstRun) {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
firstRun = false;
}
}
@@ -271,7 +271,7 @@ void IterativeRobot::TeleopPeriodic() {
void IterativeRobot::TestPeriodic() {
static bool firstRun = true;
if (firstRun) {
printf("Default %s() method... Overload me!\n", __FUNCTION__);
std::printf("Default %s() method... Overload me!\n", __FUNCTION__);
firstRun = false;
}
}

View File

@@ -29,12 +29,12 @@ PWM::PWM(uint32_t channel) {
char buf[64];
if (!CheckPWMChannel(channel)) {
snprintf(buf, 64, "PWM Channel %d", channel);
std::snprintf(buf, 64, "PWM Channel %d", channel);
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf);
return;
}
sprintf(buf, "pwm/%d", channel);
std::sprintf(buf, "pwm/%d", channel);
impl = new SimContinuousOutput(buf);
m_channel = channel;
m_eliminateDeadband = false;

View File

@@ -24,7 +24,7 @@ Relay::Relay(uint32_t channel, Relay::Direction direction)
: m_channel(channel), m_direction(direction) {
char buf[64];
if (!SensorBase::CheckRelayChannel(m_channel)) {
snprintf(buf, 64, "Relay Channel %d", m_channel);
std::snprintf(buf, 64, "Relay Channel %d", m_channel);
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf);
return;
}
@@ -32,7 +32,7 @@ Relay::Relay(uint32_t channel, Relay::Direction direction)
m_safetyHelper = std::make_unique<MotorSafetyHelper>(this);
m_safetyHelper->SetSafetyEnabled(false);
sprintf(buf, "relay/%d", m_channel);
std::sprintf(buf, "relay/%d", m_channel);
impl = new SimContinuousOutput(buf); // TODO: Allow two different relays
// (targetting the different halves of a
// relay) to be combined to control one

View File

@@ -28,7 +28,7 @@ Solenoid::Solenoid(uint32_t channel) : Solenoid(1, channel) {}
*/
Solenoid::Solenoid(uint8_t moduleNumber, uint32_t channel) {
char buffer[50];
int n = sprintf(buffer, "pneumatic/%d/%d", moduleNumber, channel);
int n = std::sprintf(buffer, "pneumatic/%d/%d", moduleNumber, channel);
m_impl = new SimContinuousOutput(buffer);
LiveWindow::GetInstance()->AddActuator("Solenoid", moduleNumber, channel,