aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/episodelistview.c')
-rw-r--r--c/episodelistview.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index bd5a28c..21a8e3d 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -193,9 +193,10 @@ ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM iSort)
lvi1.iItem = iItem1; lvi2.iItem = iItem2;
if (!ListView_GetItem(HElv, &lvi1)) return 0;
if (!ListView_GetItem(HElv, &lvi2)) return 0;
+ iOrder = Cmp(iSort, 0);
switch (abs(iSort)) {
case 1: /* Sort by episode number. */
- iOrder = lvi1.lParam > lvi2.lParam? 1: -1;
+ return iOrder*Cmp(lvi1.lParam, lvi2.lParam);
break;
case 2: /* Sort by rating. */
{
@@ -211,7 +212,9 @@ ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM iSort)
PI(t2,lvi2.lParam) goto f;
P("episode_data","episode_rating",2,t2) goto f;
GI(t2+1,&iRating2);
- f: iOrder = iRating1 > iRating2? 1: -1;
+ f: if (iRating1 == iRating2)
+ return Cmp(lvi1.lParam, lvi2.lParam);
+ return iOrder*Cmp(iRating1, iRating2);
break;
}
case 3: /* Sort by title. */
@@ -230,13 +233,12 @@ ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM iSort)
cch1 = strlen(sz1);
cch2 = strlen(sz2);
cch = cch1 > cch2? cch2: cch1;
- iOrder = _strnicmp(sz1, sz2, cch);
+ return iOrder*_strnicmp(sz1, sz2, cch);
break;
}
default:
return 0;
}
- return iSort > 0? iOrder: iOrder*-1;
}
/* Update episode list. */