wasphin commented on a change in pull request #1723:
URL: https://github.com/apache/incubator-brpc/pull/1723#discussion_r838452430
##########
File path: src/brpc/protocol.h
##########
@@ -56,6 +56,18 @@ class InputMessageBase;
DECLARE_uint64(max_body_size);
DECLARE_bool(log_error_text);
+// Get the serialized byte size of the protobuf message,
+// different versions of protobuf have different methods
+// use template to avoid include `google/protobuf/message.h`
+template<typename T>
+inline uint32_t GetProtobufByteSize(const T& message) {
+#if GOOGLE_PROTOBUF_VERSION >= 3010000
Review comment:
在不包含 protobuf 相关头文件的情况下, 直接用 `GOOGLE_PROTOBUF_VERSION` 有问题吧? 虽然不影响编译,
但结果恐怕不符合预期, 除非源文件中先包含 protobuf 相关头文件再包含此头文件.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]