From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 90034740032 for ; Fri, 12 Jan 2024 10:42:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=t4cgeKXcffC+ZwvA408fW4Du9RVBi4V0W6Lufr2/ykk=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705056168; v=1; b=eNk6DKG4MrRPcSV8RQFiTXufXl5d+0HpfoJ8v60xClRAqQhNKEu7R/W4AwOgNBi1qLWtO+Y6 9QYBDJe9/JkR0XPARaZpLl62Dl7AK1PftRzeKs+C1PTF0rEIFrDKmNXtkUTLGGQByVTaUaxyNX2 2FUWvadydSMtdNKurfd+inik= X-Received: by 127.0.0.2 with SMTP id N7AnYY7687511xP5WyDLCHjB; Fri, 12 Jan 2024 02:42:48 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.43]) by mx.groups.io with SMTP id smtpd.web10.4493.1705056167575760070 for ; Fri, 12 Jan 2024 02:42:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bUStPGMm+VXBvPPCsagjmMLApeWr0+ijcl8mHgAa5hqa1j7ea8GhPfKxNDJNS2inFCO7LZfWaDZVKBqBlj5ansUyRFDJqVvyQ7IKO5cX7wvS7G99xEsNd1LQsrM6qUnzhtOoCKsx9Mdh303FHZUMDPmA4Y4gCHcBm7bYi6FjNxAvhbrhjfjV151c5UDLGh6dL8lV3mLj3kn10ZewlU72CddY1OUM0NPyFF9BMqpGcgB+hgPTNECx2k7Y3+j/92a6+TJyixijatS5wQfaTRAHM/JwKPkbHScO94bp5h6nKANm5FNTZGT8hN5vp75GME/Z8vo/31bkME+r7GQfUkkpvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vVdfnhlGhmVjsD63l47GCSKafmAej0WzV2HmaWSLqa0=; b=fW7DGGRKKxf8IIrNpJfW4MDoNc9y93KSngUT+xGHZj0dvkd3tDRe5HQkpMekTpsegnjERnyK4MvQoqMuzVUcAT/x4KkujGNC46yw5i82+QnfygQYD2U/E3MrakBCOO30oipAFjBJODLxnLQJKXmoYh24lbqiR+r6Th/M+ddFHIGRx8SsAFlk73XryiJY/fqJQd2ZVcdz/QdZz6SPCwSpa4vacYtniNIOJFfDipjTpATvzwCwG3H7Go3cuxS4PTVbOkRSPZkiJPIGnfNUQ5Tjd6mpO3VxK1kYbz3frSLLM1H+jMOoFkkQcANkEGrRLk0of8ZqLNZOhRIhginzzYFP7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) X-Received: from CY5PR13CA0073.namprd13.prod.outlook.com (2603:10b6:930:a::33) by PH0PR12MB7010.namprd12.prod.outlook.com (2603:10b6:510:21c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21; Fri, 12 Jan 2024 10:42:43 +0000 X-Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:930:a:cafe::79) by CY5PR13CA0073.outlook.office365.com (2603:10b6:930:a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.14 via Frontend Transport; Fri, 12 Jan 2024 10:42:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.14 via Frontend Transport; Fri, 12 Jan 2024 10:42:43 +0000 X-Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 12 Jan 2024 02:42:29 -0800 X-Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 12 Jan 2024 02:42:29 -0800 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Fri, 12 Jan 2024 02:42:28 -0800 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [PATCH] RedfishPkg/RedfishCrtLib: handle floating point number in JSON Date: Fri, 12 Jan 2024 18:42:28 +0800 Message-ID: <20240112104228.670-1-nicklew@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CE:EE_|PH0PR12MB7010:EE_ X-MS-Office365-Filtering-Correlation-Id: 320a9f78-222c-4a4d-e95e-08dc135b3505 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: GVjbmjfDxuGcygdsDY5KBoWVrtOOqcFtUaSWmhonDSIXXMzt4bEFC7mSUrxJuBVDQdiTeFIBFJrSPHreji/XyObNJ6L+Lq+GWSabAC+YEI61alM7yrCAGj4ydCgaEiU9WiF/QSP54ROnCe3CQhs5nNvokvzeM1biaY1/g2UxhBxobs3Tqaj0RotmEFnrPZVU+rKmuAXJH5ISBN0uAO8YwTD8Pxz8YimMUv7kJbx2v0mVeiiGCsRBtDQrD4/6b95kG/WRG4nKPk9iy11IM5W1YCEGxdhNU2rGUMRtLZhvx62HgYGBKXyAaG+YY0VRfJAwiB+FoLGvEcLZfDGfr8AU+C8sS9H61JN2EnXMOnwEMOy1JHF50yhcYvdu5x0d7Ed6ctzgaBaCrJo6z9+451PUPO8feR1rl9aZWV70NZ2Uj3J+DjmNgNf2k/0qc5ZB3XMOy1A92qf/4xaDGzDvp/Zlj/UJZfF1A10M6MIy1mv7Ar+2jzPp0SspJWVFZAeLjreAkf/cT9tC1m8h8C/jylbX7cZQzIj2rQOyF0iyWjeikOE6Aer5FKMb8YxF5Xvxv5Pf6s14nFglJmXuIT+6l6Fdp8R4nnzlnrXNk7OZs6EbTfvj4Ax+5HZdZiX1FBKR6empk0R8OM81QjM07HDfjrICxD0b+elN+/RhFHww2ry19HV2ynFN4zW8ZyGtbj7AsfMEBX/RDvoMhLBJ0Sj+tGYonMiCqgh1bquTAx4zgykt+fs7qFHnbXBfSdhsFoeIPAV1 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2024 10:42:43.0580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 320a9f78-222c-4a4d-e95e-08dc135b3505 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7010 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: lpSV7uCK8a2YzhT2QhiXuOtDx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-Spam-Flag: yes X-Spam-Level: ************ X-GND-Spam-Score: 190 X-GND-Status: SPAM Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=eNk6DKG4; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") 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. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- .../PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c b/Redf= ishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c index 57a997f351..e88d874224 100644 --- a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c +++ b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c @@ -4,6 +4,7 @@ =20 Copyright (c) 2019, Intel Corporation. All rights reserved.
(C) Copyright 2020 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -519,7 +520,7 @@ strtoull ( } =20 /** - edk2 Jansson port does not support doubles, simply return 0. + edk2 Jansson port does not support doubles, simply return integer part. =20 These conversion functions convert the initial portion of the string pointed to by nptr to double, float, and long double representation, @@ -540,7 +541,7 @@ strtoull ( the return value), and ERANGE is stored in errno. If the correct value would cause underflow, zero is returned and ERANGE is stored in errno. =20 - @return Return 0. + @return Integer part of decimal number. **/ double strtod ( @@ -548,9 +549,13 @@ strtod ( char **__restrict endptr ) { - DEBUG ((DEBUG_ERROR, "We don't supprot double type on edk2 yet!")); - ASSERT (FALSE); - return (double)0; + UINTN Data; + + Data =3D 0; + + AsciiStrDecimalToUintnS (nptr, endptr, &Data); + DEBUG ((DEBUG_WARN, "%a: We don't support double type on edk2 yet. Only = integer part is returned\n", __func__)); + return (double)Data; } =20 static UINT8 BitMask[] =3D { --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113708): https://edk2.groups.io/g/devel/message/113708 Mute This Topic: https://groups.io/mt/103680418/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-