mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
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:
@@ -26,7 +26,7 @@ const uint32_t DriverStation::kBatteryChannel;
|
||||
const uint32_t DriverStation::kJoystickPorts;
|
||||
const uint32_t DriverStation::kJoystickAxes;
|
||||
constexpr float DriverStation::kUpdatePeriod;
|
||||
DriverStation* DriverStation::m_instance = NULL;
|
||||
DriverStation* DriverStation::m_instance = nullptr;
|
||||
uint8_t DriverStation::m_updateNumber = 0;
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ DriverStation::DriverStation()
|
||||
|
||||
DriverStation::~DriverStation()
|
||||
{
|
||||
m_instance = NULL;
|
||||
m_instance = nullptr;
|
||||
deleteMultiWait(m_waitForDataSem);
|
||||
deleteMutex(m_waitForDataMutex);
|
||||
// TODO: Release m_stateSemaphore and m_joystickSemaphore?
|
||||
@@ -88,7 +88,7 @@ DriverStation::~DriverStation()
|
||||
*/
|
||||
DriverStation* DriverStation::GetInstance()
|
||||
{
|
||||
if (m_instance == NULL)
|
||||
if (m_instance == nullptr)
|
||||
{
|
||||
m_instance = new DriverStation();
|
||||
}
|
||||
@@ -126,7 +126,7 @@ float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis)
|
||||
return 0.0;
|
||||
}
|
||||
CRITICAL_REGION(m_joystickSemaphore)
|
||||
if (joysticks[stick] == NULL || axis >= joysticks[stick]->axes().size())
|
||||
if (joysticks[stick] == nullptr || axis >= joysticks[stick]->axes().size())
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ bool DriverStation::GetStickButton(uint32_t stick, uint32_t button)
|
||||
return false;
|
||||
}
|
||||
CRITICAL_REGION(m_joystickSemaphore)
|
||||
if (joysticks[stick] == NULL || button >= joysticks[stick]->buttons().size())
|
||||
if (joysticks[stick] == nullptr || button >= joysticks[stick]->buttons().size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ bool DriverStation::GetDigitalOut(uint32_t channel)
|
||||
bool DriverStation::IsEnabled() const
|
||||
{
|
||||
CRITICAL_REGION(m_stateSemaphore)
|
||||
return state != NULL ? state->enabled() : false;
|
||||
return state != nullptr ? state->enabled() : false;
|
||||
END_REGION
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ bool DriverStation::IsDisabled() const
|
||||
bool DriverStation::IsAutonomous() const
|
||||
{
|
||||
CRITICAL_REGION(m_stateSemaphore)
|
||||
return state != NULL ?
|
||||
return state != nullptr ?
|
||||
state->state() == msgs::DriverStation_State_AUTO : false;
|
||||
END_REGION;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ bool DriverStation::IsOperatorControl() const
|
||||
bool DriverStation::IsTest() const
|
||||
{
|
||||
CRITICAL_REGION(m_stateSemaphore)
|
||||
return state != NULL ?
|
||||
return state != nullptr ?
|
||||
state->state() == msgs::DriverStation_State_TEST : false;
|
||||
END_REGION;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user