summaryrefslogtreecommitdiff
path: root/math/py-or-tools/files/patch-protobuf
blob: f8fa931455b50f1c31208d1ba7a9dc1c2722b6f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Obtained from:	https://github.com/google/or-tools/commit/4cbd27dae94609e1c9413e4c4614c250758f9d9e
		https://github.com/google/or-tools/commit/516a777f55e66caf70c27ad7e81f7d8850d36079

--- ortools/base/file.cc.orig	2023-11-13 09:51:25 UTC
+++ ortools/base/file.cc
@@ -224,7 +224,8 @@ class NoOpErrorCollector : public google::protobuf::io
 namespace {
 class NoOpErrorCollector : public google::protobuf::io::ErrorCollector {
  public:
-  void AddError(int line, int column, const std::string& message) override {}
+  void RecordError(int /*line*/, int /*column*/,
+                   absl::string_view /*message*/) override {}
 };
 }  // namespace
 
--- ortools/util/file_util.cc.orig	2023-11-13 09:51:25 UTC
+++ ortools/util/file_util.cc
@@ -137,7 +137,7 @@ bool WriteProtoToFile(absl::string_view filename,
     case ProtoWriteFormat::kJson: {
       google::protobuf::util::JsonPrintOptions options;
       options.add_whitespace = true;
-      options.always_print_primitive_fields = true;
+      options.always_print_fields_with_no_presence = true;
       options.preserve_proto_field_names = true;
       if (!google::protobuf::util::MessageToJsonString(proto, &output_string,
                                                        options)
--- ortools/util/parse_proto.cc.orig	2023-11-13 09:51:25 UTC
+++ ortools/util/parse_proto.cc
@@ -36,11 +36,16 @@ class TextFormatErrorCollector : public google::protob
   TextFormatErrorCollector() = default;
   ~TextFormatErrorCollector() override = default;
 
-  void AddError(int line, int column, const std::string& message) override {
-    collected_errors_.push_back({false, line, column, message});
+  void RecordError(const int line, const int column,
+                   absl::string_view message) override {
+    collected_errors_.push_back(
+        {/*warning=*/false, line, column, std::string(message)});
   }
-  void AddWarning(int line, int column, const std::string& message) override {
-    collected_errors_.push_back({true, line, column, message});
+
+  void RecordWarning(const int line, const int column,
+                    absl::string_view message) override {
+    collected_errors_.push_back(
+        {/*warning=*/true, line, column, std::string(message)});
   }
 
   // Returns a string listing each collected error.  When an error is associated