Browse Source

Address reviewer comments.

Laszlo Csomor 6 năm trước cách đây
mục cha
commit
bc813c372e

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

@@ -1432,14 +1432,14 @@ CommandLineInterface::InterpretArgument(const std::string& name,
 #if defined(_WIN32)
     // On Windows, the shell (typically cmd.exe) does not expand wildcards in
     // file names (e.g. foo\*.proto), so we do it ourselves.
-    switch (google::protobuf::internal::win32::expand_wildcards(
+    switch (google::protobuf::io::win32::expand_wildcards(
           value,
           [this](const string& path) {
             this->input_files_.push_back(path);
           })) {
-      case google::protobuf::internal::win32::ExpandWildcardsResult::kSuccess:
+      case google::protobuf::io::win32::ExpandWildcardsResult::kSuccess:
         break;
-      case google::protobuf::internal::win32::ExpandWildcardsResult::kErrorNoMatchingFile:
+      case google::protobuf::io::win32::ExpandWildcardsResult::kErrorNoMatchingFile:
         // Path does not exist, is not a file, or it's longer than MAX_PATH and
         // long path handling is disabled.
         std::cerr << "Invalid file name pattern or missing input file \""

+ 1 - 1
src/google/protobuf/io/io_win32.cc

@@ -362,7 +362,7 @@ wstring testonly_utf8_to_winpath(const char* path) {
   return as_windows_path(path, &wpath) ? wpath : wstring();
 }
 
-bool expand_wildcards(
+int expand_wildcards(
     const string& path, std::function<void(const string&)> consume) {
   if (path.find_first_of("*?") == string::npos) {
     // There are no wildcards in the path, we don't need to expand it.

+ 2 - 6
src/google/protobuf/io/io_win32.h

@@ -92,12 +92,8 @@ struct ExpandWildcardsResult {
 // in the last path segment. This function passes all matching file names to
 // `consume`. The resulting paths may not be absolute nor normalized.
 //
-// The function returns true if the path did not contain any wildcards (in
-// which case the path may or may not exist), or the path did contain wildcards
-// and it matched at least one file.
-// The function returns false if the path contained wildcards but it did not
-// match any files.
-LIBPROTOBUF_EXPORT bool expand_wildcards(
+// The function returns a value from `ExpandWildcardsResult`.
+LIBPROTOBUF_EXPORT int expand_wildcards(
     const std::string& path, std::function<void(const std::string&)> consume);
 
 namespace strings {