diff --git a/cscore/src/main/native/cpp/jni/CameraServerJNI.cpp b/cscore/src/main/native/cpp/jni/CameraServerJNI.cpp index ef62f79070..536111efae 100644 --- a/cscore/src/main/native/cpp/jni/CameraServerJNI.cpp +++ b/cscore/src/main/native/cpp/jni/CameraServerJNI.cpp @@ -79,7 +79,7 @@ static void ListenerOnExit() { /// throw java exception static void ThrowJavaException(JNIEnv* env, const std::exception* e) { wpi::SmallString<128> what; - jclass je = 0; + jclass je = nullptr; if (e) { const char* exception_type = "std::exception"; @@ -1198,7 +1198,7 @@ Java_edu_wpi_cscore_CameraServerCvJNI_putSourceFrame } catch (const std::exception& e) { ThrowJavaException(env, &e); } catch (...) { - ThrowJavaException(env, 0); + ThrowJavaException(env, nullptr); } } @@ -1673,7 +1673,7 @@ Java_edu_wpi_cscore_CameraServerCvJNI_grabSinkFrame ThrowJavaException(env, &e); return 0; } catch (...) { - ThrowJavaException(env, 0); + ThrowJavaException(env, nullptr); return 0; } } @@ -1697,7 +1697,7 @@ Java_edu_wpi_cscore_CameraServerCvJNI_grabSinkFrameTimeout ThrowJavaException(env, &e); return 0; } catch (...) { - ThrowJavaException(env, 0); + ThrowJavaException(env, nullptr); return 0; } } diff --git a/hal/src/main/native/cpp/jni/I2CJNI.cpp b/hal/src/main/native/cpp/jni/I2CJNI.cpp index 7434906c57..b605b9550a 100644 --- a/hal/src/main/native/cpp/jni/I2CJNI.cpp +++ b/hal/src/main/native/cpp/jni/I2CJNI.cpp @@ -42,7 +42,7 @@ Java_edu_wpi_first_hal_I2CJNI_i2CTransaction jbyte sendSize, jobject dataReceived, jbyte receiveSize) { uint8_t* dataToSendPtr = nullptr; - if (dataToSend != 0) { + if (dataToSend != nullptr) { dataToSendPtr = reinterpret_cast(env->GetDirectBufferAddress(dataToSend)); } @@ -88,7 +88,7 @@ Java_edu_wpi_first_hal_I2CJNI_i2CWrite { uint8_t* dataToSendPtr = nullptr; - if (dataToSend != 0) { + if (dataToSend != nullptr) { dataToSendPtr = reinterpret_cast(env->GetDirectBufferAddress(dataToSend)); } diff --git a/hal/src/main/native/cpp/jni/InterruptJNI.cpp b/hal/src/main/native/cpp/jni/InterruptJNI.cpp index 0eebdf14b7..47d37b434e 100644 --- a/hal/src/main/native/cpp/jni/InterruptJNI.cpp +++ b/hal/src/main/native/cpp/jni/InterruptJNI.cpp @@ -271,12 +271,12 @@ Java_edu_wpi_first_hal_InterruptJNI_attachInterruptHandler (JNIEnv* env, jclass, jint interruptHandle, jobject handler, jobject param) { jclass cls = env->GetObjectClass(handler); - if (cls == 0) { + if (cls == nullptr) { assert(false); return; } jmethodID mid = env->GetMethodID(cls, "apply", "(ILjava/lang/Object;)V"); - if (mid == 0) { + if (mid == nullptr) { assert(false); return; } diff --git a/hal/src/main/native/cpp/jni/SPIJNI.cpp b/hal/src/main/native/cpp/jni/SPIJNI.cpp index 303c0337a6..67ef56df44 100644 --- a/hal/src/main/native/cpp/jni/SPIJNI.cpp +++ b/hal/src/main/native/cpp/jni/SPIJNI.cpp @@ -42,7 +42,7 @@ Java_edu_wpi_first_hal_SPIJNI_spiTransaction jbyte size) { uint8_t* dataToSendPtr = nullptr; - if (dataToSend != 0) { + if (dataToSend != nullptr) { dataToSendPtr = reinterpret_cast(env->GetDirectBufferAddress(dataToSend)); } @@ -85,7 +85,7 @@ Java_edu_wpi_first_hal_SPIJNI_spiWrite (JNIEnv* env, jclass, jint port, jobject dataToSend, jbyte size) { uint8_t* dataToSendPtr = nullptr; - if (dataToSend != 0) { + if (dataToSend != nullptr) { dataToSendPtr = reinterpret_cast(env->GetDirectBufferAddress(dataToSend)); } diff --git a/hal/src/main/native/sim/AnalogTrigger.cpp b/hal/src/main/native/sim/AnalogTrigger.cpp index ae236bc04a..50c4ab4928 100644 --- a/hal/src/main/native/sim/AnalogTrigger.cpp +++ b/hal/src/main/native/sim/AnalogTrigger.cpp @@ -128,12 +128,12 @@ void HAL_SetAnalogTriggerLimitsRaw(HAL_AnalogTriggerHandle analogTriggerHandle, double trigLower = GetAnalogValueToVoltage(trigger->analogHandle, lower, status); - if (status != 0) { + if (status != nullptr) { return; } double trigUpper = GetAnalogValueToVoltage(trigger->analogHandle, upper, status); - if (status != 0) { + if (status != nullptr) { return; } diff --git a/simulation/halsim_ws_client/src/main/native/cpp/HALSimWS.cpp b/simulation/halsim_ws_client/src/main/native/cpp/HALSimWS.cpp index a2a077d502..da6253d589 100644 --- a/simulation/halsim_ws_client/src/main/native/cpp/HALSimWS.cpp +++ b/simulation/halsim_ws_client/src/main/native/cpp/HALSimWS.cpp @@ -39,14 +39,14 @@ bool HALSimWS::Initialize() { } const char* host = std::getenv("HALSIMWS_HOST"); - if (host != NULL) { + if (host != nullptr) { m_host = host; } else { m_host = "localhost"; } const char* port = std::getenv("HALSIMWS_PORT"); - if (port != NULL) { + if (port != nullptr) { try { m_port = std::stoi(port); } catch (const std::invalid_argument& err) { @@ -58,7 +58,7 @@ bool HALSimWS::Initialize() { } const char* uri = std::getenv("HALSIMWS_URI"); - if (uri != NULL) { + if (uri != nullptr) { m_uri = uri; } else { m_uri = "/wpilibws"; diff --git a/simulation/halsim_ws_server/src/main/native/cpp/HALSimWeb.cpp b/simulation/halsim_ws_server/src/main/native/cpp/HALSimWeb.cpp index 41420280e6..b8093a3e20 100644 --- a/simulation/halsim_ws_server/src/main/native/cpp/HALSimWeb.cpp +++ b/simulation/halsim_ws_server/src/main/native/cpp/HALSimWeb.cpp @@ -46,7 +46,7 @@ bool HALSimWeb::Initialize() { wpi::SmallString<64> tmp; const char* webroot_sys = std::getenv("HALSIMWS_SYSROOT"); - if (webroot_sys != NULL) { + if (webroot_sys != nullptr) { wpi::StringRef tstr(webroot_sys); tmp.append(tstr); } else { @@ -58,7 +58,7 @@ bool HALSimWeb::Initialize() { tmp.clear(); const char* webroot_user = std::getenv("HALSIMWS_USERROOT"); - if (webroot_user != NULL) { + if (webroot_user != nullptr) { wpi::StringRef tstr(webroot_user); tmp.append(tstr); } else { @@ -69,14 +69,14 @@ bool HALSimWeb::Initialize() { m_webroot_user = wpi::Twine(tmp).str(); const char* uri = std::getenv("HALSIMWS_URI"); - if (uri != NULL) { + if (uri != nullptr) { m_uri = uri; } else { m_uri = "/wpilibws"; } const char* port = std::getenv("HALSIMWS_PORT"); - if (port != NULL) { + if (port != nullptr) { try { m_port = std::stoi(port); } catch (const std::invalid_argument& err) { diff --git a/wpigui/src/main/native/include/wpigui.h b/wpigui/src/main/native/include/wpigui.h index 2933631bfc..1c27233174 100644 --- a/wpigui/src/main/native/include/wpigui.h +++ b/wpigui/src/main/native/include/wpigui.h @@ -266,7 +266,7 @@ class Texture { m_format{oth.m_format}, m_width{oth.m_width}, m_height{oth.m_height} { - oth.m_texture = 0; + oth.m_texture = 0; // NOLINT } Texture& operator=(const Texture&) = delete; @@ -275,7 +275,7 @@ class Texture { DeleteTexture(m_texture); } m_texture = oth.m_texture; - oth.m_texture = 0; + oth.m_texture = 0; // NOLINT m_format = oth.m_format; m_width = oth.m_width; m_height = oth.m_height; diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandRequirementsTest.cpp b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandRequirementsTest.cpp index 14303ceece..ad6a09b91e 100644 --- a/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandRequirementsTest.cpp +++ b/wpilibNewCommands/src/test/native/cpp/frc2/command/CommandRequirementsTest.cpp @@ -77,5 +77,5 @@ TEST_F(CommandRequirementsTest, DefaultCommandRequirementErrorTest) { requirement1.SetDefaultCommand(std::move(command1)); - EXPECT_TRUE(requirement1.GetDefaultCommand() == NULL); + EXPECT_TRUE(requirement1.GetDefaultCommand() == nullptr); } diff --git a/wpiutil/src/main/native/cpp/TCPStream.cpp b/wpiutil/src/main/native/cpp/TCPStream.cpp index 1eaa3e983e..7a0ead1dac 100644 --- a/wpiutil/src/main/native/cpp/TCPStream.cpp +++ b/wpiutil/src/main/native/cpp/TCPStream.cpp @@ -223,7 +223,7 @@ bool TCPStream::WaitForReadEvent(int timeout) { tv.tv_usec = 0; FD_ZERO(&sdset); FD_SET(m_sd, &sdset); - if (select(m_sd + 1, &sdset, NULL, NULL, &tv) > 0) { + if (select(m_sd + 1, &sdset, nullptr, nullptr, &tv) > 0) { return true; } return false;