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>
This commit is contained in:
Nickle Wang
2024-01-12 23:35:09 +08:00
committed by mergify[bot]
parent 6a01fb2ea5
commit d65b183f92
2 changed files with 30 additions and 7 deletions

View File

@@ -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: