summaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-02-09 20:25:32 +0100
committerMax Kellermann <max@musicpd.org>2018-02-09 22:54:22 +0100
commit19a2885fd5174f65a17ccb20d2fc790269baea02 (patch)
tree3f904f77e963e5965f0ccdb3adce286254146d5d /src/protocol
parentb8a094470b157894aa49db4466fb0296bb164573 (diff)
protocol/ArgParser: use strtod() instead of strtof() on Android
For Android pre-5.0 compatibility (#213).
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/ArgParser.cxx5
1 files changed, 5 insertions, 0 deletions
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);