From nobody Sun May 19 00:42:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+91051+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91051+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1656979442; cv=none; d=zohomail.com; s=zohoarc; b=jONvHwb0GG9A1olGYiCHZ2ZBwYKklHGNI/e/MM7Ka+uhINL1uYRGgn3Ldxb/f7/9Fp1ohfp4psTXbeztvNj8J82Wg80y9TQ2MHlvb3RvNWY+j11RjJ2nlUyMDv6fEyMv7BhdNDCwI5hIHAgj0JHfT2WMko7llkKaJIevn3Kvv34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656979442; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=j+9bu0Hmf9Qd0Y+EDROQonIq7RxTxQLbp+FueWpP+/Q=; b=NiIoRTHyNCnz9nwzFENFSxFOSYkI5bwtCdDAHFuoRSJD3I+te21iDkZDF0b92rd9Jk/JJds2iOdU/NBw+IjcUGMIWr7WCfvfVua3+3kF4hXlq9bVW82rvQ0COft5jQACWI0prBnfUcE0gX2fPvPSS0MHPG7dyuaYm0HtlPjZQR4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91051+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1656979442145984.2383982468061; Mon, 4 Jul 2022 17:04:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id a6TMYY1788612xsA6WNNq2fB; Mon, 04 Jul 2022 17:04:00 -0700 X-Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mx.groups.io with SMTP id smtpd.web10.78992.1656979440012944353 for ; Mon, 04 Jul 2022 17:04:00 -0700 X-Received: by mail-wr1-f42.google.com with SMTP id cl1so15272920wrb.4 for ; Mon, 04 Jul 2022 17:03:59 -0700 (PDT) X-Gm-Message-State: RTtYW3B0p4iJEThybdomWUN1x1787277AA= X-Google-Smtp-Source: AGRyM1utvMnCcZwhiwCvswNTd/xMxqs3wfam4oLGUjdYMlT2C5IQBfTstOmJPY/4HjOdYhgno2ldjw== X-Received: by 2002:a05:6000:1a87:b0:21c:65c8:2d8 with SMTP id f7-20020a0560001a8700b0021c65c802d8mr29907333wry.370.1656979438003; Mon, 04 Jul 2022 17:03:58 -0700 (PDT) X-Received: from PC-PEDRO-ARCH.lan ([2001:8a0:7280:5801:9441:3dce:686c:bfc7]) by smtp.gmail.com with ESMTPSA id h19-20020a05600c351300b0039c54bb28f2sm21908927wmq.36.2022.07.04.17.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 17:03:57 -0700 (PDT) From: "Pedro Falcato" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH] MdePkg/BasePrintLib: Add %z specifier Date: Tue, 5 Jul 2022 01:03:56 +0100 Message-Id: <20220705000356.342723-1-pedro.falcato@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pedro.falcato@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1656979440; bh=unYUQO8Dzl5Ssr1svP7cPfGvqCmUdogmnNC9DgF9XnU=; h=Cc:Date:From:Reply-To:Subject:To; b=CMGRH0dzAJyh2dUZ2GLVa9xscaq3C087Dw2HvEfroAu7+Pel5MYXiQC+z+T4qFwMgDU 6Jm7wxLcnDfBV2ob2FhJdUlJaL2op8/3NpVmP1ymsBWtYtx/2wzLQvi/IU/X/8U81tMU2 SDsE8mBzRSpwBjzV6r9AYtQiYARsHj5Oi1o= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1656979443227100003 Content-Type: text/plain; charset="utf-8" %z is used in standard C99 as the printf specifier for size_t types. Add support for it so we can portably print UINTN. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Pedro Falcato --- MdePkg/Library/BasePrintLib/PrintLibInternal.c | 9 +++++++++ MdePkg/Library/BasePrintLib/PrintLibInternal.h | 1 + 2 files changed, 10 insertions(+) diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Librar= y/BasePrintLib/PrintLibInternal.c index 42b598a432..1cd99b2213 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c @@ -720,6 +720,9 @@ BasePrintLibSPrintMarker ( case 'l': Flags |=3D LONG_TYPE; break; + case 'z': + Flags |=3D SIZET_TYPE; + break; case '*': if ((Flags & PRECISION) =3D=3D 0) { Flags |=3D PAD_TO_WIDTH; @@ -833,6 +836,12 @@ BasePrintLibSPrintMarker ( } else { Value =3D BASE_ARG (BaseListMarker, int); } + } else if ((Flags & SIZET_TYPE) !=3D 0) { + if (BaseListMarker =3D=3D NULL) { + Value =3D VA_ARG (VaListMarker, UINTN); + } else { + Value =3D BASE_ARG (BaseListMarker, UINTN); + } } else { if (BaseListMarker =3D=3D NULL) { Value =3D VA_ARG (VaListMarker, INT64); diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.h b/MdePkg/Librar= y/BasePrintLib/PrintLibInternal.h index 34d591c6fc..9193e6192b 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.h +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.h @@ -29,6 +29,7 @@ #define ARGUMENT_REVERSED BIT12 #define COUNT_ONLY_NO_PRINT BIT13 #define UNSIGNED_TYPE BIT14 +#define SIZET_TYPE BIT15 =20 // // Record date and time information --=20 2.37.0 -=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 (#91051): https://edk2.groups.io/g/devel/message/91051 Mute This Topic: https://groups.io/mt/92176193/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-