|
29 | 29 | #include <vector>
|
30 | 30 | #include <cstdlib>
|
31 | 31 |
|
32 |
| -#if defined(ANDROID) |
33 |
| - |
34 |
| -namespace crossplat |
35 |
| -{ |
36 |
| -// These two are initialized in threadpool.cpp |
37 |
| -// HACK: This uses silently shared global variables. Revisit in the future if android |
38 |
| -// JNI code gets its own header and cpp file. |
39 |
| -extern jmethodID java_parseDouble; |
40 |
| -extern jclass java_lang_double; |
41 |
| -} |
42 |
| -#endif |
43 |
| - |
44 | 32 | #pragma warning(disable : 4127) // allow expressions like while(true) pass
|
45 | 33 | using namespace web;
|
46 | 34 | using namespace web::json;
|
@@ -405,44 +393,8 @@ namespace
|
405 | 393 | }
|
406 | 394 | #endif
|
407 | 395 |
|
408 |
| -#ifdef ANDROID |
409 |
| - static double anystod(const char* str) |
410 |
| - { |
411 |
| - // HACK: To work around issues with bionic's strtod() implementation, we ship |
412 |
| - // the string to parse into java, call the java function |
413 |
| - // java.lang.Double.parseDouble(), and bring it back down to native code. |
414 |
| - // |
415 |
| - // The strtod() bug causes problems when parsing large strings; furthermore, it |
416 |
| - // is arguable that it uses "locale" information, which is announced as being |
417 |
| - // off-limits for native code. |
418 |
| - // |
419 |
| - // It is highly unlikely this situation will be remedied due to ecosystem |
420 |
| - // fragmentation. |
421 |
| - if (str == nullptr) |
422 |
| - str = ""; |
423 |
| - |
424 |
| - auto env = crossplat::get_jvm_env(); |
425 |
| - |
426 |
| - jdouble parsed_double; |
427 |
| - |
428 |
| - crossplat::java_local_ref<jstring> jstr{env->NewStringUTF(str)}; |
429 |
| - parsed_double = env->CallStaticDoubleMethod(crossplat::java_lang_double, |
430 |
| - crossplat::java_parseDouble, |
431 |
| - jstr.get()); |
432 |
| - |
433 |
| - jthrowable exc = env->ExceptionOccurred(); |
434 |
| - if (exc) |
435 |
| - { |
436 |
| - env->ExceptionClear(); |
437 |
| - throw exc; |
438 |
| - } |
439 |
| - return parsed_double; |
440 |
| - } |
441 |
| - |
442 |
| -#else |
443 | 396 | static double anystod(const char* str) { return strtod(str, nullptr); }
|
444 | 397 | static double anystod(const wchar_t* str) { return wcstod(str, nullptr); }
|
445 |
| -#endif |
446 | 398 | }
|
447 | 399 |
|
448 | 400 | template <typename CharType>
|
|
0 commit comments