From dccc1ca1304dc1fcb86c8e24edd491509269b3e7 Mon Sep 17 00:00:00 2001 From: cheliequan <liequanche@126.com> Date: 星期日, 29 一月 2023 14:44:52 +0800 Subject: [PATCH] 解决编译告警 --- util.cpp | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/util.cpp b/util.cpp index 42e8db7..dcfa0eb 100644 --- a/util.cpp +++ b/util.cpp @@ -32,7 +32,7 @@ bool proto_to_json(const google::protobuf::Message &message, std::string &json) { google::protobuf::util::JsonPrintOptions options; - options.add_whitespace = true; + options.add_whitespace = false; options.always_print_primitive_fields = true; options.preserve_proto_field_names = true; @@ -125,7 +125,16 @@ // Get root["data"] //yyjson_val *msg = yyjson_obj_get(root, "data"); - yyjson_val *data = yyjson_obj_get(root, data_name); + yyjson_val *data; + if ( NULL != data_name ) + { + data = yyjson_obj_get(root, data_name); + } + else + { + data = root; + } + *ptr_type = yyjson_get_type(data); ptr_value = yyjson_val_write(data, YYJSON_WRITE_NOFLAG, &data_len); -- Gitblit v1.8.0