replace all string::find_last_of() with string::rfind()

find_last_of was working properly only because it was searching
only for one character, string::rfind() is appropriate function
for this job.
This commit is contained in:
Andrzej Rybczak
2009-02-05 21:52:31 +01:00
parent e637d8f627
commit d68824f0f2
4 changed files with 13 additions and 13 deletions

View File

@@ -716,7 +716,7 @@ int main(int argc, char *argv[])
sort(list.begin(), list.end(), CaseInsensitiveSorting());
if (editor_browsed_dir != "/")
{
size_t slash = editor_browsed_dir.find_last_of("/");
size_t slash = editor_browsed_dir.rfind("/");
string parent = slash != string::npos ? editor_browsed_dir.substr(0, slash) : "/";
mEditorDirs->AddOption(make_pair("[..]", parent));
}
@@ -726,7 +726,7 @@ int main(int argc, char *argv[])
}
for (TagList::const_iterator it = list.begin(); it != list.end(); it++)
{
size_t slash = it->find_last_of("/");
size_t slash = it->rfind("/");
string to_display = slash != string::npos ? it->substr(slash+1) : *it;
utf_to_locale(to_display);
mEditorDirs->AddOption(make_pair(to_display, *it));
@@ -1203,7 +1203,7 @@ int main(int argc, char *argv[])
{
Statusbar() << fmtBold << "Filename: " << fmtBoldEnd;
string filename = s.GetNewName().empty() ? s.GetName() : s.GetNewName();
int dot = filename.find_last_of(".");
size_t dot = filename.rfind(".");
string extension = filename.substr(dot);
filename = filename.substr(0, dot);
string new_name = wFooter->GetString(filename);
@@ -1732,7 +1732,7 @@ int main(int argc, char *argv[])
{
Song &s = mEditorTags->Current();
string old_name = s.GetNewName().empty() ? s.GetName() : s.GetNewName();
int last_dot = old_name.find_last_of(".");
size_t last_dot = old_name.rfind(".");
string extension = old_name.substr(last_dot);
old_name = old_name.substr(0, last_dot);
LockStatusbar();