aboutsummaryrefslogtreecommitdiffstats
path: root/java_jni/jni/jau
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-11-27 10:32:50 +0100
committerSven Gothel <[email protected]>2022-11-27 10:32:50 +0100
commit3937f05c26dfddcad6853b3db15a314147b436c6 (patch)
tree19b705ea8d72ce618d770861fcced03b914558ea /java_jni/jni/jau
parent0cbf215df7550bf9a2dafe49440bfaf3454e4a4d (diff)
clang-tidy: Use nullptr
Diffstat (limited to 'java_jni/jni/jau')
-rw-r--r--java_jni/jni/jau/UnixDynamicLinkerImpl_JNI.cxx2
-rw-r--r--java_jni/jni/jau/WindowsDynamicLinkerImpl_JNI.cxx18
-rw-r--r--java_jni/jni/jau/jau_io_MemUtil.cxx2
3 files changed, 11 insertions, 11 deletions
diff --git a/java_jni/jni/jau/UnixDynamicLinkerImpl_JNI.cxx b/java_jni/jni/jau/UnixDynamicLinkerImpl_JNI.cxx
index eaf3d7e..4ee1938 100644
--- a/java_jni/jni/jau/UnixDynamicLinkerImpl_JNI.cxx
+++ b/java_jni/jni/jau/UnixDynamicLinkerImpl_JNI.cxx
@@ -73,7 +73,7 @@ Java_jau_sys_dl_UnixDynamicLinkerImpl_dlopen(JNIEnv *env, jclass _unused, jstrin
const char *_UTF8arg0 = nullptr;
void *_res;
#ifdef DEBUG_DLOPEN
- DLOPEN_FPTR_TYPE dlopenFunc = NULL;
+ DLOPEN_FPTR_TYPE dlopenFunc = nullptr;
DBG_PRINT("XXX dlopen.0\n");
#endif
diff --git a/java_jni/jni/jau/WindowsDynamicLinkerImpl_JNI.cxx b/java_jni/jni/jau/WindowsDynamicLinkerImpl_JNI.cxx
index 799885a..6ddd230 100644
--- a/java_jni/jni/jau/WindowsDynamicLinkerImpl_JNI.cxx
+++ b/java_jni/jni/jau/WindowsDynamicLinkerImpl_JNI.cxx
@@ -61,18 +61,18 @@ JNIEXPORT jlong JNICALL
Java_jau_sys_dl_WindowsDynamicLinkerImpl_GetProcAddressA(JNIEnv *env, jclass _unused, jlong hModule, jstring lpProcName) {
(void)_unused;
- const char* _strchars_lpProcName = NULL;
+ const char* _strchars_lpProcName = nullptr;
PROC _res;
- if (lpProcName != NULL) {
- _strchars_lpProcName = env->GetStringUTFChars(lpProcName, (jboolean*)NULL);
- if (_strchars_lpProcName == NULL) {
+ if (lpProcName != nullptr) {
+ _strchars_lpProcName = env->GetStringUTFChars(lpProcName, (jboolean*)nullptr);
+ if (_strchars_lpProcName == nullptr) {
env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"),
"Failed to get UTF-8 chars for argument \"lpProcName\" in native dispatcher for \"GetProcAddressA\"");
return 0;
}
}
_res = GetProcAddressA((HANDLE) (intptr_t) hModule, (LPCSTR) _strchars_lpProcName);
- if (lpProcName != NULL) {
+ if (lpProcName != nullptr) {
env->ReleaseStringUTFChars(lpProcName, _strchars_lpProcName);
}
return (jlong) (intptr_t) _res;
@@ -88,11 +88,11 @@ JNIEXPORT jlong JNICALL
Java_jau_sys_dl_WindowsDynamicLinkerImpl_LoadLibraryW(JNIEnv *env, jclass _unused, jstring lpLibFileName) {
(void)_unused;
- jchar* _strchars_lpLibFileName = NULL;
+ jchar* _strchars_lpLibFileName = nullptr;
HANDLE _res;
- if (lpLibFileName != NULL) {
+ if (lpLibFileName != nullptr) {
_strchars_lpLibFileName = (jchar *) calloc(env->GetStringLength(lpLibFileName) + 1, sizeof(jchar));
- if (_strchars_lpLibFileName == NULL) {
+ if (_strchars_lpLibFileName == nullptr) {
env->ThrowNew(env->FindClass("java/lang/OutOfMemoryError"),
"Could not allocate temporary buffer for copying string argument \"lpLibFileName\" in native dispatcher for \"LoadLibraryW\"");
return 0;
@@ -100,7 +100,7 @@ Java_jau_sys_dl_WindowsDynamicLinkerImpl_LoadLibraryW(JNIEnv *env, jclass _unuse
env->GetStringRegion(lpLibFileName, 0, env->GetStringLength(lpLibFileName), _strchars_lpLibFileName);
}
_res = LoadLibraryW((LPCWSTR) _strchars_lpLibFileName);
- if (lpLibFileName != NULL) {
+ if (lpLibFileName != nullptr) {
free((void*) _strchars_lpLibFileName);
}
return (jlong) (intptr_t) _res;
diff --git a/java_jni/jni/jau/jau_io_MemUtil.cxx b/java_jni/jni/jau/jau_io_MemUtil.cxx
index 82d6d76..e5a1b83 100644
--- a/java_jni/jni/jau/jau_io_MemUtil.cxx
+++ b/java_jni/jni/jau/jau_io_MemUtil.cxx
@@ -81,7 +81,7 @@ jboolean Java_org_jau_io_MemUtil_zeroString(JNIEnv *env, jclass clazz, jstring j
jau::jni::JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * ptr = criticalArray.get(jstr_value, criticalArray.Mode::UPDATE_AND_RELEASE);
DBG_PRINT("zeroString.1: value: %p, len %zu, is_copy %d", ptr, jstr_value_size, criticalArray.getIsCopy());
- if( NULL == ptr ) {
+ if( nullptr == ptr ) {
ERR_PRINT("GetPrimitiveArrayCritical(address byte array) is null");
return JNI_FALSE;
}