From 19a2885fd5174f65a17ccb20d2fc790269baea02 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 9 Feb 2018 20:25:32 +0100 Subject: [PATCH] protocol/ArgParser: use strtod() instead of strtof() on Android For Android pre-5.0 compatibility (#213). --- src/protocol/ArgParser.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index 185c57863..2665270e6 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -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);