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

@@ -9,10 +9,10 @@
#include "Utility.h"
#include "WPIErrors.h"
Resource *InterruptableSensorBase::m_interrupts = NULL;
Resource *InterruptableSensorBase::m_interrupts = nullptr;
InterruptableSensorBase::InterruptableSensorBase() {
m_interrupt = NULL;
m_interrupt = nullptr;
Resource::CreateResourceObject(&m_interrupts, interrupt_kNumSystems);
}
@@ -74,7 +74,7 @@ void InterruptableSensorBase::RequestInterrupts() {
}
void InterruptableSensorBase::AllocateInterrupts(bool watcher) {
wpi_assert(m_interrupt == NULL);
wpi_assert(m_interrupt == nullptr);
// Expects the calling leaf class to allocate an interrupt index.
int32_t status = 0;
m_interrupt = initializeInterrupts(m_interruptIndex, watcher, &status);
@@ -87,11 +87,11 @@ void InterruptableSensorBase::AllocateInterrupts(bool watcher) {
*/
void InterruptableSensorBase::CancelInterrupts() {
if (StatusIsFatal()) return;
wpi_assert(m_interrupt != NULL);
wpi_assert(m_interrupt != nullptr);
int32_t status = 0;
cleanInterrupts(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
m_interrupt = NULL;
m_interrupt = nullptr;
m_interrupts->Free(m_interruptIndex);
}
@@ -109,7 +109,7 @@ void InterruptableSensorBase::CancelInterrupts() {
InterruptableSensorBase::WaitResult InterruptableSensorBase::WaitForInterrupt(
float timeout, bool ignorePrevious) {
if (StatusIsFatal()) return InterruptableSensorBase::kTimeout;
wpi_assert(m_interrupt != NULL);
wpi_assert(m_interrupt != nullptr);
int32_t status = 0;
uint32_t result;
@@ -127,7 +127,7 @@ InterruptableSensorBase::WaitResult InterruptableSensorBase::WaitForInterrupt(
*/
void InterruptableSensorBase::EnableInterrupts() {
if (StatusIsFatal()) return;
wpi_assert(m_interrupt != NULL);
wpi_assert(m_interrupt != nullptr);
int32_t status = 0;
enableInterrupts(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
@@ -138,7 +138,7 @@ void InterruptableSensorBase::EnableInterrupts() {
*/
void InterruptableSensorBase::DisableInterrupts() {
if (StatusIsFatal()) return;
wpi_assert(m_interrupt != NULL);
wpi_assert(m_interrupt != nullptr);
int32_t status = 0;
disableInterrupts(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
@@ -153,7 +153,7 @@ void InterruptableSensorBase::DisableInterrupts() {
*/
double InterruptableSensorBase::ReadRisingTimestamp() {
if (StatusIsFatal()) return 0.0;
wpi_assert(m_interrupt != NULL);
wpi_assert(m_interrupt != nullptr);
int32_t status = 0;
double timestamp = readRisingTimestamp(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
@@ -169,7 +169,7 @@ double InterruptableSensorBase::ReadRisingTimestamp() {
*/
double InterruptableSensorBase::ReadFallingTimestamp() {
if (StatusIsFatal()) return 0.0;
wpi_assert(m_interrupt != NULL);
wpi_assert(m_interrupt != nullptr);
int32_t status = 0;
double timestamp = readFallingTimestamp(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
@@ -187,13 +187,13 @@ double InterruptableSensorBase::ReadFallingTimestamp() {
void InterruptableSensorBase::SetUpSourceEdge(bool risingEdge,
bool fallingEdge) {
if (StatusIsFatal()) return;
if (m_interrupt == NULL) {
if (m_interrupt == nullptr) {
wpi_setWPIErrorWithContext(
NullParameter,
"You must call RequestInterrupts before SetUpSourceEdge");
return;
}
if (m_interrupt != NULL) {
if (m_interrupt != nullptr) {
int32_t status = 0;
setInterruptUpSourceEdge(m_interrupt, risingEdge, fallingEdge, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));