aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-02 23:50:58 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-02 23:50:58 +0200
commit23dc657f0af27bdac887f8d18208d544cc9f010e (patch)
treea2656d96f11f879d6a4233fef736493a1cc39ba6 /c/episodelistview.cpp
parentedce20642b6d177ee9877775cbfa9e05ebb4e404 (diff)
downloadEpisodeBrowser-23dc657f0af27bdac887f8d18208d544cc9f010e.tar.gz
Improve wstring_owner, rename to wchar_ptr.
The user-defined conversion function makes the interface a lot simpler AND safer.
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r--c/episodelistview.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp
index 1c5c9ae..313f82f 100644
--- a/c/episodelistview.cpp
+++ b/c/episodelistview.cpp
@@ -264,16 +264,16 @@ int CALLBACK EpisodeListView::SortProc(const LPARAM iItem1, const LPARAM iItem2,
case ELVSITITLE:
{
Mark m;
- wstring_owner s1, s2;
+ wchar_ptr s1, s2;
int cch, cch1, cch2;
if (!Pl("episode_data","episode_title",lvi1.lParam,&s1))
return 0;
if (!Pl("episode_data","episode_title",lvi2.lParam,&s2))
return 0;
- cch1 = wcslen(s1.p);
- cch2 = wcslen(s2.p);
+ cch1 = wcslen(s1);
+ cch2 = wcslen(s2);
cch = cch1 > cch2? cch2: cch1;
- return order*_wcsnicmp(s1.p, s2.p, cch);
+ return order*_wcsnicmp(s1, s2, cch);
}
default:
return 0;
@@ -404,12 +404,12 @@ void EpisodeListView::Update()
/* Update episode name and rating. */
void EpisodeListView::UpdateItem(const int iItem, const LPARAM lParam)
{
- wstring_owner name;
+ wchar_ptr name;
if (!Pl("episode_data","episode_title",lParam,&name)) {
if (!Pl("episode_data","update_episode_data")) goto r;
if (!Pl("episode_data","episode_title",lParam,&name)) goto r;
}
- ListView_SetItemText(hWnd, iItem, ELVSITITLE, name.p);
+ ListView_SetItemText(hWnd, iItem, ELVSITITLE, name);
r: int rating;
if (!Pl("episode_data","episode_rating",lParam,&rating)) {