!30 fix: print int without decimal places
From: @wuzhaomin Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
bb22389dde
26
backport-fix-print-int-without-decimal-places-630.patch
Normal file
26
backport-fix-print-int-without-decimal-places-630.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
From d321fa9e6e574ff93518f6384865b9af0a4a4afc Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlexanderVasiljev <48011002+AlexanderVasiljev@users.noreply.github.com>
|
||||||
|
Date: Wed, 19 Jan 2022 05:30:31 +0300
|
||||||
|
Subject: [PATCH] fix: print int without decimal places (#630)
|
||||||
|
|
||||||
|
---
|
||||||
|
cJSON.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/cJSON.c b/cJSON.c
|
||||||
|
index 3063f74..c78aac6 100644
|
||||||
|
--- a/cJSON.c
|
||||||
|
+++ b/cJSON.c
|
||||||
|
@@ -562,6 +562,10 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out
|
||||||
|
{
|
||||||
|
length = sprintf((char*)number_buffer, "null");
|
||||||
|
}
|
||||||
|
+ else if(d == (double)item->valueint)
|
||||||
|
+ {
|
||||||
|
+ length = sprintf((char*)number_buffer, "%d", item->valueint);
|
||||||
|
+ }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
|
||||||
|
--
|
||||||
|
|
||||||
10
cjson.spec
10
cjson.spec
@ -1,6 +1,6 @@
|
|||||||
Name: cjson
|
Name: cjson
|
||||||
Version: 1.7.15
|
Version: 1.7.15
|
||||||
Release: 6
|
Release: 7
|
||||||
Summary: Ultralightweight JSON parser in ANSI C
|
Summary: Ultralightweight JSON parser in ANSI C
|
||||||
|
|
||||||
License: MIT and ASL 2.0
|
License: MIT and ASL 2.0
|
||||||
@ -10,8 +10,9 @@ Source0: https://github.com/DaveGamble/cJSON/archive/refs/tags/v1.7.15.ta
|
|||||||
Patch0001: backport-CVE-2023-50471_50472.patch
|
Patch0001: backport-CVE-2023-50471_50472.patch
|
||||||
Patch0002: backport-fix-potential-memory-leak-in-merge_patch.patch
|
Patch0002: backport-fix-potential-memory-leak-in-merge_patch.patch
|
||||||
Patch0003: CVE-2024-31755.patch
|
Patch0003: CVE-2024-31755.patch
|
||||||
Patch0004: Fix-a-null-pointer-crash-in-cJSON_ReplaceItemViaPoin.patch
|
Patch0004: Fix-a-null-pointer-crash-in-cJSON_ReplaceItemViaPoin.patch
|
||||||
Patch0005: backport-fix-add-allocate-check-for-replace_item_in_object-67.patch
|
Patch0005: backport-fix-add-allocate-check-for-replace_item_in_object-67.patch
|
||||||
|
Patch0006: backport-fix-print-int-without-decimal-places-630.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
@ -58,6 +59,9 @@ rm -f %{buildroot}%{_libdir}/cmake/cJSON/*.cmake
|
|||||||
%{_includedir}/cjson/
|
%{_includedir}/cjson/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 10 2024 wuzhaomin <wuzhaomin@kylinos.cn> - 1.7.15-7
|
||||||
|
- Fix print int without decimal places
|
||||||
|
|
||||||
* Wed May 8 2024 wuzhaomin <wuzhaomin@kylinos.cn> - 1.7.15-6
|
* Wed May 8 2024 wuzhaomin <wuzhaomin@kylinos.cn> - 1.7.15-6
|
||||||
- add allocate check for replace_item_in_object
|
- add allocate check for replace_item_in_object
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user