diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2022-10-18 08:26:04 -0500 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2022-10-18 08:26:04 -0500 |
commit | 01bec83cb6793dbf97b13fa5d73eac3851b9d26b (patch) | |
tree | 4e279889cd49182d69df54fc185b7e0206115eff /platform/android | |
parent | 2e3662acbd8586697db38569785cc9f97dff945e (diff) |
Use proper types for converting Java float/double arrays in Android code
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/jni_utils.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/platform/android/jni_utils.cpp b/platform/android/jni_utils.cpp index d46b4f39de..2b0ee50570 100644 --- a/platform/android/jni_utils.cpp +++ b/platform/android/jni_utils.cpp @@ -265,33 +265,33 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { if (name == "[D") { jdoubleArray arr = (jdoubleArray)obj; int fCount = env->GetArrayLength(arr); - PackedFloat32Array sarr; - sarr.resize(fCount); + PackedFloat64Array packed_array; + packed_array.resize(fCount); - real_t *w = sarr.ptrw(); + double *w = packed_array.ptrw(); for (int i = 0; i < fCount; i++) { double n; env->GetDoubleArrayRegion(arr, i, 1, &n); w[i] = n; } - return sarr; + return packed_array; } if (name == "[F") { jfloatArray arr = (jfloatArray)obj; int fCount = env->GetArrayLength(arr); - PackedFloat32Array sarr; - sarr.resize(fCount); + PackedFloat32Array packed_array; + packed_array.resize(fCount); - real_t *w = sarr.ptrw(); + float *w = packed_array.ptrw(); for (int i = 0; i < fCount; i++) { float n; env->GetFloatArrayRegion(arr, i, 1, &n); w[i] = n; } - return sarr; + return packed_array; } if (name == "[Ljava.lang.Object;") { |