protocol/ArgParser: use strtod() instead of strtof() on Android
For Android pre-5.0 compatibility (#213).
This commit is contained in:
parent
b8a094470b
commit
19a2885fd5
@ -151,7 +151,12 @@ float
|
|||||||
ParseCommandArgFloat(const char *s)
|
ParseCommandArgFloat(const char *s)
|
||||||
{
|
{
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
#ifdef ANDROID
|
||||||
|
/* strtof() requires API level 21 */
|
||||||
|
auto value = strtod(s, &endptr);
|
||||||
|
#else
|
||||||
auto value = strtof(s, &endptr);
|
auto value = strtof(s, &endptr);
|
||||||
|
#endif
|
||||||
if (endptr == s || *endptr != 0)
|
if (endptr == s || *endptr != 0)
|
||||||
throw FormatProtocolError(ACK_ERROR_ARG,
|
throw FormatProtocolError(ACK_ERROR_ARG,
|
||||||
"Float expected: %s", s);
|
"Float expected: %s", s);
|
||||||
|
Loading…
Reference in New Issue
Block a user