aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-16 01:53:49 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-16 01:53:49 +0200
commit2fed063bf167dcb8f900c4a1f11b0a02ae115d16 (patch)
tree99b41b649fb6a1b6683bd90cd38ab894dd526ce3 /c/main.cpp
parent84c3dd3587e219caa80adc2070f0e9fe004c27bc (diff)
downloadEpisodeBrowser-2fed063bf167dcb8f900c4a1f11b0a02ae115d16.tar.gz
Rewrite TszFromSz as TsmFromSz.
I.e. using std::basic_string<TCHAR> instead of TCHAR *. This removes all unmanaged frees.
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp5
1 files changed, 1 insertions, 4 deletions
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);