fix Engine::validatePath() to accept a const ref
This commit is contained in:
parent
67010e02c2
commit
15c30e0d00
@ -249,24 +249,17 @@ void Engine::checkForAllHandlerFunctions()
|
|||||||
checkForFunction("mouse_motion_event", mouse_motion);
|
checkForFunction("mouse_motion_event", mouse_motion);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Engine::validatePath(string & path)
|
bool Engine::validatePath(const string & path)
|
||||||
{
|
{
|
||||||
if (path.find_first_not_of(FILENAME_SAFE_CHARS) != string::npos)
|
if (path[0] == '/')
|
||||||
return false;
|
return false;
|
||||||
if (path[0] == ':')
|
vector<string> parts = split(path, '/');
|
||||||
return false;
|
|
||||||
vector<string> parts = split(path, ':');
|
|
||||||
path = "";
|
|
||||||
bool multiple = false;
|
|
||||||
for (int i = 0, sz = parts.size(); i < sz; i++)
|
for (int i = 0, sz = parts.size(); i < sz; i++)
|
||||||
{
|
{
|
||||||
if (parts[i].find_first_not_of(".") != string::npos)
|
if (parts[i].find_first_not_of(FILENAME_SAFE_CHARS) != string::npos)
|
||||||
{
|
return false;
|
||||||
if (multiple)
|
if (parts[i].find_first_not_of(".") == string::npos)
|
||||||
path += "/";
|
return false;
|
||||||
path += parts[i];
|
|
||||||
multiple = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ class Engine
|
|||||||
m_av.setCursorVisible(
|
m_av.setCursorVisible(
|
||||||
m_engine_cursor_visible || m_script_cursor_visible);
|
m_engine_cursor_visible || m_script_cursor_visible);
|
||||||
}
|
}
|
||||||
bool validatePath(std::string & path);
|
bool validatePath(const std::string & path);
|
||||||
int getFileSize(const char *fname);
|
int getFileSize(const char *fname);
|
||||||
|
|
||||||
AV & m_av;
|
AV & m_av;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user