This is an automated email from the ASF dual-hosted git repository.
wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 654ae770 Fix protobuf version compatibility for ByteSizeLong() and
SpaceUsedLong() (#3292)
654ae770 is described below
commit 654ae770ebe1e5a148b76e6bf7d9b79783810d95
Author: Bright Chen <[email protected]>
AuthorDate: Mon May 11 19:55:38 2026 +0800
Fix protobuf version compatibility for ByteSizeLong() and SpaceUsedLong()
(#3292)
---
src/brpc/memcache.cpp | 1 +
src/brpc/nonreflectable_message.h | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/src/brpc/memcache.cpp b/src/brpc/memcache.cpp
index 489d84db..c7d6f836 100644
--- a/src/brpc/memcache.cpp
+++ b/src/brpc/memcache.cpp
@@ -17,6 +17,7 @@
#include "brpc/memcache.h"
+#include <google/protobuf/io/coded_stream.h>
#include "brpc/policy/memcache_binary_header.h"
#include "brpc/proto_base.pb.h"
#include "butil/logging.h"
diff --git a/src/brpc/nonreflectable_message.h
b/src/brpc/nonreflectable_message.h
index 7f2acd78..f805389e 100644
--- a/src/brpc/nonreflectable_message.h
+++ b/src/brpc/nonreflectable_message.h
@@ -163,9 +163,19 @@ public:
#endif
// Size of bytes after serialization.
+#if GOOGLE_PROTOBUF_VERSION < 3004000
+ virtual size_t ByteSizeLong() const {
+ return 0;
+ }
+
+ int ByteSize() const override {
+ return static_cast<int>(ByteSizeLong());
+ }
+#else
size_t ByteSizeLong() const override {
return 0;
}
+#endif
#if GOOGLE_PROTOBUF_VERSION >= 3007000 && GOOGLE_PROTOBUF_VERSION < 3010000
void SerializeWithCachedSizes(::google::protobuf::io::CodedOutputStream*)
const override {}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]