protocol/ArgParser: use strtod() instead of strtof() on Android

For Android pre-5.0 compatibility (#213).
This commit is contained in:
Max Kellermann 2018-02-09 20:25:32 +01:00
parent b8a094470b
commit 19a2885fd5

View File

@ -151,7 +151,12 @@ float
ParseCommandArgFloat(const char *s)
{
char *endptr;
#ifdef ANDROID
/* strtof() requires API level 21 */
auto value = strtod(s, &endptr);
#else
auto value = strtof(s, &endptr);
#endif
if (endptr == s || *endptr != 0)
throw FormatProtocolError(ACK_ERROR_ARG,
"Float expected: %s", s);