mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Always initialize status to 0 when calling HAL from JNI.
The HAL functions often call NI functions that may expect status to be initialized on entry. Java does not guarantee direct pointer allocation memory to be initialized, although that may have been occurring by accident. Change-Id: I5e3a553f3a7be8de3716ccfc13e6ca1cb4f2a552
This commit is contained in:
@@ -615,6 +615,7 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCo
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
*statusPtr = 0;
|
||||
return HALGetSystemActive((int32_t*)statusPtr);
|
||||
}
|
||||
|
||||
@@ -627,6 +628,7 @@ JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_communication_FRCNetworkCo
|
||||
(JNIEnv * env, jclass, jobject status)
|
||||
{
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
*statusPtr = 0;
|
||||
return HALGetBrownedOut((int32_t*)statusPtr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user