Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use of delete operators #145

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/windows/win_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ std::wstring utf8ToUtf16(std::string input) {
WCHAR *output = new WCHAR[len];
MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, output, len);
std::wstring res(output);
delete output;
delete[] output;
return res;
}

Expand All @@ -15,7 +15,7 @@ std::string utf16ToUtf8(const WCHAR *input, size_t length) {
WideCharToMultiByte(CP_UTF8, 0, input, length, output, len, NULL, NULL);
output[len] = '\0';
std::string res(output);
delete output;
delete[] output;
return res;
}

Expand All @@ -33,12 +33,12 @@ std::string normalizePath(std::string path) {
WCHAR *output = new WCHAR[len];
len = GetLongPathNameW(p.data(), output, len);
if (!len) {
delete output;
delete[] output;
return path;
}

// Convert back to utf8
std::string res = utf16ToUtf8(output + 4, len - 4);
delete output;
delete[] output;
return res;
}
Loading