Преглед на файлове

Fix build failure on Windows when Unicode build is enabled.

This is a follow up CL for e9abc404df99ef85d3e25aaaccd4aa83e381,
which breaks build when UNICODE macro is defined.

protoc has explicitly called MBCS version of APIs / funcsions
rather than UTF-16 (wchar_t) version of them regardless of
UNICODE macro definition (and it indeed works as expected).
Hence it makes sense to call GetModuleFileNameA explicitly.
Yohei Yukawa преди 10 години
родител
ревизия
8c27eea686
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/google/protobuf/compiler/command_line_interface.cc

+ 1 - 1
src/google/protobuf/compiler/command_line_interface.cc

@@ -189,7 +189,7 @@ bool TryCreateParentDirectory(const string& prefix, const string& filename) {
 bool GetProtocAbsolutePath(string* path) {
 bool GetProtocAbsolutePath(string* path) {
 #ifdef _WIN32
 #ifdef _WIN32
   char buffer[MAX_PATH];
   char buffer[MAX_PATH];
-  int len = GetModuleFileName(NULL, buffer, MAX_PATH);
+  int len = GetModuleFileNameA(NULL, buffer, MAX_PATH);
 #elif __APPLE__
 #elif __APPLE__
   char buffer[PATH_MAX];
   char buffer[PATH_MAX];
   int len = 0;
   int len = 0;