From a75f515810da7ef39d31409520c237e3bd700e58 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sat, 12 Jul 2014 00:11:02 +0200
Subject: [PATCH 2/2] Fix -Wformat.

---
 source/common/dmtbdump.c              |  2 +-
 source/compiler/aslcompile.c          |  2 +-
 source/components/debugger/dbhistry.c |  2 +-
 source/components/debugger/dbinput.c  | 10 ++--
 source/components/debugger/dbstats.c  | 88 +++++++++++++++++------------------
 source/components/utilities/utdebug.c |  4 +-
 source/tools/acpiexec/aeexec.c        |  2 +-
 source/tools/acpiexec/aehandlers.c    |  8 ++--
 8 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c
index be7a143..878d51d 100644
--- a/source/common/dmtbdump.c
+++ b/source/common/dmtbdump.c
@@ -1800,7 +1800,7 @@ AcpiDmDumpMcfg (
     {
         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
         {
-            AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
+            AcpiOsPrintf ("Warning: there are %zu invalid trailing bytes\n",
                 sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
             return;
         }
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 8f14ef5..ca2b909 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -605,7 +605,7 @@ FlCheckForAscii (
         if (DisplayErrors)
         {
             AcpiOsPrintf (
-                "%u non-ASCII characters found in input source text, could be a binary file\n",
+                "%zu non-ASCII characters found in input source text, could be a binary file\n",
                 BadBytes);
             AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, Filename);
         }
diff --git a/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c
index c74519b..62ae04b 100644
--- a/source/components/debugger/dbhistry.c
+++ b/source/components/debugger/dbhistry.c
@@ -249,7 +249,7 @@ AcpiDbDisplayHistory (
     {
         if (AcpiGbl_HistoryBuffer[HistoryIndex].Command)
         {
-            AcpiOsPrintf ("%3ld  %s\n",
+            AcpiOsPrintf ("%3d  %s\n",
                 AcpiGbl_HistoryBuffer[HistoryIndex].CmdNum,
                 AcpiGbl_HistoryBuffer[HistoryIndex].Command);
         }
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index c84bf8a..18b64aa 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/components/debugger/dbinput.c
@@ -714,7 +714,7 @@ AcpiDbGetLine (
     if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf),
         InputBuffer))
     {
-        AcpiOsPrintf ("Buffer overflow while parsing input line (max %u characters)\n",
+        AcpiOsPrintf ("Buffer overflow while parsing input line (max %zu characters)\n",
             sizeof (AcpiGbl_DbParsedBuf));
         return (0);
     }
@@ -1011,9 +1011,9 @@ AcpiDbCommandDispatch (
 
         if (ParamCount == 0)
         {
-            AcpiOsPrintf ("Current debug level for file output is:    %8.8lX\n",
+            AcpiOsPrintf ("Current debug level for file output is:    %8.8X\n",
                 AcpiGbl_DbDebugLevel);
-            AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n",
+            AcpiOsPrintf ("Current debug level for console output is: %8.8X\n",
                 AcpiGbl_DbConsoleDebugLevel);
         }
         else if (ParamCount == 2)
@@ -1022,7 +1022,7 @@ AcpiDbCommandDispatch (
             AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1],
                                             NULL, 16);
             AcpiOsPrintf (
-                "Debug Level for console output was %8.8lX, now %8.8lX\n",
+                "Debug Level for console output was %8.8X, now %8.8X\n",
                 Temp, AcpiGbl_DbConsoleDebugLevel);
         }
         else
@@ -1030,7 +1030,7 @@ AcpiDbCommandDispatch (
             Temp = AcpiGbl_DbDebugLevel;
             AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
             AcpiOsPrintf (
-                "Debug Level for file output was %8.8lX, now %8.8lX\n",
+                "Debug Level for file output was %8.8X, now %8.8X\n",
                 Temp, AcpiGbl_DbDebugLevel);
         }
         break;
diff --git a/source/components/debugger/dbstats.c b/source/components/debugger/dbstats.c
index 9594b3d..7879bf1 100644
--- a/source/components/debugger/dbstats.c
+++ b/source/components/debugger/dbstats.c
@@ -505,13 +505,13 @@ AcpiDbDisplayStatistics (
 
         for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
         {
-            AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i),
+            AcpiOsPrintf ("%16.16s % 10hd% 10hd\n", AcpiUtGetTypeName (i),
                 AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]);
         }
-        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
+        AcpiOsPrintf ("%16.16s % 10hd% 10hd\n", "Misc/Unknown",
             AcpiGbl_NodeTypeCountMisc, AcpiGbl_ObjTypeCountMisc);
 
-        AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "TOTALS:",
+        AcpiOsPrintf ("%16.16s % 10d% 10d\n", "TOTALS:",
             AcpiGbl_NumNodes, AcpiGbl_NumObjects);
         break;
 
@@ -537,9 +537,9 @@ AcpiDbDisplayStatistics (
     case CMD_STAT_MISC:
 
         AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
-        AcpiOsPrintf ("Calls to AcpiPsFind:..  ........% 7ld\n",
+        AcpiOsPrintf ("Calls to AcpiPsFind:..  ........% 7d\n",
             AcpiGbl_PsFindCount);
-        AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n",
+        AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7d\n",
             AcpiGbl_NsLookupCount);
 
         AcpiOsPrintf ("\n");
@@ -547,7 +547,7 @@ AcpiDbDisplayStatistics (
         AcpiOsPrintf ("Mutex usage:\n\n");
         for (i = 0; i < ACPI_NUM_MUTEX; i++)
         {
-            AcpiOsPrintf ("%-28s:       % 7ld\n",
+            AcpiOsPrintf ("%-28s:       % 7d\n",
                 AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
         }
         break;
@@ -556,50 +556,50 @@ AcpiDbDisplayStatistics (
 
         AcpiOsPrintf ("\nInternal object sizes:\n\n");
 
-        AcpiOsPrintf ("Common           %3d\n", sizeof (ACPI_OBJECT_COMMON));
-        AcpiOsPrintf ("Number           %3d\n", sizeof (ACPI_OBJECT_INTEGER));
-        AcpiOsPrintf ("String           %3d\n", sizeof (ACPI_OBJECT_STRING));
-        AcpiOsPrintf ("Buffer           %3d\n", sizeof (ACPI_OBJECT_BUFFER));
-        AcpiOsPrintf ("Package          %3d\n", sizeof (ACPI_OBJECT_PACKAGE));
-        AcpiOsPrintf ("BufferField      %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
-        AcpiOsPrintf ("Device           %3d\n", sizeof (ACPI_OBJECT_DEVICE));
-        AcpiOsPrintf ("Event            %3d\n", sizeof (ACPI_OBJECT_EVENT));
-        AcpiOsPrintf ("Method           %3d\n", sizeof (ACPI_OBJECT_METHOD));
-        AcpiOsPrintf ("Mutex            %3d\n", sizeof (ACPI_OBJECT_MUTEX));
-        AcpiOsPrintf ("Region           %3d\n", sizeof (ACPI_OBJECT_REGION));
-        AcpiOsPrintf ("PowerResource    %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
-        AcpiOsPrintf ("Processor        %3d\n", sizeof (ACPI_OBJECT_PROCESSOR));
-        AcpiOsPrintf ("ThermalZone      %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
-        AcpiOsPrintf ("RegionField      %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD));
-        AcpiOsPrintf ("BankField        %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD));
-        AcpiOsPrintf ("IndexField       %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
-        AcpiOsPrintf ("Reference        %3d\n", sizeof (ACPI_OBJECT_REFERENCE));
-        AcpiOsPrintf ("Notify           %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
-        AcpiOsPrintf ("AddressSpace     %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
-        AcpiOsPrintf ("Extra            %3d\n", sizeof (ACPI_OBJECT_EXTRA));
-        AcpiOsPrintf ("Data             %3d\n", sizeof (ACPI_OBJECT_DATA));
+        AcpiOsPrintf ("Common           %3zu\n", sizeof (ACPI_OBJECT_COMMON));
+        AcpiOsPrintf ("Number           %3zu\n", sizeof (ACPI_OBJECT_INTEGER));
+        AcpiOsPrintf ("String           %3zu\n", sizeof (ACPI_OBJECT_STRING));
+        AcpiOsPrintf ("Buffer           %3zu\n", sizeof (ACPI_OBJECT_BUFFER));
+        AcpiOsPrintf ("Package          %3zu\n", sizeof (ACPI_OBJECT_PACKAGE));
+        AcpiOsPrintf ("BufferField      %3zu\n", sizeof (ACPI_OBJECT_BUFFER_FIELD));
+        AcpiOsPrintf ("Device           %3zu\n", sizeof (ACPI_OBJECT_DEVICE));
+        AcpiOsPrintf ("Event            %3zu\n", sizeof (ACPI_OBJECT_EVENT));
+        AcpiOsPrintf ("Method           %3zu\n", sizeof (ACPI_OBJECT_METHOD));
+        AcpiOsPrintf ("Mutex            %3zu\n", sizeof (ACPI_OBJECT_MUTEX));
+        AcpiOsPrintf ("Region           %3zu\n", sizeof (ACPI_OBJECT_REGION));
+        AcpiOsPrintf ("PowerResource    %3zu\n", sizeof (ACPI_OBJECT_POWER_RESOURCE));
+        AcpiOsPrintf ("Processor        %3zu\n", sizeof (ACPI_OBJECT_PROCESSOR));
+        AcpiOsPrintf ("ThermalZone      %3zu\n", sizeof (ACPI_OBJECT_THERMAL_ZONE));
+        AcpiOsPrintf ("RegionField      %3zu\n", sizeof (ACPI_OBJECT_REGION_FIELD));
+        AcpiOsPrintf ("BankField        %3zu\n", sizeof (ACPI_OBJECT_BANK_FIELD));
+        AcpiOsPrintf ("IndexField       %3zu\n", sizeof (ACPI_OBJECT_INDEX_FIELD));
+        AcpiOsPrintf ("Reference        %3zu\n", sizeof (ACPI_OBJECT_REFERENCE));
+        AcpiOsPrintf ("Notify           %3zu\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
+        AcpiOsPrintf ("AddressSpace     %3zu\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
+        AcpiOsPrintf ("Extra            %3zu\n", sizeof (ACPI_OBJECT_EXTRA));
+        AcpiOsPrintf ("Data             %3zu\n", sizeof (ACPI_OBJECT_DATA));
 
         AcpiOsPrintf ("\n");
 
-        AcpiOsPrintf ("ParseObject      %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON));
-        AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED));
-        AcpiOsPrintf ("ParseObjectAsl   %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
-        AcpiOsPrintf ("OperandObject    %3d\n", sizeof (ACPI_OPERAND_OBJECT));
-        AcpiOsPrintf ("NamespaceNode    %3d\n", sizeof (ACPI_NAMESPACE_NODE));
-        AcpiOsPrintf ("AcpiObject       %3d\n", sizeof (ACPI_OBJECT));
+        AcpiOsPrintf ("ParseObject      %3zu\n", sizeof (ACPI_PARSE_OBJ_COMMON));
+        AcpiOsPrintf ("ParseObjectNamed %3zu\n", sizeof (ACPI_PARSE_OBJ_NAMED));
+        AcpiOsPrintf ("ParseObjectAsl   %3zu\n", sizeof (ACPI_PARSE_OBJ_ASL));
+        AcpiOsPrintf ("OperandObject    %3zu\n", sizeof (ACPI_OPERAND_OBJECT));
+        AcpiOsPrintf ("NamespaceNode    %3zu\n", sizeof (ACPI_NAMESPACE_NODE));
+        AcpiOsPrintf ("AcpiObject       %3zu\n", sizeof (ACPI_OBJECT));
 
         AcpiOsPrintf ("\n");
 
-        AcpiOsPrintf ("Generic State    %3d\n", sizeof (ACPI_GENERIC_STATE));
-        AcpiOsPrintf ("Common State     %3d\n", sizeof (ACPI_COMMON_STATE));
-        AcpiOsPrintf ("Control State    %3d\n", sizeof (ACPI_CONTROL_STATE));
-        AcpiOsPrintf ("Update State     %3d\n", sizeof (ACPI_UPDATE_STATE));
-        AcpiOsPrintf ("Scope State      %3d\n", sizeof (ACPI_SCOPE_STATE));
-        AcpiOsPrintf ("Parse Scope      %3d\n", sizeof (ACPI_PSCOPE_STATE));
-        AcpiOsPrintf ("Package State    %3d\n", sizeof (ACPI_PKG_STATE));
-        AcpiOsPrintf ("Thread State     %3d\n", sizeof (ACPI_THREAD_STATE));
-        AcpiOsPrintf ("Result Values    %3d\n", sizeof (ACPI_RESULT_VALUES));
-        AcpiOsPrintf ("Notify Info      %3d\n", sizeof (ACPI_NOTIFY_INFO));
+        AcpiOsPrintf ("Generic State    %3zu\n", sizeof (ACPI_GENERIC_STATE));
+        AcpiOsPrintf ("Common State     %3zu\n", sizeof (ACPI_COMMON_STATE));
+        AcpiOsPrintf ("Control State    %3zu\n", sizeof (ACPI_CONTROL_STATE));
+        AcpiOsPrintf ("Update State     %3zu\n", sizeof (ACPI_UPDATE_STATE));
+        AcpiOsPrintf ("Scope State      %3zu\n", sizeof (ACPI_SCOPE_STATE));
+        AcpiOsPrintf ("Parse Scope      %3zu\n", sizeof (ACPI_PSCOPE_STATE));
+        AcpiOsPrintf ("Package State    %3zu\n", sizeof (ACPI_PKG_STATE));
+        AcpiOsPrintf ("Thread State     %3zu\n", sizeof (ACPI_THREAD_STATE));
+        AcpiOsPrintf ("Result Values    %3zu\n", sizeof (ACPI_RESULT_VALUES));
+        AcpiOsPrintf ("Notify Info      %3zu\n", sizeof (ACPI_NOTIFY_INFO));
         break;
 
     case CMD_STAT_STACK:
diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c
index ddc0c38..11cd686 100644
--- a/source/components/utilities/utdebug.c
+++ b/source/components/utilities/utdebug.c
@@ -290,7 +290,7 @@ AcpiDebugPrint (
      * Display the module name, current line number, thread ID (if requested),
      * current procedure nesting level, and the current procedure name
      */
-    AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber);
+    AcpiOsPrintf ("%9s-%04u ", ModuleName, LineNumber);
 
 #ifdef ACPI_APPLICATION
     /*
@@ -304,7 +304,7 @@ AcpiDebugPrint (
         AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
     }
 
-    AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel);
+    AcpiOsPrintf ("[%02u] ", AcpiGbl_NestingLevel);
 #endif
 
     AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName));
diff --git a/source/tools/acpiexec/aeexec.c b/source/tools/acpiexec/aeexec.c
index 46f89c9..79e8cdd 100644
--- a/source/tools/acpiexec/aeexec.c
+++ b/source/tools/acpiexec/aeexec.c
@@ -440,7 +440,7 @@ ExecuteOSI (
 
     if (ReturnValue.Length < sizeof (ACPI_OBJECT))
     {
-        AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n",
+        AcpiOsPrintf ("Return value from _OSI method too small, %.8zX\n",
             ReturnValue.Length);
         goto ErrorExit;
     }
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index 14b5e90..d0ca844 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -1464,7 +1464,7 @@ AeRegionHandler (
         if (AcpiGbl_DisplayRegionAccess)
         {
             AcpiOsPrintf ("AcpiExec: %s "
-                "%s: Attr %X Addr %.4X BaseAddr %.4X Len %.2X Width %X BufLen %X",
+                "%s: Attr %X Addr %.4X BaseAddr %.4X Len %.2zX Width %X BufLen %X",
                 AcpiUtGetRegionName (SpaceId),
                 (Function & ACPI_IO_MASK) ? "Write" : "Read ",
                 (UINT32) (Function >> 16),
@@ -1501,7 +1501,7 @@ AeRegionHandler (
         if (AcpiGbl_DisplayRegionAccess)
         {
             AcpiOsPrintf ("AcpiExec: IPMI "
-                "%s: Attr %X Addr %.4X BaseAddr %.4X Len %.2X Width %X BufLen %X\n",
+                "%s: Attr %X Addr %.4X BaseAddr %.4X Len %.2zX Width %X BufLen %X\n",
                 (Function & ACPI_IO_MASK) ? "Write" : "Read ",
                 (UINT32) (Function >> 16), (UINT32) Address, (UINT32) BaseAddress,
                 Length, BitWidth, Buffer[1]);
@@ -1763,7 +1763,7 @@ DoFunction:
         case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
             AcpiOsPrintf ("AcpiExec: SystemMemory "
-                "%s: Val %.8X Addr %.4X Width %X [REGION: BaseAddr %.4X Len %.2X]\n",
+                "%s: Val %.8X Addr %.4X Width %X [REGION: BaseAddr %.4X Len %.2zX]\n",
                 (Function & ACPI_IO_MASK) ? "Write" : "Read ",
                 (UINT32) *Value, (UINT32) Address, BitWidth, (UINT32) BaseAddress, Length);
             break;
@@ -1776,7 +1776,7 @@ DoFunction:
                 MyContext->Length, &Resource);
 
             AcpiOsPrintf ("AcpiExec: GeneralPurposeIo "
-                "%s: Val %.8X Addr %.4X BaseAddr %.4X Len %.2X Width %X AccLen %.2X Conn %p\n",
+                "%s: Val %.8X Addr %.4X BaseAddr %.4X Len %.2zX Width %X AccLen %.2X Conn %p\n",
                 (Function & ACPI_IO_MASK) ? "Write" : "Read ", (UINT32) *Value,
                 (UINT32) Address, (UINT32) BaseAddress, Length, BitWidth,
                 MyContext->AccessLength, MyContext->Connection);
-- 
1.9.3

