fix for #1041, I/O names with colons in them
git-svn-id: svn://localhost/ardour2/trunk@1502 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -144,6 +144,8 @@ static const char* authors[] = {
|
||||
N_("Stefan Kersten"),
|
||||
N_("Christopher George"),
|
||||
N_("Robert Jordens"),
|
||||
N_("Dave Robillard"),
|
||||
N_("Hans Fugal"),
|
||||
N_("Brian Ahr"),
|
||||
N_("Nimal Ratnayake"),
|
||||
N_("Mike Taht"),
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/xml++.h>
|
||||
#include <pbd/replace_all.h>
|
||||
|
||||
#include <ardour/audioengine.h>
|
||||
#include <ardour/io.h>
|
||||
@@ -2100,6 +2101,12 @@ IO::set_name (string name, void* src)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* replace all colons in the name. i wish we didn't have to do this */
|
||||
|
||||
if (replace_all (name, ":", "-")) {
|
||||
warning << _("you cannot use colons to name objects with I/O connections") << endmsg;
|
||||
}
|
||||
|
||||
for (vector<Port *>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
|
||||
string current_name = (*i)->short_name();
|
||||
current_name.replace (current_name.find (_name), _name.length(), name);
|
||||
|
||||
@@ -36,6 +36,7 @@ pthread_utils.cc
|
||||
receiver.cc
|
||||
stacktrace.cc
|
||||
stateful.cc
|
||||
strreplace.cc
|
||||
strsplit.cc
|
||||
textreceiver.cc
|
||||
transmitter.cc
|
||||
|
||||
8
libs/pbd/pbd/replace_all.h
Normal file
8
libs/pbd/pbd/replace_all.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __pbd_replace_all_h__
|
||||
#define __pbd_replace_all_h__
|
||||
|
||||
#include <string>
|
||||
|
||||
int replace_all (std::string& str, const std::string& target, const std::string& replacement);
|
||||
|
||||
#endif // __pbd_replace_all_h__
|
||||
19
libs/pbd/strreplace.cc
Normal file
19
libs/pbd/strreplace.cc
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <pbd/replace_all.h>
|
||||
|
||||
int
|
||||
replace_all (std::string& str,
|
||||
std::string const& target,
|
||||
std::string const& replacement)
|
||||
{
|
||||
std::string::size_type start = str.find (target, 0);
|
||||
int cnt = 0;
|
||||
|
||||
while (start != std::string::npos) {
|
||||
str.replace (start, target.size(), replacement);
|
||||
start = str.find (target, start+replacement.size());
|
||||
++cnt;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user