Explorar o código

io_win32_unittest: fix condition in GetCwdAsUtf8

Laszlo Csomor %!s(int64=7) %!d(string=hai) anos
pai
achega
eb3bd6ec29
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/google/protobuf/stubs/io_win32_unittest.cc

+ 1 - 1
src/google/protobuf/stubs/io_win32_unittest.cc

@@ -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 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
     scoped_array<WCHAR> wcs(new WCHAR[size]);
     ::GetCurrentDirectoryW(size, wcs.get());
     // GetCurrentDirectoryA retrieves an Active-Code-Page-encoded text which