mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +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:
@@ -123,6 +123,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGAVersion";
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
*statusPtr = 0;
|
||||
jshort returnValue = getFPGAVersion( statusPtr );
|
||||
HALUTIL_LOG(logDEBUG) << "Status = " << *statusPtr;
|
||||
HALUTIL_LOG(logDEBUG) << "FPGAVersion = " << returnValue;
|
||||
@@ -139,6 +140,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGARevision";
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
*statusPtr = 0;
|
||||
jint returnValue = getFPGARevision( statusPtr );
|
||||
HALUTIL_LOG(logDEBUG) << "Status = " << *statusPtr;
|
||||
HALUTIL_LOG(logDEBUG) << "FPGARevision = " << returnValue;
|
||||
@@ -155,6 +157,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
//HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime";
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
*statusPtr = 0;
|
||||
jlong returnValue = getFPGATime( statusPtr );
|
||||
//HALUTIL_LOG(logDEBUG) << "Status = " << *statusPtr;
|
||||
//HALUTIL_LOG(logDEBUG) << "FPGATime = " << returnValue;
|
||||
@@ -172,6 +175,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
//HALUTIL_LOG(logDEBUG) << "Calling HALUtil getFPGATime";
|
||||
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
|
||||
*statusPtr = 0;
|
||||
jboolean returnValue = getFPGAButton( statusPtr );
|
||||
//HALUTIL_LOG(logDEBUG) << "Status = " << *statusPtr;
|
||||
//HALUTIL_LOG(logDEBUG) << "FPGATime = " << returnValue;
|
||||
|
||||
Reference in New Issue
Block a user