]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/PcdValueCommon.c
BaseTools: Various typo
[mirror_edk2.git] / BaseTools / Source / C / Common / PcdValueCommon.c
index 348f148ff90e72b8d50911a0770d9a3c1f8c4139..b95a7a859f423b9f2f1e90487bb80c9596a36e10 100644 (file)
@@ -72,6 +72,9 @@ Returns:
   CHAR8  *Token;\r
 \r
   Token = malloc (TokenEnd - TokenStart + 1);\r
+  if (Token == NULL) {\r
+    return;\r
+  }\r
   memcpy (Token, &FileBuffer[TokenStart], TokenEnd - TokenStart);\r
   Token[TokenEnd - TokenStart] = 0;\r
   switch (TokenIndex) {\r
@@ -309,7 +312,6 @@ Returns:
   CHAR8   *Value;\r
   UINT8   *Buffer;\r
   CHAR8   *End;\r
-  UINT8   Byte;\r
 \r
   Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);\r
   if (Index < 0) {\r
@@ -327,12 +329,14 @@ Returns:
     break;\r
   case PcdDataTypePointer:\r
     Value = &PcdList[Index].Value[1];\r
-    printf ("Value = %s\n", PcdList[Index].Value);\r
-    for (*Size = 0, Byte = (UINT8) strtoul(Value, &End, 16); Value != End; Byte = (UINT8) strtoul(Value, &End, 16), *Size = *Size + 1) {\r
-      printf("%x\n", Byte);\r
+    for (*Size = 0, strtoul(Value, &End, 16); Value != End; strtoul(Value, &End, 16), *Size = *Size + 1) {\r
       Value = End + 1;\r
     }\r
-    Buffer = malloc(*Size);\r
+    Buffer = malloc(*Size + 1);\r
+    if (Buffer == NULL) {\r
+      *Size = 0;\r
+      return NULL;\r
+    }\r
     Value = &PcdList[Index].Value[1];\r
     for (*Size = 0, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16); Value != End; *Size = *Size + 1, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16)) {\r
       Value = End + 1;\r
@@ -394,7 +398,6 @@ Returns:
     PcdList[Index].Value = malloc(Size * 5 + 3);\r
     PcdList[Index].Value[0] = '{';\r
     for (ValueIndex = 0; ValueIndex < Size; ValueIndex++) {\r
-      printf("Value[%d] = %02x\n", ValueIndex, Value[ValueIndex]);\r
       sprintf(&PcdList[Index].Value[1 + ValueIndex * 5], "0x%02x,", Value[ValueIndex]);\r
     }\r
     PcdList[Index].Value[1 + Size * 5 - 1] = '}';\r
@@ -712,20 +715,16 @@ Returns:
   }\r
 \r
   //\r
-  // Check Input paramters\r
+  // Check Input parameters\r
   //\r
   if (*InputFileName == NULL) {\r
     fprintf (stderr, "Missing option.  Input files is not specified\n");\r
     exit (EXIT_FAILURE);\r
-  } else {\r
-    printf ("Input file name is %s\n", *InputFileName);\r
   }\r
 \r
   if (*OutputFileName == NULL) {\r
     fprintf (stderr, "Missing option.  Output file is not specified\n");\r
     exit (EXIT_FAILURE);\r
-  } else {\r
-    printf ("Output file name is %s\n", *OutputFileName);\r
   }\r
 }\r
 \r
@@ -754,7 +753,6 @@ Returns:
   UINT8   *FileBuffer;\r
   UINT32  FileSize;\r
 \r
-  printf ("PCD tool start.\n");\r
   InputFileName = NULL;\r
   OutputFileName = NULL;\r
 \r
@@ -783,7 +781,5 @@ Returns:
   //\r
   WriteOutputFile (OutputFileName);\r
 \r
-  printf ("PCD tool done.\n");\r
-\r
   exit (EXIT_SUCCESS);\r
 }\r