Pedro:
  Please also add %z description in Edk2\MdePkg\Include\Library\PrintLib.h. 

  And, please also submit one BZ for this change. This is a new feature. 

Thanks
Liming

> -----邮件原件-----
> 发件人: Pedro Falcato <[email protected]>
> 发送时间: 2022年7月5日 8:04
> 收件人: [email protected]
> 抄送: Michael D Kinney <[email protected]>; Liming Gao
> <[email protected]>; Zhiguang Liu <[email protected]>
> 主题: [PATCH] MdePkg/BasePrintLib: Add %z specifier
> 
> %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 <[email protected]>
> Cc: Liming Gao <[email protected]>
> Cc: Zhiguang Liu <[email protected]>
> Signed-off-by: Pedro Falcato <[email protected]>
> ---
>  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/Library/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 |= LONG_TYPE;
>                break;
> +            case 'z':
> +              Flags |= SIZET_TYPE;
> +              break;
>              case '*':
>                if ((Flags & PRECISION) == 0) {
>                  Flags |= PAD_TO_WIDTH;
> @@ -833,6 +836,12 @@ BasePrintLibSPrintMarker (
>                } else {
>                  Value = BASE_ARG (BaseListMarker, int);
>                }
> +            } else if ((Flags & SIZET_TYPE) != 0) {
> +              if (BaseListMarker == NULL) {
> +                Value = VA_ARG (VaListMarker, UINTN);
> +              } else {
> +                Value = BASE_ARG (BaseListMarker, UINTN);
> +              }
>              } else {
>                if (BaseListMarker == NULL) {
>                  Value = VA_ARG (VaListMarker, INT64);
> diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.h
> b/MdePkg/Library/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
> 
>  //
>  // Record date and time information
> --
> 2.37.0





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91054): https://edk2.groups.io/g/devel/message/91054
Mute This Topic: https://groups.io/mt/92177026/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to