From 23dc657f0af27bdac887f8d18208d544cc9f010e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 2 Aug 2022 23:50:58 +0200 Subject: Improve wstring_owner, rename to wchar_ptr. The user-defined conversion function makes the interface a lot simpler AND safer. --- c/episodelistview.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'c/episodelistview.cpp') 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)) { -- cgit v1.2.3