File Add-compatibility-with-Protobuf-3.20.patch of Package python-onnxruntime

Single argument coded_stream.SetTotalBytesLimit https://github.com/microsoft/onnxruntime/issues/11129

Index: onnxruntime-1.3.1/cmake/external/onnx/onnx/proto_utils.h
===================================================================
--- onnxruntime-1.3.1.orig/cmake/external/onnx/onnx/proto_utils.h
+++ onnxruntime-1.3.1/cmake/external/onnx/onnx/proto_utils.h
@@ -31,7 +31,11 @@ bool ParseProtoFromBytes(Proto* proto, c
   // respectively.
   ::google::protobuf::io::ArrayInputStream input_stream(buffer, static_cast<int>(length));
   ::google::protobuf::io::CodedInputStream coded_stream(&input_stream);
+#if GOOGLE_PROTOBUF_VERSION >= 3011000
+  coded_stream.SetTotalBytesLimit((2048LL << 20) - 1);
+#else
   coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20);
+#endif
   return proto->ParseFromCodedStream(&coded_stream);
 }
 
openSUSE Build Service is sponsored by