summaryrefslogtreecommitdiff
path: root/libs/ardour/io.cc
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2013-08-04 15:17:19 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2013-08-04 15:17:19 +0100
commit07d94b9b4868fad26c9e8ac2ae4901849a09b8ac (patch)
treedf4278a908166a81d65383b1171197172ca47131 /libs/ardour/io.cc
parentfa59391f6a8b8bffbf07fc567d726c40424fe7f7 (diff)
'libs/ardour' - Use 'std::vector' instead of dynamically sized arrays (required to be buildable with MSVC)
Diffstat (limited to 'libs/ardour/io.cc')
-rw-r--r--libs/ardour/io.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 1349d49a0c..4498e4fbd8 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -19,6 +19,7 @@
#include <fstream>
#include <algorithm>
#include <cmath>
+#include <vector>
#include <unistd.h>
#include <locale.h>
@@ -1379,20 +1380,20 @@ IO::build_legal_port_name (DataType type)
limit = name_size - _session.engine().client_name().length() - (suffix.length() + 5);
- char buf1[name_size+1];
- char buf2[name_size+1];
+ std::vector<char> buf1(name_size+1);
+ std::vector<char> buf2(name_size+1);
/* colons are illegal in port names, so fix that */
string nom = _name.val();
replace_all (nom, ":", ";");
- snprintf (buf1, name_size+1, ("%.*s/%s"), limit, nom.c_str(), suffix.c_str());
+ snprintf (&buf1[0], name_size+1, ("%.*s/%s"), limit, nom.c_str(), suffix.c_str());
- int port_number = find_port_hole (buf1);
- snprintf (buf2, name_size+1, "%s %d", buf1, port_number);
+ int port_number = find_port_hole (&buf1[0]);
+ snprintf (&buf2[0], name_size+1, "%s %d", buf1, port_number);
- return string (buf2);
+ return string (&buf2[0]);
}
int32_t
@@ -1410,13 +1411,13 @@ IO::find_port_hole (const char* base)
*/
for (n = 1; n < 9999; ++n) {
- char buf[jack_port_name_size()];
+ std::vector<char> buf(jack_port_name_size());
PortSet::iterator i = _ports.begin();
- snprintf (buf, jack_port_name_size(), _("%s %u"), base, n);
+ snprintf (&buf[0], jack_port_name_size(), _("%s %u"), base, n);
for ( ; i != _ports.end(); ++i) {
- if (i->name() == buf) {
+ if (string(i->name()) == string(&buf[0])) {
break;
}
}