artf4107: clang-modernize was run on WPILib

Loops were converted to their range-based equivalents, variable types were replaced with auto where the type was already specified on the same line, the override keyword was added, and instances of NULL and assignments of 0 to pointers were replaced with nullptr.

Change-Id: If281e46a2e2e1c37f278d56df9915236d4b2c864
This commit is contained in:
Tyler Veness
2015-06-23 04:49:51 -07:00
parent 7a711a21f9
commit b1befed14f
113 changed files with 604 additions and 618 deletions

View File

@@ -37,10 +37,10 @@ const int32_t RobotDrive::kMaxNumberOfMotors;
* robot drive.
*/
void RobotDrive::InitRobotDrive() {
m_frontLeftMotor = NULL;
m_frontRightMotor = NULL;
m_rearRightMotor = NULL;
m_rearLeftMotor = NULL;
m_frontLeftMotor = nullptr;
m_frontRightMotor = nullptr;
m_rearRightMotor = nullptr;
m_rearLeftMotor = nullptr;
m_sensitivity = 0.5;
m_maxOutput = 1.0;
m_safetyHelper = new MotorSafetyHelper(this);
@@ -105,9 +105,9 @@ RobotDrive::RobotDrive(uint32_t frontLeftMotor, uint32_t rearLeftMotor,
RobotDrive::RobotDrive(SpeedController *leftMotor,
SpeedController *rightMotor) {
InitRobotDrive();
if (leftMotor == NULL || rightMotor == NULL) {
if (leftMotor == nullptr || rightMotor == nullptr) {
wpi_setWPIError(NullParameter);
m_rearLeftMotor = m_rearRightMotor = NULL;
m_rearLeftMotor = m_rearRightMotor = nullptr;
return;
}
m_rearLeftMotor = leftMotor;
@@ -141,8 +141,8 @@ RobotDrive::RobotDrive(SpeedController *frontLeftMotor,
SpeedController *frontRightMotor,
SpeedController *rearRightMotor) {
InitRobotDrive();
if (frontLeftMotor == NULL || rearLeftMotor == NULL ||
frontRightMotor == NULL || rearRightMotor == NULL) {
if (frontLeftMotor == nullptr || rearLeftMotor == nullptr ||
frontRightMotor == nullptr || rearRightMotor == nullptr) {
wpi_setWPIError(NullParameter);
return;
}
@@ -230,7 +230,7 @@ void RobotDrive::Drive(float outputMagnitude, float curve) {
*/
void RobotDrive::TankDrive(GenericHID *leftStick, GenericHID *rightStick,
bool squaredInputs) {
if (leftStick == NULL || rightStick == NULL) {
if (leftStick == nullptr || rightStick == nullptr) {
wpi_setWPIError(NullParameter);
return;
}
@@ -255,7 +255,7 @@ void RobotDrive::TankDrive(GenericHID &leftStick, GenericHID &rightStick,
void RobotDrive::TankDrive(GenericHID *leftStick, uint32_t leftAxis,
GenericHID *rightStick, uint32_t rightAxis,
bool squaredInputs) {
if (leftStick == NULL || rightStick == NULL) {
if (leftStick == nullptr || rightStick == nullptr) {
wpi_setWPIError(NullParameter);
return;
}
@@ -591,13 +591,13 @@ void RobotDrive::HolonomicDrive(float magnitude, float direction,
* @param rightOutput The speed to send to the right side of the robot.
*/
void RobotDrive::SetLeftRightMotorOutputs(float leftOutput, float rightOutput) {
wpi_assert(m_rearLeftMotor != NULL && m_rearRightMotor != NULL);
wpi_assert(m_rearLeftMotor != nullptr && m_rearRightMotor != nullptr);
if (m_frontLeftMotor != NULL)
if (m_frontLeftMotor != nullptr)
m_frontLeftMotor->Set(Limit(leftOutput) * m_maxOutput, m_syncGroup);
m_rearLeftMotor->Set(Limit(leftOutput) * m_maxOutput, m_syncGroup);
if (m_frontRightMotor != NULL)
if (m_frontRightMotor != nullptr)
m_frontRightMotor->Set(-Limit(rightOutput) * m_maxOutput, m_syncGroup);
m_rearRightMotor->Set(-Limit(rightOutput) * m_maxOutput, m_syncGroup);
@@ -734,9 +734,9 @@ void RobotDrive::GetDescription(char *desc) const {
}
void RobotDrive::StopMotor() {
if (m_frontLeftMotor != NULL) m_frontLeftMotor->Disable();
if (m_frontRightMotor != NULL) m_frontRightMotor->Disable();
if (m_rearLeftMotor != NULL) m_rearLeftMotor->Disable();
if (m_rearRightMotor != NULL) m_rearRightMotor->Disable();
if (m_frontLeftMotor != nullptr) m_frontLeftMotor->Disable();
if (m_frontRightMotor != nullptr) m_frontRightMotor->Disable();
if (m_rearLeftMotor != nullptr) m_rearLeftMotor->Disable();
if (m_rearRightMotor != nullptr) m_rearRightMotor->Disable();
m_safetyHelper->Feed();
}