Fixed: getLastSeparator should return std::string::size_type instead of an integer

This commit is contained in:
kervala 2016-01-13 19:47:35 +01:00
parent 12e16e83e2
commit 50c796236b
2 changed files with 3 additions and 3 deletions

View file

@ -618,7 +618,7 @@ struct CFile
* Return the position between [begin,end[ of the last separator between path and filename ('/' or '\'). * Return the position between [begin,end[ of the last separator between path and filename ('/' or '\').
* If there's no separator, it returns string::npos. * If there's no separator, it returns string::npos.
*/ */
static int getLastSeparator (const std::string &filename); static std::string::size_type getLastSeparator (const std::string &filename);
static std::string getFilenameWithoutExtension (const std::string &filename); static std::string getFilenameWithoutExtension (const std::string &filename);
static std::string getExtension (const std::string &filename); static std::string getExtension (const std::string &filename);

View file

@ -1854,7 +1854,7 @@ std::string CFileContainer::getTemporaryDirectory()
////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////
int CFile::getLastSeparator (const string &filename) std::string::size_type CFile::getLastSeparator (const string &filename)
{ {
string::size_type pos = filename.find_last_of ('/'); string::size_type pos = filename.find_last_of ('/');
if (pos == string::npos) if (pos == string::npos)
@ -1865,7 +1865,7 @@ int CFile::getLastSeparator (const string &filename)
pos = filename.find_last_of ('@'); pos = filename.find_last_of ('@');
} }
} }
return (int)pos; return pos;
} }
string CFile::getFilename (const string &filename) string CFile::getFilename (const string &filename)