diff options
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -48,7 +48,7 @@ void TerminateMsg(const wchar_t* wsz1, const wchar_t* wsz2) noexcept { wchar_t wsz[256] = {0}; if (wsz2) - wszf(wsz, L"Episode Browser was terminated due to %s: %s.", wsz1, wsz2); + wszf(wsz, L"Episode Browser was terminated due to %s: %s", wsz1, wsz2); else wszf(wsz, L"Episode Browser was terminated due to %s.", wsz1); MessageBox(g_hWnd, wsz, L"Fatal Error", MB_ICONERROR); @@ -59,15 +59,14 @@ void OnTerminate() noexcept try { std::rethrow_exception(std::current_exception()); } catch (const term_t& t) { - std::wstring ws; - if (PlString(t, &ws)) - TerminateMsg(L"a Prolog exception", ws.c_str()); + if (auto wso = PlString(t)) + TerminateMsg(L"a Prolog exception", wso.p); else TerminateMsg(L"a Prolog exception", NULL); } catch (const Win32Error& e) { TerminateMsg(L"a Windows error", e.WhatW()); } catch (const std::exception& e) { - TerminateMsg(L"an exception", WsFromSz(e.what()).c_str()); + TerminateMsg(L"an exception", WsoFromSz(e.what()).p); } catch (...) { TerminateMsg(L"an exception", NULL); } @@ -466,13 +465,13 @@ void WaitFor(const char* szMod, const char* szPred) static atom_t aThread; static int bActive; static int iTimer; - static std::wstring wsPred; + static wstring_owner wsoPred; if (bActive) { - wchar_t wsz[128] = {0}; + wchar_t wsz[256] = {0}; wszf(wsz, L"Another task (%s) is active. " L"Do you want to cancel the existing task and start a new one?", - wsPred.c_str()); + wsoPred.p); if (EBMessageBox(wsz, L"Error", MB_YESNO|MB_ICONWARNING) != IDYES) return; KillTimer(NULL, iTimer); @@ -483,7 +482,8 @@ void WaitFor(const char* szMod, const char* szPred) /* The timer procedure animates an ellipsis in the status bar * while the thread is running. */ - static auto proc = [](HWND, UINT, UINT_PTR, DWORD) -> void { + static auto proc = [](HWND, UINT, UINT_PTR, DWORD) -> void + { static int i = 0; if (Pl("episode_data","thread_running",aThread)) { @@ -501,7 +501,7 @@ void WaitFor(const char* szMod, const char* szPred) Plx(szMod,"thread_create",szPred,&aThread); SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)L"."); if (prefer(iTimer = SetTimer(NULL, -1, 500, proc))) { - wsPred = WsFromSz(szPred); + wsoPred = WsoFromSz(szPred); bActive = 1; } } |