From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web12.2171.1613618971366865861 for ; Wed, 17 Feb 2021 19:29:31 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=WeEPukMt; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0683f2d0c2=nickle.wang@hpe.com) Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11I3SO9C011510; Thu, 18 Feb 2021 03:29:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=SgQfg9GmjdOSbC4WVWi6iQ4GLV8IUg78X2wuWpxFalM=; b=WeEPukMtVMe9/7vI6NPl8pKrzjlkRxx+9CEN1hnfLS0VBd8JVVY5zXEguvADc0aVnIWN W4rO33sqxe3mZzRfwT4BZoV3RLg+5eHFF3hJTSKl7Eji3wdwpZJrNE3VAXXAPRyNW/9W jXUxt75qf8767D+ukaBCd+q+Eyeh71LBotecVDptKMSz5CiFKwjogz+pMEdqypezeXDf E+kyI49nHydYmWolygdK0eoK0ADmzz2hlFFDFIob0R7nTAtTDvcyzgx6tK8owYReBoWT niKNy6TROSibBlG7NSJbMv4Gsw+8DQ2iGQ4rccohWqW2dI2NoFlgHX4Jgyg1DI+Rb971 RA== Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0a-002e3701.pphosted.com with ESMTP id 36rky6jeg3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Feb 2021 03:29:30 +0000 Received: from G1W8108.americas.hpqcorp.net (g1w8108.austin.hp.com [16.193.72.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5009.houston.hpe.com (Postfix) with ESMTPS id 1EF885C; Thu, 18 Feb 2021 03:29:30 +0000 (UTC) Received: from G4W9119.americas.hpqcorp.net (2002:10d2:14d6::10d2:14d6) by G1W8108.americas.hpqcorp.net (2002:10c1:483c::10c1:483c) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 18 Feb 2021 03:29:30 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (15.241.52.13) by G4W9119.americas.hpqcorp.net (16.210.20.214) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 18 Feb 2021 03:29:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gOtjbCxKgH2iY26oC/n+3NXoPZ5VhhMqczR0Cb9+kQilwIjxkVs7n/VamSAdlY6VX+/mLhr2f7Ucaq2wY+DvV/2jWF/piajzmZpKPS0umcvEhPRgz+SZTAY1oprush4I0AM13sqWxJElKxu6umodJjtPmGw+1Kss1SG9d0D2/m9BBCwOSjTtGA58Ms2K+SjcJ6YXMdFPSsQ6r1/jJGtzMt5r0C9nntvESwgeDjTobrt9JeNQnCjqPaQ8Jff2ESDF3cH3uMABKSbJH3+9+n7QwbW/9+yTTNUH1swhr0wpEPRKSILZQPH07eD9gKfW/p+2RD08Jjf0va9nXCCx5pGu+g== 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-SenderADCheck; bh=SgQfg9GmjdOSbC4WVWi6iQ4GLV8IUg78X2wuWpxFalM=; b=FHzpVScjzy0MFhxu8SYiXrlrVX2w3gJhcyjJiMOGapB3HgV0lmeGDRflLiOMPbsjzY9T+Htnq+aKOPW/jfXrClKioFryoYImyLz+JVzFRnJfhfMvG22hNR0ggfoCSFeIH449+g3ggidtvbOB0FE4vRKT1jdq3vmQUd79vR6Q92lvrylUkTckgVBBArJ2rLN+QEDHFTsP4/LUkIr7mE0i2MelEX45hB8A5NtD4NVZRjrtt/fX0fsxQ1SaF+un3e+gyqTXoWKD5Gm9fOx4f9+6zagJEY4T0KKqWwC4haoScRWKCpi4EDjWbn2YwQZgO6ELYasWa9JO1mHBT1aD7IjnCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760d::7) by DF4PR8401MB1051.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 18 Feb 2021 03:29:28 +0000 Received: from DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM ([fe80::c1ae:b73d:dbaa:9a6e]) by DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM ([fe80::c1ae:b73d:dbaa:9a6e%9]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 03:29:28 +0000 From: "Nickle Wang" To: "Chang, Abner (HPS SW/FW Technologist)" , "devel@edk2.groups.io" CC: Leif Lindholm , Michael D Kinney Subject: Re: [PATCH] RedfishPkg/JsonLib: Fix build errors Thread-Topic: [PATCH] RedfishPkg/JsonLib: Fix build errors Thread-Index: AQHW8tna44d24eomZEez1lqfaxmzeKpdZdig Date: Thu, 18 Feb 2021 03:29:28 +0000 Message-ID: References: <20210125043154.20645-1-abner.chang@hpe.com> In-Reply-To: <20210125043154.20645-1-abner.chang@hpe.com> Accept-Language: zh-TW, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: hpe.com; dkim=none (message not signed) header.d=none;hpe.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [16.242.247.139] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ba3e2bf4-91da-4556-c30c-08d8d3bd65b9 x-ms-traffictypediagnostic: DF4PR8401MB1051: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sWnbgm3Pt2hOIfPe4vhN82pkfKXI+/5BMtA+GHsjTJBN7czleWurDV2JZuMsT0hIGxpUUXUfsYRRqFHxv2CaX4uxmMKLJ0196NicQKKEBX0zQaQovwyM53Gewspx5oh+NUIHTYB8Vm7jcxtnbMXab53R1GlH3h5EhWUCsJmu44DIEQBz1e3+o7OGxo16oBgULiwHpmeNGJjy3JKNo4uWFPiOu/o2Dx1xUTE08Qv5bv4oWbIg5zssLKk7dj44WzvxhjzpjH5m6+PQc1AYlDGrVUaxvcum+lJ6FzFGCHNtpwJ6/l8sJs3fsC32E3yU3unWaGnmjOsr9ei2G78MoFA2lh2hVMESAUAnP8lLhTPaF+Jyttb1WlTTHmzuOVaRaMDqXC547peT/BG++7X7T/fmpFqOb7htX4RhiII2312OhjHUdhyKluR0b4yIWJTmlzBEeGJaTlPhM/6h6Xh0RAIX0ONdaKc4dNfMGXgg7KuLQ6r4GZnGZtWiHn7Q90K2tmrGccUbnorq38BdcIuuBl1lWQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(376002)(366004)(346002)(39860400002)(396003)(136003)(86362001)(8676002)(52536014)(110136005)(186003)(6506007)(83380400001)(54906003)(7696005)(8936002)(26005)(66446008)(66946007)(66476007)(33656002)(9686003)(55016002)(64756008)(478600001)(4326008)(53546011)(316002)(5660300002)(2906002)(71200400001)(76116006)(66556008);DIR:OUT;SFP:1102; x-ms-exchange-ant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wwXJS/kudchDYr5z3I8D0lU3hK7v39nteEGK?= =?us-ascii?Q?o+DLDi0j1PiYe3jrhZvuqI6JzytcAQ0/sViyZKpLEp/357gTV5+un1KVcYNT?= =?us-ascii?Q?NRlg63v8vEyc77e1EPRjGS5vPQkafQjL+owpdoFs/N/P3B4xSoyYZmhhdoF2?= =?us-ascii?Q?59vlqhnnI1t/0nW3p45OFLINOGAYen01ebXBerq5OA8gbDN6vd4UK5aYmhnZ?= =?us-ascii?Q?99ALWiGMSzkHebErA5U8ZJOFPt8/kDckTuQ3UwxVcAd9AbaG4GBhtENI9Q3K?= =?us-ascii?Q?bj6bekVVbemjIKMk426hJNhCxPi/TIwevAzaTsfF3jAntjHpX4Nw5uFcsa48?= =?us-ascii?Q?ZqcRK4ZPHQ1cTc5aLGkPHfUXTFo4TwIVB6LFGt+u3fjV/uJVu+LD5/ur/EZ1?= =?us-ascii?Q?j585zjseeJijh/Me4gBTuREoh+RoWwjdf0+3+fxJCNEDiZ0oDPb7tS9qwmPk?= =?us-ascii?Q?SD5NAJTicuDqt4hI6JWjZkSY?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0812.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: ba3e2bf4-91da-4556-c30c-08d8d3bd65b9 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Feb 2021 03:29:28.1218 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: O7TstL6+Y//ZZc7okqm7nqqhtTe1p1ruPk20mVZBMTHnDqjl4lxZdp2mZIYf0T3pIlTf50qtFiAde9bCDdXvcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1051 X-OriginatorOrg: hpe.com X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-02-18_01:2021-02-16,2021-02-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180027 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Abner, You many want to update the function description. It mentioned "UTF8 encode= d string" but the input string type is CHAR8, not CHAR16. Thanks, Nickle > -----Original Message----- > From: Chang, Abner (HPS SW/FW Technologist) > Sent: Monday, January 25, 2021 12:32 PM > To: devel@edk2.groups.io > Cc: Leif Lindholm ; Wang, Nickle (HPS SW) > ; Michael D Kinney > Subject: [PATCH] RedfishPkg/JsonLib: Fix build errors >=20 > This patch fixes the build errors when build JsonLib with EDK2 > Redfish feature driver. >=20 > - Add JsonLoadString function to load a NULL terminated-string JSON > - json_string_value() in JsonValueGetAsciiString () is removed > by accident. >=20 > Signed-off-by: Abner Chang >=20 > Cc: Leif Lindholm > Cc: Nickle Wang > Cc: Michael D Kinney > --- > RedfishPkg/Library/JsonLib/JsonLib.inf | 5 +++-- > RedfishPkg/Include/Library/JsonLib.h | 21 ++++++++++++++++++ > RedfishPkg/Library/JsonLib/JsonLib.c | 30 ++++++++++++++++++++++++-- > 3 files changed, 52 insertions(+), 4 deletions(-) >=20 > diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf > b/RedfishPkg/Library/JsonLib/JsonLib.inf > index 48b094a78a..9d52a622e1 100644 > --- a/RedfishPkg/Library/JsonLib/JsonLib.inf > +++ b/RedfishPkg/Library/JsonLib/JsonLib.inf > @@ -75,12 +75,13 @@ > # C4244: conversion from type1 to type2, possible loss of data > # C4334: 32-bit shift implicitly converted to 64-bit > # C4204: nonstandard extension used: non-constant aggregate initiali= zer > + # C4706: assignment within conditional expression > # > # Define macro HAVE_CONFIG_H to include jansson_private_config.h to > build. > # Undefined _WIN32, WIN64, _MSC_VER macros > # On GCC, no error on the unused-function and unused-but-set-variable. > # > - MSFT:*_*_X64_CC_FLAGS =3D /wd4204 /wd4244 /wd4090 /wd4334 > /DHAVE_CONFIG_H=3D1 /U_WIN32 /UWIN64 /U_MSC_VER > - MSFT:*_*_IA32_CC_FLAGS =3D /wd4204 /wd4244 /wd4090 > /DHAVE_CONFIG_H=3D1 /U_WIN32 /UWIN64 /U_MSC_VER > + MSFT:*_*_X64_CC_FLAGS =3D /wd4204 /wd4244 /wd4090 /wd4334 /wd4706 > /DHAVE_CONFIG_H=3D1 /U_WIN32 /UWIN64 /U_MSC_VER > + MSFT:*_*_IA32_CC_FLAGS =3D /wd4204 /wd4244 /wd4090 /wd4706 > /DHAVE_CONFIG_H=3D1 /U_WIN32 /UWIN64 /U_MSC_VER > GCC:*_*_*_CC_FLAGS =3D -Wno-unused-function -Wno-unused-but-set- > variable >=20 > diff --git a/RedfishPkg/Include/Library/JsonLib.h > b/RedfishPkg/Include/Library/JsonLib.h > index 3c10f67d27..82ca4bad60 100644 > --- a/RedfishPkg/Include/Library/JsonLib.h > +++ b/RedfishPkg/Include/Library/JsonLib.h > @@ -664,6 +664,27 @@ JsonDumpString ( > IN UINTN Flags > ); >=20 > +/** > + Convert a string to JSON object. > + The function is used to convert a NULL terminated UTF8 encoded string = to > a JSON > + value. Only object and array represented strings can be converted > successfully, > + since they are the only valid root values of a JSON text for UEFI usag= e. > + > + Real number and number with exponent part are not supportted by UEFI. > + > + Caller needs to cleanup the root value by calling JsonValueFree(). > + > + @param[in] String The NULL terminated UTF8 encoded string to > convert > + > + @retval Array JSON value or object JSON value, or NULL when any e= rror > occurs. > + > +**/ > +EDKII_JSON_VALUE > +EFIAPI > +JsonLoadString ( > + IN CONST CHAR8* String > + ); > + > /** > Load JSON from a buffer. >=20 > diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c > b/RedfishPkg/Library/JsonLib/JsonLib.c > index 34ff381aee..1762c6f5af 100644 > --- a/RedfishPkg/Library/JsonLib/JsonLib.c > +++ b/RedfishPkg/Library/JsonLib/JsonLib.c > @@ -430,10 +430,10 @@ JsonValueGetAsciiString ( > IN EDKII_JSON_VALUE Json > ) > { > - CHAR8 *AsciiStr; > + CONST CHAR8 *AsciiStr; > UINTN Index; >=20 > - AsciiStr =3D (CHAR8 *) ((json_t *) Json); > + AsciiStr =3D json_string_value ((json_t *) Json); > if (AsciiStr =3D=3D NULL) { > return NULL; > } > @@ -819,6 +819,32 @@ JsonDumpString ( > return json_dumps((json_t *)JsonValue, Flags); > } >=20 > +/** > + Convert a string to JSON object. > + The function is used to convert a NULL terminated UTF8 encoded string = to > a JSON > + value. Only object and array represented strings can be converted > successfully, > + since they are the only valid root values of a JSON text for UEFI usag= e. > + > + Real number and number with exponent part are not supportted by UEFI. > + > + Caller needs to cleanup the root value by calling JsonValueFree(). > + > + @param[in] String The NULL terminated UTF8 encoded string to > convert > + > + @retval Array JSON value or object JSON value, or NULL when any e= rror > occurs. > + > +**/ > +EDKII_JSON_VALUE > +EFIAPI > +JsonLoadString ( > + IN CONST CHAR8* String > + ) > +{ > + json_error_t JsonError; > + > + return (EDKII_JSON_VALUE) json_loads ((const char *)String, 0, > &JsonError); > +} > + > /** > Load JSON from a buffer. >=20 > -- > 2.17.1