mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-12 17:46:34 +01:00
Do not allow ctrl chars in file (or session) names (1/2)
This commit is contained in:
parent
e848afe2ec
commit
72d45c154a
4 changed files with 14 additions and 8 deletions
|
|
@ -357,7 +357,8 @@ public:
|
||||||
template<class A> void foreach_route (void (Route::*method)(A), A arg);
|
template<class A> void foreach_route (void (Route::*method)(A), A arg);
|
||||||
template<class A1, class A2> void foreach_route (void (Route::*method)(A1, A2), A1 arg1, A2 arg2);
|
template<class A1, class A2> void foreach_route (void (Route::*method)(A1, A2), A1 arg1, A2 arg2);
|
||||||
|
|
||||||
static char session_name_is_legal (const std::string&);
|
static const std::string session_name_is_legal (const std::string&);
|
||||||
|
|
||||||
bool io_name_is_legal (const std::string&) const;
|
bool io_name_is_legal (const std::string&) const;
|
||||||
boost::shared_ptr<Route> route_by_name (std::string) const;
|
boost::shared_ptr<Route> route_by_name (std::string) const;
|
||||||
boost::shared_ptr<Route> route_by_id (PBD::ID) const;
|
boost::shared_ptr<Route> route_by_id (PBD::ID) const;
|
||||||
|
|
|
||||||
|
|
@ -828,7 +828,7 @@ MidiRegion::set_name (const std::string& str)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Session::session_name_is_legal (str) != 0) {
|
if (!Session::session_name_is_legal (str).empty ()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6760,18 +6760,23 @@ Session::update_latency_compensation (bool force_whole_graph, bool called_from_b
|
||||||
DEBUG_TRACE (DEBUG::LatencyCompensation, "update_latency_compensation: complete\n");
|
DEBUG_TRACE (DEBUG::LatencyCompensation, "update_latency_compensation: complete\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
char
|
const std::string
|
||||||
Session::session_name_is_legal (const string& path)
|
Session::session_name_is_legal (const string& path)
|
||||||
{
|
{
|
||||||
char illegal_chars[] = { '/', '\\', ':', ';', '\0' };
|
char illegal_chars[] = { '/', '\\', ':', ';' };
|
||||||
|
|
||||||
for (int i = 0; illegal_chars[i]; ++i) {
|
for (int i = 0; illegal_chars[i]; ++i) {
|
||||||
if (path.find (illegal_chars[i]) != string::npos) {
|
if (path.find (illegal_chars[i]) != string::npos) {
|
||||||
return illegal_chars[i];
|
return std::string (1, illegal_chars[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
for (size_t i = 0; i < path.length(); ++i) {
|
||||||
|
if (iscntrl (path[i])) {
|
||||||
|
return _("Control Char");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return std::string ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -2933,9 +2933,9 @@ OSC::name_session (char *n, lo_message msg)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
string new_name = n;
|
string new_name = n;
|
||||||
char illegal = Session::session_name_is_legal (new_name);
|
std::string const& illegal = Session::session_name_is_legal (new_name);
|
||||||
|
|
||||||
if (illegal) {
|
if (!illegal.empty()) {
|
||||||
PBD::warning << (string_compose (_("To ensure compatibility with various systems\n"
|
PBD::warning << (string_compose (_("To ensure compatibility with various systems\n"
|
||||||
"session names may not contain a '%1' character"), illegal)) << endmsg;
|
"session names may not contain a '%1' character"), illegal)) << endmsg;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue