summaryrefslogtreecommitdiff
path: root/libs/ardour/chan_mapping.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-08-27 22:27:10 +1000
committerTim Mayberry <mojofunk@gmail.com>2017-04-19 09:36:50 +1000
commitd53c66973cc9986c74dd320929600a6afcc695d8 (patch)
treec212bd795105f8660364bcff413d21d47d5493ea /libs/ardour/chan_mapping.cc
parent9c083a9b8630a085737498f15e0b61315046afe0 (diff)
Use XMLNode::get/set_property in ARDOUR::ChanMapping class
This avoids possible demotion of unsigned integers when using the add_property(char*, long) API. Which is unlikely to have ever been an issue but worth noting.
Diffstat (limited to 'libs/ardour/chan_mapping.cc')
-rw-r--r--libs/ardour/chan_mapping.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/libs/ardour/chan_mapping.cc b/libs/ardour/chan_mapping.cc
index f6f0e092c8..b3cbb10ef4 100644
--- a/libs/ardour/chan_mapping.cc
+++ b/libs/ardour/chan_mapping.cc
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <iostream>
#include "ardour/chan_mapping.h"
+#include "ardour/types_convert.h"
#include "pbd/i18n.h"
@@ -59,10 +60,13 @@ ChanMapping::ChanMapping (const XMLNode& node)
XMLNodeConstIterator iter = node.children().begin();
for ( ; iter != node.children().end(); ++iter) {
if ((*iter)->name() == X_(state_node_name)) {
- const string& type_str = (*iter)->property("type")->value();
- const string& from_str = (*iter)->property("from")->value();
- const string& to_str = (*iter)->property("to")->value();
- set(DataType(type_str), atol (from_str.c_str()), atol (to_str.c_str()));
+ DataType type(DataType::NIL);
+ uint32_t from;
+ uint32_t to;
+ (*iter)->get_property("type", type);
+ (*iter)->get_property("from", from);
+ (*iter)->get_property("to", to);
+ set(type, from, to);
}
}
}
@@ -160,9 +164,9 @@ ChanMapping::state(const std::string& name) const
for (Mappings::const_iterator tm = mp.begin(); tm != mp.end(); ++tm) {
for (TypeMapping::const_iterator i = tm->second.begin(); i != tm->second.end(); ++i) {
XMLNode* n = new XMLNode(X_(state_node_name));
- n->add_property("type", tm->first.to_string());
- n->add_property("from", i->first);
- n->add_property("to", i->second);
+ n->set_property("type", tm->first.to_string());
+ n->set_property("from", i->first);
+ n->set_property("to", i->second);
node->add_child_nocopy(*n);
}
}