[edk2-devel] [PATCH v1 07/10] DynamicTablesPkg: Use %a formatter in AmlDbgPrint

PierreGondois posted 10 patches 4 years, 7 months ago
There is a newer version of this series
[edk2-devel] [PATCH v1 07/10] DynamicTablesPkg: Use %a formatter in AmlDbgPrint
Posted by PierreGondois 4 years, 7 months ago
From: Pierre Gondois <Pierre.Gondois@arm.com>

The correct formatter to print a CHAR8 char in edk2 is '%a'.
Replace the '%s' formatters by '%a'.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
---
 .../Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c      | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c
index 00a61a2fe63a..7f4cd3404dbb 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c
@@ -2,7 +2,7 @@
   AML Print Function.
 
   Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>
-  Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
+  Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -199,7 +199,7 @@ AmlDbgPrintNodeHeader (
 
   DEBUG ((
     DEBUG_INFO,
-    "%3d | %-15s | ",
+    "%3d | %-15a | ",
     Level,
     NodeTypeStrTbl[Node->NodeType]
     ));
@@ -227,7 +227,7 @@ AmlDbgPrintDataNode (
 
   AmlDbgPrintNodeHeader ((AML_NODE_HEADER*)DataNode, Level);
 
-  DEBUG ((DEBUG_INFO, "%-36s | ", NodeDataTypeStrTbl[DataNode->DataType]));
+  DEBUG ((DEBUG_INFO, "%-36a | ", NodeDataTypeStrTbl[DataNode->DataType]));
   DEBUG ((DEBUG_INFO, "0x%04x | ", DataNode->Size));
 
   if ((DataNode->DataType == EAmlNodeDataTypeNameString) ||
@@ -300,13 +300,13 @@ AmlDbgPrintObjectNode (
 
   // Print a string corresponding to the field object OpCode/SubOpCode.
   if (AmlNodeHasAttribute (ObjectNode, AML_IS_FIELD_ELEMENT)) {
-    DEBUG ((DEBUG_INFO, "%-15s ", AmlGetFieldOpCodeStr (
+    DEBUG ((DEBUG_INFO, "%-15a ", AmlGetFieldOpCodeStr (
                                     ObjectNode->AmlByteEncoding->OpCode,
                                     0
                                     )));
   } else {
     // Print a string corresponding to the object OpCode/SubOpCode.
-    DEBUG ((DEBUG_INFO, "%-15s | ", AmlGetOpCodeStr (
+    DEBUG ((DEBUG_INFO, "%-15a | ", AmlGetOpCodeStr (
                                       ObjectNode->AmlByteEncoding->OpCode,
                                       ObjectNode->AmlByteEncoding->SubOpCode)
                                       ));
@@ -378,19 +378,19 @@ AmlDbgPrintTableHeader (
   DEBUG ((DEBUG_INFO, "Lvl | Node Type       |\n"));
   DEBUG ((
     DEBUG_INFO,
-    "    | %-15s | Signature| Length     | Rev | CSum | OemId  | "
+    "    | %-15a | Signature| Length     | Rev | CSum | OemId  | "
       "OemTableId       | OemRev   | CreatorId| CreatorRev\n",
     NodeTypeStrTbl[EAmlNodeRoot]
     ));
   DEBUG ((
     DEBUG_INFO,
-    "    | %-15s | Op   | SubOp| OpName          | MaxI| Attribute  | "
+    "    | %-15a | Op   | SubOp| OpName          | MaxI| Attribute  | "
       "PkgLen | NodeName (opt)\n",
     NodeTypeStrTbl[EAmlNodeObject]
     ));
   DEBUG ((
     DEBUG_INFO,
-    "    | %-15s | Data Type                            | Size   | "
+    "    | %-15a | Data Type                            | Size   | "
       "Buffer\n",
     NodeTypeStrTbl[EAmlNodeData]
     ));
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76936): https://edk2.groups.io/g/devel/message/76936
Mute This Topic: https://groups.io/mt/83735190/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v1 07/10] DynamicTablesPkg: Use %a formatter in AmlDbgPrint
Posted by Sami Mujawar 4 years, 4 months ago
Hi Pierre,

This change looks good to me.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Thanks,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#80977): https://edk2.groups.io/g/devel/message/80977
Mute This Topic: https://groups.io/mt/83735190/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-