chenBright commented on code in PR #3099:
URL: https://github.com/apache/brpc/pull/3099#discussion_r2366260150


##########
src/json2pb/pb_to_json.cpp:
##########
@@ -52,22 +104,26 @@ class PbToJsonConverter {
     explicit PbToJsonConverter(const Pb2JsonOptions& opt) : _option(opt) {}
 
     template <typename Handler>
-    bool Convert(const google::protobuf::Message& message, Handler& handler, 
bool root_msg = false);
+    bool Convert(const google::protobuf::Message& message, Handler& handler, 
bool root_msg = false, int depth = 0);

Review Comment:
   Do `depth = 0` and `root_msg = true` mean the same thing?



##########
src/json2pb/json_to_pb.cpp:
##########
@@ -526,7 +536,12 @@ bool JsonValueToProtoMessage(const 
BUTIL_RAPIDJSON_NAMESPACE::Value& json_value,
                              google::protobuf::Message* message,
                              const Json2PbOptions& options,
                              std::string* err,
+                             int depth,

Review Comment:
   Do `depth = 0` and `root_val = true` mean the same thing?



##########
src/json2pb/json_to_pb.cpp:
##########
@@ -59,6 +60,12 @@
 
 namespace json2pb {
 
+// Use iterative parsing to avoid stack overflow.
+const int RAPIDJSON_PARSE_FLAG_DEFAULT = 
BUTIL_RAPIDJSON_NAMESPACE::kParseIterativeFlag;
+const int RAPIDJSON_PARSE_FLAG_STOP_WHEN_DONE = 
BUTIL_RAPIDJSON_NAMESPACE::kParseStopWhenDoneFlag|RAPIDJSON_PARSE_FLAG_DEFAULT;

Review Comment:
   Can you put spaces before and after the `|`?



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

Reply via email to