diff options
author | Nickle Wang <nicklew@nvidia.com> | 2024-01-12 23:35:09 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-01-15 08:11:22 +0000 |
commit | d65b183f92446a3a2855c1c7dd4a7a1b760af381 (patch) | |
tree | 65826d9898aa91ac2a5d1934ebbc374235c9d93b /RedfishPkg/Library | |
parent | 6a01fb2ea5b3b142a98f3649b0947268f038f389 (diff) | |
download | edk2-d65b183f92446a3a2855c1c7dd4a7a1b760af381.zip edk2-d65b183f92446a3a2855c1c7dd4a7a1b760af381.tar.gz edk2-d65b183f92446a3a2855c1c7dd4a7a1b760af381.tar.bz2 |
RedfishPkg/RedfishCrtLib: handle floating point number in JSON
When the value type is defined as number in Redfish schema, floating
point number is allowed. RedfishCrtLib raises assert without handling
this case now. Follow the way in EDK2 to call AsciiStrDecimalToUintnS
and handle the floating point number. Only the integer value is
returned.
Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
Diffstat (limited to 'RedfishPkg/Library')
-rw-r--r-- | RedfishPkg/Library/JsonLib/load.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/RedfishPkg/Library/JsonLib/load.c b/RedfishPkg/Library/JsonLib/load.c index 958c3ea..1a3b4a6 100644 --- a/RedfishPkg/Library/JsonLib/load.c +++ b/RedfishPkg/Library/JsonLib/load.c @@ -5,6 +5,7 @@ * it under the terms of the MIT license. See LICENSE for details.
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent AND MIT
*/
@@ -717,8 +718,8 @@ lex_scan_number ( goto out;
}
- lex->token = TOKEN_REAL;
- lex->value.real = doubleval;
+ lex->token = TOKEN_INTEGER;
+ lex->value.integer = doubleval;
return 0;
out:
|