summaryrefslogtreecommitdiff
path: root/src/lib/cross_windows.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-10-11 19:55:06 +0200
committerCarl Hetherington <cth@carlh.net>2021-10-11 20:13:21 +0200
commit44b69f2d9affb048c3d166e3a62bf3462dd5c8b5 (patch)
tree7cf2a540d01c66f9a7d12acfdabd0ee2f4251c80 /src/lib/cross_windows.cc
parent805d4a48fa6e4d8e28fd582a2ae6ba78b8343144 (diff)
Replace some raw arrays with std::vectors.
Diffstat (limited to 'src/lib/cross_windows.cc')
-rw-r--r--src/lib/cross_windows.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc
index b3d9a1558..01bbe521d 100644
--- a/src/lib/cross_windows.cc
+++ b/src/lib/cross_windows.cc
@@ -355,10 +355,9 @@ static string
wchar_to_utf8 (wchar_t const * s)
{
int const length = (wcslen(s) + 1) * 2;
- char* utf8 = new char[length];
- WideCharToMultiByte (CP_UTF8, 0, s, -1, utf8, length, 0, 0);
+ std::vector<char> utf8(length);
+ WideCharToMultiByte (CP_UTF8, 0, s, -1, utf8.data(), length, 0, 0);
string u (utf8);
- delete[] utf8;
return u;
}