summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-05-12 10:43:37 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-06-29 14:18:12 -0400
commit125c5e224c964b98ae2a460aa36494231cad3f66 (patch)
tree29cdc8d60b5994dd889425f82fe8f21f98d963c8 /libs
parenteab6e309b23e658c98b730b532338d8d83cb23c9 (diff)
superior fix for limits on track name length
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/session.cc24
2 files changed, 13 insertions, 13 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index a313c0a9c6..0a4ca3951c 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1471,7 +1471,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void route_processors_changed (RouteProcessorChange);
- bool find_route_name (std::string const &, uint32_t& id, char* name, size_t name_len, bool);
+ bool find_route_name (std::string const &, uint32_t& id, std::string& name, bool);
void count_existing_track_channels (ChanCount& in, ChanCount& out);
void auto_connect_route (boost::shared_ptr<Route> route, ChanCount& existing_inputs, ChanCount& existing_outputs,
bool with_lock, bool connect_inputs = true,
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 17fb4e5339..e60c27bf77 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -2163,16 +2163,16 @@ Session::resort_routes_using (boost::shared_ptr<RouteList> r)
* and \a id do not reflect a free route name.
*/
bool
-Session::find_route_name (string const & base, uint32_t& id, char* name, size_t name_len, bool definitely_add_number)
+Session::find_route_name (string const & base, uint32_t& id, string& name, bool definitely_add_number)
{
if (!definitely_add_number && route_by_name (base) == 0) {
/* juse use the base */
- snprintf (name, name_len, "%s", base.c_str());
+ name = base;
return true;
}
do {
- snprintf (name, name_len, "%s %" PRIu32, base.c_str(), id);
+ name = string_compose ("%1 %2", base, id);
if (route_by_name (name) == 0) {
return true;
@@ -2211,7 +2211,7 @@ list<boost::shared_ptr<MidiTrack> >
Session::new_midi_track (const ChanCount& input, const ChanCount& output, boost::shared_ptr<PluginInfo> instrument,
TrackMode mode, RouteGroup* route_group, uint32_t how_many, string name_template)
{
- char track_name[1024];
+ string track_name;
uint32_t track_id = 0;
string port;
RouteList new_routes;
@@ -2220,7 +2220,7 @@ Session::new_midi_track (const ChanCount& input, const ChanCount& output, boost:
bool const use_number = (how_many != 1) || name_template.empty () || name_template == _("MIDI");
while (how_many) {
- if (!find_route_name (name_template.empty() ? _("MIDI") : name_template, ++track_id, track_name, sizeof(track_name), use_number)) {
+ if (!find_route_name (name_template.empty() ? _("MIDI") : name_template, ++track_id, track_name, use_number)) {
error << "cannot find name for new midi track" << endmsg;
goto failed;
}
@@ -2747,7 +2747,7 @@ list< boost::shared_ptr<AudioTrack> >
Session::new_audio_track (int input_channels, int output_channels, TrackMode mode, RouteGroup* route_group,
uint32_t how_many, string name_template)
{
- char track_name[1024];
+ string track_name;
uint32_t track_id = 0;
string port;
RouteList new_routes;
@@ -2765,7 +2765,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
while (how_many) {
- if (!find_route_name (name_template.empty() ? _(name_pattern.c_str()) : name_template, ++track_id, track_name, sizeof(track_name), use_number)) {
+ if (!find_route_name (name_template.empty() ? _(name_pattern.c_str()) : name_template, ++track_id, track_name, use_number)) {
error << "cannot find name for new audio track" << endmsg;
goto failed;
}
@@ -2868,7 +2868,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
RouteList
Session::new_audio_route (int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many, string name_template)
{
- char bus_name[32];
+ string bus_name;
uint32_t bus_id = 0;
string port;
RouteList ret;
@@ -2876,7 +2876,7 @@ Session::new_audio_route (int input_channels, int output_channels, RouteGroup* r
bool const use_number = (how_many != 1) || name_template.empty () || name_template == _("Bus");
while (how_many) {
- if (!find_route_name (name_template.empty () ? _("Bus") : name_template, ++bus_id, bus_name, sizeof(bus_name), use_number)) {
+ if (!find_route_name (name_template.empty () ? _("Bus") : name_template, ++bus_id, bus_name, use_number)) {
error << "cannot find name for new audio bus" << endmsg;
goto failure;
}
@@ -2982,7 +2982,7 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template
node_copy.remove_property_recursively (X_("id"));
try {
- char name[32];
+ string name;
if (!name_base.empty()) {
@@ -2991,7 +2991,7 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template
* numbered, via the final parameter.
*/
- if (!find_route_name (name_base.c_str(), ++number, name, sizeof(name), (being_added > 1))) {
+ if (!find_route_name (name_base.c_str(), ++number, name, (being_added > 1))) {
fatal << _("Session: UINT_MAX routes? impossible!") << endmsg;
/*NOTREACHDE*/
}
@@ -3001,7 +3001,7 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template
string const route_name = node_copy.property(X_("name"))->value ();
/* generate a new name by adding a number to the end of the template name */
- if (!find_route_name (route_name.c_str(), ++number, name, sizeof(name), true)) {
+ if (!find_route_name (route_name.c_str(), ++number, name, true)) {
fatal << _("Session: UINT_MAX routes? impossible!") << endmsg;
abort(); /*NOTREACHED*/
}