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>2022-05-02 00:22:43 +0200
commit809bcfd85fad2ef7d4131c054be4cccd5bcc9d05 (patch)
tree8170cee031af2209afa1905b8703f77b6d748d8e /src/lib/cross_windows.cc
parent9a9ce1aec97db89b00bc216edf7cee5f3d48670e (diff)
Replace some raw arrays with std::vectors.
Diffstat (limited to 'src/lib/cross_windows.cc')
-rw-r--r--src/lib/cross_windows.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc
index a7e7bdd55..f76380836 100644
--- a/src/lib/cross_windows.cc
+++ b/src/lib/cross_windows.cc
@@ -353,10 +353,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);
- string u (utf8);
- delete[] utf8;
+ std::vector<char> utf8(length);
+ WideCharToMultiByte (CP_UTF8, 0, s, -1, utf8.data(), length, 0, 0);
+ string u (utf8.data());
return u;
}