Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnderground78 <underground78@users.sourceforge.net>2015-08-01 12:47:32 +0300
committerUnderground78 <underground78@users.sourceforge.net>2015-08-01 16:03:35 +0300
commit92dfbf2dc3e5f9ae931a064756208face829c017 (patch)
tree21f74647e4d7638bec52024d5fc9c9aaed56e62a
parentcc4349973609d0794d0522b1caea301732fa208f (diff)
Fix: MPC-HC playlists were incorrectly sorted at parsing.
The sort function was wrong and ended up doing nothing.
-rw-r--r--src/mpc-hc/PlayerPlaylistBar.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/mpc-hc/PlayerPlaylistBar.cpp b/src/mpc-hc/PlayerPlaylistBar.cpp
index af4846d63..dcf7937e7 100644
--- a/src/mpc-hc/PlayerPlaylistBar.cpp
+++ b/src/mpc-hc/PlayerPlaylistBar.cpp
@@ -318,11 +318,6 @@ void CPlayerPlaylistBar::ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>
AddItem(fns, subs);
}
-static int s_int_comp(const void* i1, const void* i2)
-{
- return (int)i1 - (int)i2;
-}
-
static CString CombinePath(CPath p, CString fn)
{
if (fn.Find(':') >= 0 || fn.Find(_T("\\")) == 0) {
@@ -355,7 +350,7 @@ bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn)
{
CString str;
CAtlMap<int, CPlaylistItem> pli;
- CAtlArray<int> idx;
+ std::vector<int> idx;
CWebTextFile f(CTextFile::UTF8);
if (!f.Open(fn) || !f.ReadString(str) || str != _T("MPCPLAYLIST")) {
@@ -382,7 +377,7 @@ bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn)
if (key == _T("type")) {
pli[i].m_type = (CPlaylistItem::type_t)_ttol(value);
- idx.Add(i);
+ idx.push_back(i);
} else if (key == _T("label")) {
pli[i].m_label = value;
} else if (key == _T("filename")) {
@@ -413,9 +408,9 @@ bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn)
}
}
- qsort(idx.GetData(), idx.GetCount(), sizeof(int), s_int_comp);
- for (size_t i = 0; i < idx.GetCount(); i++) {
- m_pl.AddTail(pli[idx[i]]);
+ std::sort(idx.begin(), idx.end());
+ for (int i : idx) {
+ m_pl.AddTail(pli[i]);
}
return !pli.IsEmpty();