use strrchr instead of a loop
This commit is contained in:
11
src/song.cpp
11
src/song.cpp
@@ -58,14 +58,9 @@ Song::Song(mpd_Song *s, bool copy_ptr) : itsSong(s),
|
|||||||
|
|
||||||
if (itsSong->file)
|
if (itsSong->file)
|
||||||
{
|
{
|
||||||
for (size_t i = file_len-1; i < file_len; i--)
|
char *tmp = strrchr(itsSong->file, '/');
|
||||||
{
|
if (tmp)
|
||||||
if (itsSong->file[i] == '/')
|
itsSlash = tmp-itsSong->file;
|
||||||
{
|
|
||||||
itsSlash = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (strncmp(itsSong->file, "http://", 7) == 0)
|
if (strncmp(itsSong->file, "http://", 7) == 0)
|
||||||
isStream = 1;
|
isStream = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user