mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Replaced NULL with nullptr in C++ source files (#70)
This commit is contained in:
committed by
Peter Johnson
parent
8566878af4
commit
e9718fc7bf
@@ -261,7 +261,7 @@ void HALNetworkCommunicationObserveUserProgramTeleop();
|
||||
void HALNetworkCommunicationObserveUserProgramTest();
|
||||
|
||||
uint32_t HALReport(uint8_t resource, uint8_t instanceNumber,
|
||||
uint8_t context = 0, const char* feature = NULL);
|
||||
uint8_t context = 0, const char* feature = nullptr);
|
||||
}
|
||||
|
||||
// TODO: HACKS for now...
|
||||
|
||||
@@ -35,8 +35,8 @@ struct AnalogPort {
|
||||
|
||||
static bool analogSampleRateSet = false;
|
||||
static priority_recursive_mutex analogRegisterWindowMutex;
|
||||
static tAI* analogInputSystem = NULL;
|
||||
static tAO* analogOutputSystem = NULL;
|
||||
static tAI* analogInputSystem = nullptr;
|
||||
static tAO* analogOutputSystem = nullptr;
|
||||
static uint32_t analogNumChannelsToActivate = 0;
|
||||
|
||||
extern "C" {
|
||||
@@ -74,7 +74,7 @@ void* initializeAnalogInputPort(void* port_pointer, int32_t* status) {
|
||||
if (isAccumulatorChannel(analog_port, status)) {
|
||||
analog_port->accumulator = tAccumulator::create(port->pin, status);
|
||||
} else
|
||||
analog_port->accumulator = NULL;
|
||||
analog_port->accumulator = nullptr;
|
||||
|
||||
// Set default configuration
|
||||
analogInputSystem->writeScanList(port->pin, port->pin, status);
|
||||
@@ -100,7 +100,7 @@ void* initializeAnalogOutputPort(void* port_pointer, int32_t* status) {
|
||||
// Initialize port structure
|
||||
AnalogPort* analog_port = new AnalogPort();
|
||||
analog_port->port = *port;
|
||||
analog_port->accumulator = NULL;
|
||||
analog_port->accumulator = nullptr;
|
||||
return analog_port;
|
||||
}
|
||||
|
||||
@@ -517,7 +517,7 @@ void initAccumulator(void* analog_port_pointer, int32_t* status) {
|
||||
*/
|
||||
void resetAccumulator(void* analog_port_pointer, int32_t* status) {
|
||||
AnalogPort* port = (AnalogPort*)analog_port_pointer;
|
||||
if (port->accumulator == NULL) {
|
||||
if (port->accumulator == nullptr) {
|
||||
*status = NULL_PARAMETER;
|
||||
return;
|
||||
}
|
||||
@@ -539,7 +539,7 @@ void resetAccumulator(void* analog_port_pointer, int32_t* status) {
|
||||
void setAccumulatorCenter(void* analog_port_pointer, int32_t center,
|
||||
int32_t* status) {
|
||||
AnalogPort* port = (AnalogPort*)analog_port_pointer;
|
||||
if (port->accumulator == NULL) {
|
||||
if (port->accumulator == nullptr) {
|
||||
*status = NULL_PARAMETER;
|
||||
return;
|
||||
}
|
||||
@@ -552,7 +552,7 @@ void setAccumulatorCenter(void* analog_port_pointer, int32_t center,
|
||||
void setAccumulatorDeadband(void* analog_port_pointer, int32_t deadband,
|
||||
int32_t* status) {
|
||||
AnalogPort* port = (AnalogPort*)analog_port_pointer;
|
||||
if (port->accumulator == NULL) {
|
||||
if (port->accumulator == nullptr) {
|
||||
*status = NULL_PARAMETER;
|
||||
return;
|
||||
}
|
||||
@@ -569,7 +569,7 @@ void setAccumulatorDeadband(void* analog_port_pointer, int32_t deadband,
|
||||
*/
|
||||
int64_t getAccumulatorValue(void* analog_port_pointer, int32_t* status) {
|
||||
AnalogPort* port = (AnalogPort*)analog_port_pointer;
|
||||
if (port->accumulator == NULL) {
|
||||
if (port->accumulator == nullptr) {
|
||||
*status = NULL_PARAMETER;
|
||||
return 0;
|
||||
}
|
||||
@@ -587,7 +587,7 @@ int64_t getAccumulatorValue(void* analog_port_pointer, int32_t* status) {
|
||||
*/
|
||||
uint32_t getAccumulatorCount(void* analog_port_pointer, int32_t* status) {
|
||||
AnalogPort* port = (AnalogPort*)analog_port_pointer;
|
||||
if (port->accumulator == NULL) {
|
||||
if (port->accumulator == nullptr) {
|
||||
*status = NULL_PARAMETER;
|
||||
return 0;
|
||||
}
|
||||
@@ -606,11 +606,11 @@ uint32_t getAccumulatorCount(void* analog_port_pointer, int32_t* status) {
|
||||
void getAccumulatorOutput(void* analog_port_pointer, int64_t* value,
|
||||
uint32_t* count, int32_t* status) {
|
||||
AnalogPort* port = (AnalogPort*)analog_port_pointer;
|
||||
if (port->accumulator == NULL) {
|
||||
if (port->accumulator == nullptr) {
|
||||
*status = NULL_PARAMETER;
|
||||
return;
|
||||
}
|
||||
if (value == NULL || count == NULL) {
|
||||
if (value == nullptr || count == nullptr) {
|
||||
*status = NULL_PARAMETER;
|
||||
return;
|
||||
}
|
||||
@@ -628,7 +628,7 @@ struct trigger_t {
|
||||
};
|
||||
typedef struct trigger_t AnalogTrigger;
|
||||
|
||||
static hal::Resource* triggers = NULL;
|
||||
static hal::Resource* triggers = nullptr;
|
||||
|
||||
void* initializeAnalogTrigger(void* port_pointer, uint32_t* index,
|
||||
int32_t* status) {
|
||||
|
||||
@@ -372,7 +372,7 @@ int HALInitialize(int mode) {
|
||||
|
||||
uint32_t HALReport(uint8_t resource, uint8_t instanceNumber, uint8_t context,
|
||||
const char* feature) {
|
||||
if (feature == NULL) {
|
||||
if (feature == nullptr) {
|
||||
feature = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ void cleanInterrupts(void* interrupt_pointer, int32_t* status) {
|
||||
Interrupt* anInterrupt = (Interrupt*)interrupt_pointer;
|
||||
delete anInterrupt->anInterrupt;
|
||||
delete anInterrupt->manager;
|
||||
anInterrupt->anInterrupt = NULL;
|
||||
anInterrupt->manager = NULL;
|
||||
anInterrupt->anInterrupt = nullptr;
|
||||
anInterrupt->manager = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -94,7 +94,7 @@ void* initializeNotifier(void (*process)(uint64_t, void*), void* param,
|
||||
if (!notifierManager) {
|
||||
notifierManager =
|
||||
new tInterruptManager(1 << kTimerInterruptNumber, false, status);
|
||||
notifierManager->registerHandler(alarmCallback, NULL, status);
|
||||
notifierManager->registerHandler(alarmCallback, nullptr, status);
|
||||
notifierManager->enable(status);
|
||||
}
|
||||
if (!notifierAlarm) notifierAlarm = tAlarm::create(status);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
static const int NUM_MODULE_NUMBERS = 63;
|
||||
|
||||
static PDP* pdp[NUM_MODULE_NUMBERS] = {NULL};
|
||||
static PDP* pdp[NUM_MODULE_NUMBERS] = {nullptr};
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "ChipObject.h"
|
||||
|
||||
static tPower* power = NULL;
|
||||
static tPower* power = nullptr;
|
||||
|
||||
static void initializePower(int32_t* status) {
|
||||
if (power == NULL) {
|
||||
if (power == nullptr) {
|
||||
power = tPower::create(status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
static const int NUM_MODULE_NUMBERS = 63;
|
||||
|
||||
PCM* PCM_modules[NUM_MODULE_NUMBERS] = {NULL};
|
||||
PCM* PCM_modules[NUM_MODULE_NUMBERS] = {nullptr};
|
||||
|
||||
struct solenoid_port_t {
|
||||
PCM* module;
|
||||
|
||||
@@ -30,8 +30,8 @@ Resource::Resource(uint32_t elements) {
|
||||
/**
|
||||
* Factory method to create a Resource allocation-tracker *if* needed.
|
||||
*
|
||||
* @param r -- address of the caller's Resource pointer. If *r == NULL, this
|
||||
* will construct a Resource and make *r point to it. If *r != NULL, i.e.
|
||||
* @param r -- address of the caller's Resource pointer. If *r == nullptr, this
|
||||
* will construct a Resource and make *r point to it. If *r != nullptr, i.e.
|
||||
* the caller already has a Resource instance, this won't do anything.
|
||||
* @param elements -- the number of elements for this Resource allocator to
|
||||
* track, that is, it will allocate resource numbers in the range
|
||||
@@ -40,7 +40,7 @@ Resource::Resource(uint32_t elements) {
|
||||
/*static*/ void Resource::CreateResourceObject(Resource** r,
|
||||
uint32_t elements) {
|
||||
std::lock_guard<priority_recursive_mutex> sync(m_createLock);
|
||||
if (*r == NULL) {
|
||||
if (*r == nullptr) {
|
||||
*r = new Resource(elements);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ SerialPort::SerialPort(uint32_t baudRate, Port port, uint8_t dataBits,
|
||||
|
||||
// viInstallHandler(m_portHandle, VI_EVENT_IO_COMPLETION, ioCompleteHandler,
|
||||
// this);
|
||||
// viEnableEvent(m_portHandle, VI_EVENT_IO_COMPLETION, VI_HNDLR, VI_nullptr);
|
||||
// viEnableEvent(m_portHandle, VI_EVENT_IO_COMPLETION, VI_HNDLR, VI_NULL);
|
||||
|
||||
HALReport(HALUsageReporting::kResourceType_SerialPort, 0);
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ const char* GetVisionErrorText(int errorCode) {
|
||||
break;
|
||||
}
|
||||
case -1074395269: {
|
||||
errorText = "ERR_nullptr_POINTER";
|
||||
errorText = "ERR_NULL_POINTER";
|
||||
break;
|
||||
}
|
||||
case -1074395270: {
|
||||
@@ -566,7 +566,7 @@ const char* GetVisionErrorText(int errorCode) {
|
||||
break;
|
||||
}
|
||||
case -1074395343: {
|
||||
errorText = "ERR_FILE_FILENAME_nullptr";
|
||||
errorText = "ERR_FILE_FILENAME_NULL";
|
||||
break;
|
||||
}
|
||||
case -1074395345: {
|
||||
@@ -2086,7 +2086,7 @@ const char* GetVisionErrorText(int errorCode) {
|
||||
break;
|
||||
}
|
||||
case -1074396098: {
|
||||
errorText = "ERR_RESERVED_MUST_BE_nullptr";
|
||||
errorText = "ERR_RESERVED_MUST_BE_NULL";
|
||||
break;
|
||||
}
|
||||
case -1074396099: {
|
||||
|
||||
@@ -72,7 +72,7 @@ void Error::Report() {
|
||||
#if defined(_WIN32)
|
||||
const int MAX_DIR = 100;
|
||||
char basename[MAX_DIR];
|
||||
_splitpath_s(m_filename.c_str(), NULL, 0, basename, MAX_DIR, NULL, 0, NULL,
|
||||
_splitpath_s(m_filename.c_str(), nullptr, 0, basename, MAX_DIR, nullptr, 0, nullptr,
|
||||
0);
|
||||
locStream << basename;
|
||||
#else
|
||||
|
||||
@@ -35,7 +35,7 @@ JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_FRCNetworkCommunicationUsageReportingReport(
|
||||
JNIEnv *paramEnv, jclass, jbyte paramResource, jbyte paramInstanceNumber,
|
||||
jbyte paramContext, jstring paramFeature) {
|
||||
const char *featureStr = paramEnv->GetStringUTFChars(paramFeature, NULL);
|
||||
const char *featureStr = paramEnv->GetStringUTFChars(paramFeature, nullptr);
|
||||
NETCOMM_LOG(logDEBUG) << "Calling FRCNetworkCommunicationsLibrary report "
|
||||
<< "res:" << (unsigned int)paramResource
|
||||
<< " instance:" << (unsigned int)paramInstanceNumber
|
||||
@@ -333,7 +333,7 @@ Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_HALGetB
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_HALSetErrorData(
|
||||
JNIEnv *env, jclass, jstring error) {
|
||||
const char *errorStr = env->GetStringUTFChars(error, NULL);
|
||||
const char *errorStr = env->GetStringUTFChars(error, nullptr);
|
||||
jsize length = env->GetStringUTFLength(error);
|
||||
|
||||
NETCOMM_LOG(logDEBUG) << "Set Error: " << errorStr;
|
||||
@@ -352,9 +352,9 @@ JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_wpilibj_communication_FRCNetworkCommunicationsLibrary_HALSendError(
|
||||
JNIEnv *env, jclass, jboolean isError, jint errorCode, jboolean isLVCode,
|
||||
jstring details, jstring location, jstring callStack, jboolean printMsg) {
|
||||
const char *detailsStr = env->GetStringUTFChars(details, NULL);
|
||||
const char *locationStr = env->GetStringUTFChars(location, NULL);
|
||||
const char *callStackStr = env->GetStringUTFChars(callStack, NULL);
|
||||
const char *detailsStr = env->GetStringUTFChars(details, nullptr);
|
||||
const char *locationStr = env->GetStringUTFChars(location, nullptr);
|
||||
const char *callStackStr = env->GetStringUTFChars(callStack, nullptr);
|
||||
|
||||
NETCOMM_LOG(logDEBUG) << "Send Error: " << detailsStr;
|
||||
NETCOMM_LOG(logDEBUG) << "Location: " << locationStr;
|
||||
|
||||
@@ -240,7 +240,7 @@ Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialGetBytesRecieved(
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialRead(
|
||||
JNIEnv* env, jclass, jbyte port, jobject dataReceived, jint size) {
|
||||
SERIALJNI_LOG(logDEBUG) << "Serial Read";
|
||||
jbyte* dataReceivedPtr = NULL;
|
||||
jbyte* dataReceivedPtr = nullptr;
|
||||
dataReceivedPtr = (jbyte*)env->GetDirectBufferAddress(dataReceived);
|
||||
int32_t status = 0;
|
||||
jint retVal = serialRead(port, (char*)dataReceivedPtr, size, &status);
|
||||
@@ -258,7 +258,7 @@ JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialRead(
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SerialPortJNI_serialWrite(
|
||||
JNIEnv* env, jclass, jbyte port, jobject dataToSend, jint size) {
|
||||
SERIALJNI_LOG(logDEBUG) << "Serial Write";
|
||||
jbyte* dataToSendPtr = NULL;
|
||||
jbyte* dataToSendPtr = nullptr;
|
||||
if (dataToSend != 0) {
|
||||
dataToSendPtr = (jbyte*)env->GetDirectBufferAddress(dataToSend);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user