diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-04-12 20:59:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-12 20:59:47 +0000 |
commit | 36956568bca616ad500235d4bc445a25f119c9fc (patch) | |
tree | 1c7fd7b0f542b52156bdfff44011643e30947106 | |
parent | f096ced10cceea9db63fb5e8eabc16f8f0cf31fd (diff) | |
parent | 36aed904bc49bbe23a7d69d6b26bf65eee5de597 (diff) | |
download | base-android12-hostruntime-dev.tar.gz |
Merge "Use "C" numeric locale for consistency in strtof" into android12-hostruntime-devandroid12-hostruntime-dev
-rw-r--r-- | core/jni/RobolectricNativeRuntime.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/jni/RobolectricNativeRuntime.cpp b/core/jni/RobolectricNativeRuntime.cpp index d11a4b71ecef..fcbc89e788fb 100644 --- a/core/jni/RobolectricNativeRuntime.cpp +++ b/core/jni/RobolectricNativeRuntime.cpp @@ -4,6 +4,7 @@ #include <vector> #include <android/graphics/jni_runtime.h> +#include <locale.h> #include <sys/stat.h> #include <unicode/putil.h> #include <unicode/udata.h> @@ -214,5 +215,10 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) { } env->ReleaseStringUTFChars(stringPath, icuPath); env->ReleaseStringUTFChars(stringLanguageTag, languageTag); + + // Use minimal "C" locale for number format to ensure correct parsing of floats when using + // strtof (e.g. in PathParser). + setlocale(LC_NUMERIC, "C"); + return JNI_VERSION_1_6; } |