BaseTools/DevicePath: fix GCC build error in print_mem(), and clean it up
[mirror_edk2.git] / BaseTools / Source / C / DevicePath / DevicePath.c
index 4c87163209ab11a2d5a3526f671b350c488797a2..76b8553b7145296b886176151eedf66fc8a93fb9 100644 (file)
@@ -103,11 +103,19 @@ Returns:
 }\r
 \r
 \r
-void print_mem(void const *vp, size_t n)\r
+STATIC\r
+VOID\r
+PrintMem (\r
+  CONST VOID *Buffer,\r
+  UINTN      Count\r
+  )\r
 {\r
-    unsigned char const *p = vp;\r
-    for (size_t i=0; i<n; i++) {\r
-        printf("0x%02x ", p[i]);\r
+  CONST UINT8 *Bytes;\r
+  UINTN       Idx;\r
+\r
+  Bytes = Buffer;\r
+  for (Idx = 0; Idx < Count; Idx++) {\r
+    printf("0x%02x ", Bytes[Idx]);\r
   }\r
 }\r
 \r
@@ -177,10 +185,10 @@ int main(int argc, CHAR8 *argv[])
   DevicePath = UefiDevicePathLibConvertTextToDevicePath(Str16);\r
   while (!((DevicePath->Type == END_DEVICE_PATH_TYPE) && (DevicePath->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)) )\r
   {\r
-    print_mem(DevicePath, (DevicePath->Length[0] | DevicePath->Length[1] << 8));\r
+    PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1] << 8);\r
     DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)DevicePath + (DevicePath->Length[0] | DevicePath->Length[1] << 8));\r
   }\r
-  print_mem(DevicePath, (DevicePath->Length[0] | DevicePath->Length[1] << 8));\r
+  PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1] << 8);\r
   putchar('\n');\r
   return STATUS_SUCCESS;\r
 }\r