summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-10-28 21:42:57 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-10-28 21:42:57 +0000
commit66a0a11b0880cb1a64d6b8c631b6a96ad4a62148 (patch)
tree99d0d33392d04a8cbe9a5ce894aa980c637b2799 /libs
parent836591b6b5aa8d0e439004152e3941150f0fb538 (diff)
patches for valgrind-reported errors, from carl (#2873)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5963 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/io.cc28
-rw-r--r--libs/ardour/session_state.cc2
2 files changed, 16 insertions, 14 deletions
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index f0a0cece19..0678c4aff8 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -97,32 +97,34 @@ static double direct_gain_to_control (gain_t gain) {
static bool sort_ports_by_name (Port* a, Port* b) {
- unsigned int last_digit_position_a = a->name().size();
- std::string::reverse_iterator r_iterator = a->name().rbegin();
+ std::string const a_name = a->name();
+ unsigned int last_digit_position_a = a_name.size();
+ std::string::const_reverse_iterator r_iterator = a_name.rbegin();
- while (r_iterator!=a->name().rend() and Glib::Unicode::isdigit(*r_iterator)) {
+ while (r_iterator != a_name.rend() and Glib::Unicode::isdigit(*r_iterator)) {
r_iterator++; last_digit_position_a--;
}
- unsigned int last_digit_position_b = b->name().size();
- r_iterator = b->name().rbegin();
+ std::string const b_name = b->name();
+ unsigned int last_digit_position_b = b_name.size();
+ r_iterator = b_name.rbegin();
- while (r_iterator!=b->name().rend() and Glib::Unicode::isdigit(*r_iterator)) {
+ while (r_iterator != b_name.rend() and Glib::Unicode::isdigit(*r_iterator)) {
r_iterator++; last_digit_position_b--;
}
// if some of the names don't have a number as posfix, compare as strings
- if (last_digit_position_a == a->name().size() or last_digit_position_b == b->name().size()) {
- return a->name() < b->name();
+ if (last_digit_position_a == a_name.size() or last_digit_position_b == b_name.size()) {
+ return a_name < b_name;
}
- const std::string prefix_a = a->name().substr(0, last_digit_position_a - 1);
- const unsigned int posfix_a = std::atoi(a->name().substr(last_digit_position_a, a->name().size() - last_digit_position_a).c_str());
- const std::string prefix_b = b->name().substr(0, last_digit_position_b - 1);
- const unsigned int posfix_b = std::atoi(b->name().substr(last_digit_position_b, b->name().size() - last_digit_position_b).c_str());
+ const std::string prefix_a = a_name.substr(0, last_digit_position_a - 1);
+ const unsigned int posfix_a = std::atoi(a_name.substr(last_digit_position_a, a_name.size() - last_digit_position_a).c_str());
+ const std::string prefix_b = b_name.substr(0, last_digit_position_b - 1);
+ const unsigned int posfix_b = std::atoi(b_name.substr(last_digit_position_b, b_name.size() - last_digit_position_b).c_str());
if (prefix_a != prefix_b) {
- return a->name() < b->name();
+ return a_name < b_name;
} else {
return posfix_a < posfix_b;
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 8fcec6864f..e01703636e 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -2542,7 +2542,7 @@ Session::get_route_templates (vector<RouteTemplateInfo>& template_names)
template_names.push_back (rti);
}
- free (templates);
+ delete templates;
}
int