From ebabd34385feb629b759216c1f7d85edc20bf2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 30 Jul 2022 03:14:13 +0200 Subject: Add wstring_owner, replacing std::wstring. std::basic_string is nice, but it is not very ergonomic if everything you really need is to automatically free C strings at end of scope. I suppose I could have used std::unique_ptr for this, but I suspect the ergonomics would be worse. --- c/datalistview.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'c/datalistview.cpp') diff --git a/c/datalistview.cpp b/c/datalistview.cpp index ea68f2d..02a399f 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -54,20 +54,20 @@ void DataListView::ShowEpisode(const int iEpisode) LVITEM lviValue = {LVIF_TEXT}; for (int i = 0; q.NextSolution(std::nothrow); i++) { - std::wstring wsKey; - std::wstring wsValue; + wstring_owner wsoKey; + wstring_owner wsoValue; - if (!(PlGet(t+1, &wsKey) && PlGet(t+2, &wsValue))) + if (!(PlGet(t+1, &wsoKey) && PlGet(t+2, &wsoValue))) continue; lviKey.iItem = i; lviKey.iSubItem = 0; - lviKey.pszText = wsKey.data(); + lviKey.pszText = wsoKey.p; ListView_InsertItem(hWnd, &lviKey); lviValue.iItem = i; lviValue.iSubItem = 1; - lviValue.pszText = wsValue.data(); + lviValue.pszText = wsoValue.p; ListView_SetItem(hWnd, &lviValue); } -- cgit v1.2.3