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

@@ -31,7 +31,7 @@
* or be double (2x) the spec'd count.
*/
void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
m_table = NULL;
m_table = nullptr;
m_encodingType = encodingType;
m_index = 0;
switch (encodingType) {
@@ -53,7 +53,7 @@ void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
m_bSource->GetAnalogTriggerForRouting(), reverseDirection, &m_index,
&status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
m_counter = NULL;
m_counter = nullptr;
SetMaxPeriod(.5);
break;
}
@@ -102,7 +102,7 @@ void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType) {
*/
Encoder::Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection,
EncodingType encodingType)
: m_encoder(NULL), m_counter(NULL) {
: m_encoder(nullptr), m_counter(nullptr) {
m_aSource = new DigitalInput(aChannel);
m_bSource = new DigitalInput(bChannel);
InitEncoder(reverseDirection, encodingType);
@@ -137,12 +137,12 @@ Encoder::Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection,
*/
Encoder::Encoder(DigitalSource *aSource, DigitalSource *bSource,
bool reverseDirection, EncodingType encodingType)
: m_encoder(NULL), m_counter(NULL) {
: m_encoder(nullptr), m_counter(nullptr) {
m_aSource = aSource;
m_bSource = bSource;
m_allocatedASource = false;
m_allocatedBSource = false;
if (m_aSource == NULL || m_bSource == NULL)
if (m_aSource == nullptr || m_bSource == nullptr)
wpi_setWPIError(NullParameter);
else
InitEncoder(reverseDirection, encodingType);
@@ -175,7 +175,7 @@ Encoder::Encoder(DigitalSource *aSource, DigitalSource *bSource,
*/
Encoder::Encoder(DigitalSource &aSource, DigitalSource &bSource,
bool reverseDirection, EncodingType encodingType)
: m_encoder(NULL), m_counter(NULL) {
: m_encoder(nullptr), m_counter(nullptr) {
m_aSource = &aSource;
m_bSource = &bSource;
m_allocatedASource = false;
@@ -555,7 +555,7 @@ void Encoder::SetIndexSource(DigitalSource &source,
}
void Encoder::UpdateTable() {
if (m_table != NULL) {
if (m_table != nullptr) {
m_table->PutNumber("Speed", GetRate());
m_table->PutNumber("Distance", GetDistance());
m_table->PutNumber("Distance per Tick", m_distancePerPulse);