From 181c1b0e97de774ab8300e1c23b18c08995eb664 Mon Sep 17 00:00:00 2001
From: Dharanendiran <dharanendiran@timesys.com>
Date: Tue, 26 Sep 2023 08:04:38 +0530
Subject: [PATCH] fix-protocol_decoder.cc-with-protobuf-version

---
 rapid/plugin/x/ngs/src/protocol_decoder.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/rapid/plugin/x/ngs/src/protocol_decoder.cc b/rapid/plugin/x/ngs/src/protocol_decoder.cc
index 4bdce173..fb6a9a22 100644
--- a/rapid/plugin/x/ngs/src/protocol_decoder.cc
+++ b/rapid/plugin/x/ngs/src/protocol_decoder.cc
@@ -123,7 +123,11 @@ Error_code Message_decoder::parse(Request &request)
     google::protobuf::io::CodedInputStream stream(reinterpret_cast<const uint8_t*>(request.buffer()),
                                                   static_cast<int>(request.buffer_size()));
     // variable 'mysqlx_max_allowed_packet' has been checked when buffer was filling by data
+#if GOOGLE_PROTOBUF_VERSION >= 3006000
+    stream.SetTotalBytesLimit(static_cast<int>(request.buffer_size()));
+#else
     stream.SetTotalBytesLimit(static_cast<int>(request.buffer_size()), -1 /*no warnings*/);
+#endif
     // Protobuf limits the number of nested objects when decoding messages
     // lets set the value in explicit way (to ensure that is set accordingly with
     // out stack size)
-- 
2.25.1

