diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2013-08-16 17:53:28 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2013-08-16 17:53:28 +0000 |
commit | b16cf535dd57ec973e71d037c82b9e4e5af81e1f (patch) | |
tree | 4952adb97029a86984231671d47b65cae1a19f01 /llvm/lib/Support/Windows/Path.inc | |
parent | d9fd87bdf9834c9f334c02ae32817712e0ebd244 (diff) | |
download | bcm5719-llvm-b16cf535dd57ec973e71d037c82b9e4e5af81e1f.tar.gz bcm5719-llvm-b16cf535dd57ec973e71d037c82b9e4e5af81e1f.zip |
Switching to using a helper function instead of manually converting the string to UTF-8.
llvm-svn: 188566
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r-- | llvm/lib/Support/Windows/Path.inc | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc index 1694cb28b23..093f374a29a 100644 --- a/llvm/lib/Support/Windows/Path.inc +++ b/llvm/lib/Support/Windows/Path.inc @@ -310,30 +310,7 @@ retry_cur_dir: } cur_path.set_size(len); - // cur_path now holds the current directory in utf-16. Convert to utf-8. - - // Find out how much space we need. Sadly, this function doesn't return the - // size needed unless you tell it the result size is 0, which means you - // _always_ have to call it twice. - len = ::WideCharToMultiByte(CP_UTF8, 0, - cur_path.data(), cur_path.size(), - result.data(), 0, - NULL, NULL); - - if (len == 0) - return make_error_code(windows_error(::GetLastError())); - - result.reserve(len); - result.set_size(len); - // Now do the actual conversion. - len = ::WideCharToMultiByte(CP_UTF8, 0, - cur_path.data(), cur_path.size(), - result.data(), result.size(), - NULL, NULL); - if (len == 0) - return windows_error(::GetLastError()); - - return error_code::success(); + return UTF16ToUTF8(cur_path.begin(), cur_path.size(), result); } error_code create_directory(const Twine &path, bool &existed) { |