ports/math/or-tools/files/patch-protobuf
2024-09-16 04:11:53 +08:00

46 lines
2.1 KiB
Text

--- 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