diff options
author | Max Kellermann <max@musicpd.org> | 2018-02-09 20:46:55 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-02-09 22:54:22 +0100 |
commit | e8b70dbca43340c4d8c4ed3b7aff508b5dce40d3 (patch) | |
tree | d2c5bc87a52d669948ef09edb1c39ba24c5fe53c /src/queue/PlaylistState.cxx | |
parent | 0f8d223c7fcc7e61808716dbb740786b9d95a991 (diff) |
SongSave, queue/PlaylistState, tag/ReplayGain: use portable atof() wrappers
For Android pre-5.0 compatibility (#213).
Diffstat (limited to 'src/queue/PlaylistState.cxx')
-rw-r--r-- | src/queue/PlaylistState.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/queue/PlaylistState.cxx b/src/queue/PlaylistState.cxx index d08610efc..614f01c19 100644 --- a/src/queue/PlaylistState.cxx +++ b/src/queue/PlaylistState.cxx @@ -35,6 +35,7 @@ #include "util/CharUtil.hxx" #include "util/StringAPI.hxx" #include "util/StringCompare.hxx" +#include "util/NumberParser.hxx" #include "Log.hxx" #include <string.h> @@ -148,7 +149,7 @@ playlist_state_restore(const char *line, TextFile &file, while ((line = file.ReadLine()) != nullptr) { const char *p; if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_TIME))) { - seek_time = SongTime::FromS(atof(p)); + seek_time = SongTime::FromS(ParseDouble(p)); } else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_REPEAT))) { playlist.SetRepeat(pc, StringIsEqual(p, "1")); } else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_SINGLE))) { @@ -158,12 +159,12 @@ playlist_state_restore(const char *line, TextFile &file, } else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_CROSSFADE))) { pc.SetCrossFade(atoi(p)); } else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_MIXRAMPDB))) { - pc.SetMixRampDb(atof(p)); + pc.SetMixRampDb(ParseFloat(p)); } else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_MIXRAMPDELAY))) { /* this check discards "nan" which was used prior to MPD 0.18 */ if (IsDigitASCII(*p)) - pc.SetMixRampDelay(atof(p)); + pc.SetMixRampDelay(ParseFloat(p)); } else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_RANDOM))) { random_mode = StringIsEqual(p, "1"); } else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_CURRENT))) { |