diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-30 03:14:13 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-30 03:14:13 +0200 |
commit | ebabd34385feb629b759216c1f7d85edc20bf2fd (patch) | |
tree | 432e68a6a58bcaf4bc1dd3c5ae438157f09f4d4a /c/datalistview.cpp | |
parent | d485eb2bf7e0a82702afec9387f21bf0f89c985f (diff) | |
download | EpisodeBrowser-ebabd34385feb629b759216c1f7d85edc20bf2fd.tar.gz |
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.
Diffstat (limited to 'c/datalistview.cpp')
-rw-r--r-- | c/datalistview.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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); } |