From 03fe36165b6767bc4e0d26bf1b1de38fdff3f75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 17 Jul 2022 00:50:37 +0200 Subject: Use SWI-Prolog's wide-character functions. This avoids the use of TsmFromSz. --- c/datalistview.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'c/datalistview.cpp') diff --git a/c/datalistview.cpp b/c/datalistview.cpp index f75fc99..532e3a6 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -9,6 +9,7 @@ #include "episodelistview.h" #include "listview.h" #include "main.h" +#include "pl.h" extern EpisodeListView *g_lpElv; @@ -44,24 +45,21 @@ void DataListView::ShowEpisode(int iEpisode) PL_predicate("episode_datum", 3, "episode_data"), t); for (int i = 0; PL_next_solution(q); i++) { - char *szKey; - char *szValue; + TCHAR *tszKey; + TCHAR *tszValue; - if (!(PL_get_atom_chars(t+1,&szKey) && PL_get_atom_chars(t+2,&szValue))) + if (!(PlGet(t+1, &tszKey) && PlGet(t+2, &tszValue))) continue; - std::basic_string tsmKey = TsmFromSz(szKey, CP_UTF8); - std::basic_string tsmValue = TsmFromSz(szValue, CP_UTF8); - lviKey.mask = LVIF_TEXT; lviKey.iItem = i; lviKey.iSubItem = 0; - lviKey.pszText = tsmKey.data(); + lviKey.pszText = tszKey; ListView_InsertItem(m_hWnd, &lviKey); lviValue.iItem = i; lviValue.iSubItem = 1; - lviValue.pszText = tsmValue.data(); + lviValue.pszText = tszValue; ListView_SetItem(m_hWnd, &lviValue); } -- cgit v1.2.3