From 2fed063bf167dcb8f900c4a1f11b0a02ae115d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 16 Jul 2022 01:53:49 +0200 Subject: Rewrite TszFromSz as TsmFromSz. I.e. using std::basic_string instead of TCHAR *. This removes all unmanaged frees. --- c/main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'c/main.cpp') diff --git a/c/main.cpp b/c/main.cpp index 6ed7ac1..c1d05a6 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -134,12 +134,9 @@ void OnTerminate() try { std::rethrow_exception(std::current_exception()); } catch (term_t &t) { - char *sz; TCHAR *tsz; - /* TODO: PL_get_wchars */ - if (PL_get_chars(t, &sz, CVT_WRITE) && (tsz = TszFromSz(sz, CP_UTF8))) { + if (PL_get_tchars(t, &tsz, CVT_WRITE)) { MessageBox(NULL, tsz, TEXT("Fatal Error"), MB_ICONERROR); - free(tsz); } else MessageBoxA(NULL, "The program was terminated due to a Prolog exception.", "Fatal Error", MB_ICONERROR); -- cgit v1.2.3