1 Star 0 Fork 28

orange-snn/json-c

forked from src-openEuler/json-c 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0040-Fixed-misalignment-in-JSON-string-due-to-space-after.patch 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 10:54 . Package init
From e8cec5c9e47676ebc51f1ab0af904fc4417b2166 Mon Sep 17 00:00:00 2001
From: Darjan Krijan <[email protected]>
Date: Tue, 20 Nov 2018 22:21:27 +0100
Subject: [PATCH 40/56] Fixed misalignment in JSON string due to space after \n
being printed when choosing JSON_C_TO_STRING_SPACED together with
JSON_C_TO_STRING_PRETTY in json_object_array_to_json_string
---
json_object.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/json_object.c b/json_object.c
index 8a86bc6..19f9c83 100644
--- a/json_object.c
+++ b/json_object.c
@@ -395,7 +395,7 @@ static int json_object_object_to_json_string(struct json_object* jso,
printbuf_strappend(pb, "\n");
}
had_children = 1;
- if (flags & JSON_C_TO_STRING_SPACED)
+ if (flags & JSON_C_TO_STRING_SPACED && !(flags & JSON_C_TO_STRING_PRETTY))
printbuf_strappend(pb, " ");
indent(pb, level+1, flags);
printbuf_strappend(pb, "\"");
@@ -416,7 +416,7 @@ static int json_object_object_to_json_string(struct json_object* jso,
printbuf_strappend(pb, "\n");
indent(pb,level,flags);
}
- if (flags & JSON_C_TO_STRING_SPACED)
+ if (flags & JSON_C_TO_STRING_SPACED && !(flags & JSON_C_TO_STRING_PRETTY))
return printbuf_strappend(pb, /*{*/ " }");
else
return printbuf_strappend(pb, /*{*/ "}");
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/orange-snn/json-c.git
[email protected]:orange-snn/json-c.git
orange-snn
json-c
json-c
master

搜索帮助