From 58d30975f0d46dc7812b7266c3c2c823695503e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 31 Jul 2022 00:38:17 +0200 Subject: Simplify exception handling. --- c/common.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'c/common.cpp') diff --git a/c/common.cpp b/c/common.cpp index 77d669c..7ce1372 100644 --- a/c/common.cpp +++ b/c/common.cpp @@ -55,6 +55,14 @@ wstring_owner WsoFromSz(const char* const sz, const int iCp) return wsz; } +wstring_owner WsoCopy(const wchar_t* const src) +{ + const int cb = wcslen(src)+1; + wchar_t* dst = new wchar_t[cb]; + memcpy(dst, src, cb*sizeof(wchar_t)); + return dst; +} + /* Win32Error: Exception for Windows API errors. */ Win32Error::Win32Error() : dwErr(GetLastError()) {} -- cgit v1.2.3