From ca7bbea6d8378c0ca4c0e2deecd70c60178f7378 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Thu, 8 Sep 2016 10:19:12 +1000 Subject: Use PBD::string_to/to_string when de/serializing in AutomationList class This avoids requiring a LocaleGuard to get the correct numeric formatting and saves/restores the automation data to the precision required for roundtrip equality. --- libs/ardour/automation_list.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libs/ardour/automation_list.cc') diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index ff22dae5da..c397323767 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -347,12 +347,10 @@ AutomationList::serialize_events () XMLNode* node = new XMLNode (X_("events")); stringstream str; - str.precision(15); //10 digits is enough digits for 24 hours at 96kHz - for (iterator xx = _events.begin(); xx != _events.end(); ++xx) { - str << (double) (*xx)->when; + str << PBD::to_string ((*xx)->when); str << ' '; - str <<(double) (*xx)->value; + str << PBD::to_string ((*xx)->value); str << '\n'; } @@ -384,17 +382,19 @@ AutomationList::deserialize_events (const XMLNode& node) stringstream str (content_node->content()); + std::string x_str; + std::string y_str; double x; double y; bool ok = true; while (str) { - str >> x; - if (!str) { + str >> x_str; + if (!str || !PBD::string_to (x_str, x)) { break; } - str >> y; - if (!str) { + str >> y_str; + if (!str || !PBD::string_to (y_str, y)) { ok = false; break; } -- cgit v1.2.3