diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-16 01:53:49 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-16 01:53:49 +0200 |
commit | 2fed063bf167dcb8f900c4a1f11b0a02ae115d16 (patch) | |
tree | 99b41b649fb6a1b6683bd90cd38ab894dd526ce3 /c/pl.cpp | |
parent | 84c3dd3587e219caa80adc2070f0e9fe004c27bc (diff) | |
download | EpisodeBrowser-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/pl.cpp')
-rw-r--r-- | c/pl.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1,3 +1,4 @@ +#include <windows.h> #include <SWI-Prolog.h> #include "pl.h" @@ -33,6 +34,20 @@ int Query::NextSolution() return 0; } +int PL_get_tchars(term_t t, TCHAR **lpTsz, int iFlags) +{ +#ifdef UNICODE + size_t sizLen; + if (!PL_get_wchars(t, &sizLen, lpTsz, iFlags)) + return 0; + return sizLen; +#else + if (!PL_get_chars(t, lpTsz, iFlags)) + return 0; + return -1; +#endif +} + int Plx(const char *szMod, const char *szPred) { term_t t = PL_new_term_refs(0); |