comparators: fix LocaleBasedItemSorting

This commit is contained in:
Andrzej Rybczak
2012-09-09 14:42:13 +02:00
parent 6f81748602
commit 4961e6d6ee
2 changed files with 5 additions and 5 deletions

View File

@@ -59,10 +59,10 @@ bool LocaleBasedItemSorting::operator()(const MPD::Item &a, const MPD::Item &b)
switch (a.type)
{
case MPD::itDirectory:
result = m_cmp(getBasename(a.name), getBasename(b.name)) < 0;
result = m_cmp(getBasename(a.name), getBasename(b.name));
break;
case MPD::itPlaylist:
result = m_cmp(a.name, b.name) < 0;
result = m_cmp(a.name, b.name);
break;
case MPD::itSong:
switch (m_sort_mode)
@@ -75,7 +75,7 @@ bool LocaleBasedItemSorting::operator()(const MPD::Item &a, const MPD::Item &b)
break;
case smCustomFormat:
result = m_cmp(a.song->toString(Config.browser_sort_format),
b.song->toString(Config.browser_sort_format)) < 0;
b.song->toString(Config.browser_sort_format));
break;
}
break;

View File

@@ -43,7 +43,7 @@ class LocaleBasedSorting
LocaleStringComparison m_cmp;
public:
LocaleBasedSorting(const std::locale loc, bool ignore_the) : m_cmp(loc, ignore_the) { }
LocaleBasedSorting(const std::locale &loc, bool ignore_the) : m_cmp(loc, ignore_the) { }
bool operator()(const std::string &a, const std::string &b) const {
return m_cmp(a, b) < 0;
@@ -65,7 +65,7 @@ class LocaleBasedItemSorting
SortMode m_sort_mode;
public:
LocaleBasedItemSorting(const std::locale loc, bool ignore_the, SortMode mode)
LocaleBasedItemSorting(const std::locale &loc, bool ignore_the, SortMode mode)
: m_cmp(loc, ignore_the), m_sort_mode(mode) { }
bool operator()(const MPD::Item &a, const MPD::Item &b) const;