aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2017-12-01 11:31:12 +0100
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2017-12-07 15:31:49 +0100
commita3a1c93fb4bb204fd42cb91ac1053f93bec4da7a (patch)
tree7898d5d28b8b72297b28eff95615b81064066f99 /src/google/protobuf/stubs
parenteb3bd6ec297b4dff3734c51a159713e559f5c2cf (diff)
io_win32_unittest: remove incorrect error check
Unlike GetEnvironmentVariableW, GetCurrentDirectoryW doesn't set ERROR_INSUFFICIENT_BUFFER.
Diffstat (limited to 'src/google/protobuf/stubs')
-rw-r--r--src/google/protobuf/stubs/io_win32_unittest.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/google/protobuf/stubs/io_win32_unittest.cc b/src/google/protobuf/stubs/io_win32_unittest.cc
index 710548a2..b216aece 100644
--- a/src/google/protobuf/stubs/io_win32_unittest.cc
+++ b/src/google/protobuf/stubs/io_win32_unittest.cc
@@ -122,7 +122,7 @@ bool GetEnvVarAsUtf8(const WCHAR* name, string* result) {
// to be no API function to do that conversion directly.
// GetEnvironmentVariableW retrieves an UTF-16-encoded text, which we need
// to convert to UTF-8.
- return strings::wcs_to_mbs(wcs.get(), result, true);
+ return strings::wcs_to_utf8(wcs.get(), result);
} else {
return false;
}
@@ -130,7 +130,7 @@ bool GetEnvVarAsUtf8(const WCHAR* name, string* result) {
bool GetCwdAsUtf8(string* result) {
DWORD size = ::GetCurrentDirectoryW(0, NULL);
- if (size > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+ if (size > 0) {
scoped_array<WCHAR> wcs(new WCHAR[size]);
::GetCurrentDirectoryW(size, wcs.get());
// GetCurrentDirectoryA retrieves an Active-Code-Page-encoded text which
@@ -138,7 +138,7 @@ bool GetCwdAsUtf8(string* result) {
// to be no API function to do that conversion directly.
// GetCurrentDirectoryW retrieves an UTF-16-encoded text, which we need
// to convert to UTF-8.
- return strings::wcs_to_mbs(wcs.get(), result, true);
+ return strings::wcs_to_utf8(wcs.get(), result);
} else {
return false;
}