summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-07-06 15:36:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-07-06 15:36:06 +0000
commit4e5c5adfbb4c6210afe6ab130a6328d812c31fcb (patch)
tree8a423bf8e9625adc1ec6d9c975db875cba64d2ac /libs
parent9239577c4af8bf8301bd7b1e1cfcba1cf7a512bd (diff)
remove extra use of legalize_for_path() and just make sure that session and snapshot names are not FS-pathological (i.e. containing slash or backslash)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5332 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/utils.h3
-rw-r--r--libs/ardour/session_state.cc26
-rw-r--r--libs/ardour/utils.cc2
3 files changed, 16 insertions, 15 deletions
diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h
index 5f392ca5b4..9e0067c652 100644
--- a/libs/ardour/ardour/utils.h
+++ b/libs/ardour/ardour/utils.h
@@ -32,8 +32,9 @@
class XMLNode;
+Glib::ustring legalize_for_path (Glib::ustring);
+
void elapsed_time_to_str (char *buf, uint32_t seconds);
-Glib::ustring legalize_for_path (Glib::ustring str);
std::ostream& operator<< (std::ostream& o, const ARDOUR::BBT_Time& bbt);
XMLNode* find_named_node (const XMLNode& node, std::string name);
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 9b696a6254..6e13e3977f 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -601,7 +601,7 @@ Session::remove_pending_capture_state ()
string xml_path;
xml_path = _path;
- xml_path += legalize_for_path (_current_snapshot_name);
+ xml_path += _current_snapshot_name;
xml_path += _pending_suffix;
unlink (xml_path.c_str());
@@ -618,8 +618,8 @@ Session::rename_state (string old_name, string new_name)
return;
}
- const string old_xml_path = _path + legalize_for_path (old_name) + _statefile_suffix;
- const string new_xml_path = _path + legalize_for_path (new_name) + _statefile_suffix;
+ const string old_xml_path = _path + old_name + _statefile_suffix;
+ const string new_xml_path = _path + new_name + _statefile_suffix;
if (rename (old_xml_path.c_str(), new_xml_path.c_str()) != 0) {
error << string_compose(_("could not rename snapshot %1 to %2"), old_name, new_name) << endmsg;
@@ -637,7 +637,7 @@ Session::remove_state (string snapshot_name)
return;
}
- const string xml_path = _path + legalize_for_path (snapshot_name) + _statefile_suffix;
+ const string xml_path = _path + snapshot_name + _statefile_suffix;
/* make a backup copy of the state file */
const string bak_path = xml_path + ".bak";
@@ -676,7 +676,7 @@ Session::save_state (string snapshot_name, bool pending)
/* proper save: use _statefile_suffix (.ardour in English) */
xml_path = _path;
- xml_path += legalize_for_path (snapshot_name);
+ xml_path += snapshot_name;
xml_path += _statefile_suffix;
/* make a backup copy of the old file */
@@ -691,7 +691,7 @@ Session::save_state (string snapshot_name, bool pending)
/* pending save: use _pending_suffix (.pending in English) */
xml_path = _path;
- xml_path += legalize_for_path (snapshot_name);
+ xml_path += snapshot_name;
xml_path += _pending_suffix;
}
@@ -699,7 +699,7 @@ Session::save_state (string snapshot_name, bool pending)
string tmp_path;
tmp_path = _path;
- tmp_path += legalize_for_path (snapshot_name);
+ tmp_path += snapshot_name;
tmp_path += ".tmp";
// cerr << "actually writing state to " << xml_path << endl;
@@ -762,7 +762,7 @@ Session::load_state (string snapshot_name)
/* check for leftover pending state from a crashed capture attempt */
xmlpath = _path;
- xmlpath += legalize_for_path (snapshot_name);
+ xmlpath += snapshot_name;
xmlpath += _pending_suffix;
if (Glib::file_test (xmlpath, Glib::FILE_TEST_EXISTS)) {
@@ -777,7 +777,7 @@ Session::load_state (string snapshot_name)
if (!state_was_pending) {
xmlpath = _path;
- xmlpath += legalize_for_path (snapshot_name);
+ xmlpath += snapshot_name;
xmlpath += _statefile_suffix;
}
@@ -824,7 +824,7 @@ Session::load_state (string snapshot_name)
string backup_path;
backup_path = _path;
- backup_path += legalize_for_path (snapshot_name);
+ backup_path += snapshot_name;
backup_path += "-1";
backup_path += _statefile_suffix;
@@ -2666,7 +2666,7 @@ Session::find_all_sources_across_snapshots (set<string>& result, bool exclude_th
}
this_snapshot_path = _path;
- this_snapshot_path += legalize_for_path (_current_snapshot_name);
+ this_snapshot_path += _current_snapshot_name;
this_snapshot_path += _statefile_suffix;
for (vector<string*>::iterator i = state_files->begin(); i != state_files->end(); ++i) {
@@ -3111,7 +3111,7 @@ Session::save_history (string snapshot_name)
snapshot_name = _current_snapshot_name;
}
- xml_path = _path + legalize_for_path (snapshot_name) + ".history";
+ xml_path = _path + snapshot_name + ".history";
bak_path = xml_path + ".bak";
@@ -3160,7 +3160,7 @@ Session::restore_history (string snapshot_name)
}
/* read xml */
- xmlpath = _path + legalize_for_path (snapshot_name) + ".history";
+ xmlpath = _path + snapshot_name + ".history";
cerr << string_compose(_("Loading history from '%1'."), xmlpath) << endmsg;
if (!Glib::file_test (xmlpath, Glib::FILE_TEST_EXISTS)) {
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc
index 8927e2a9c6..684c4b49f6 100644
--- a/libs/ardour/utils.cc
+++ b/libs/ardour/utils.cc
@@ -94,7 +94,7 @@ legalize_for_path (ustring str)
ustring::size_type pos;
ustring legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: ";
ustring legal;
-
+
legal = str;
pos = 0;