Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
\r
if (VtfInfo->PreferredSize) {\r
if (FileSize > VtfInfo->CompSize) {\r
\r
if (VtfInfo->PreferredSize) {\r
if (FileSize > VtfInfo->CompSize) {\r
Error (NULL, 0, 2000, "Invalid parameter", "The component size is more than specified size.");\r
return EFI_ABORTED;\r
}\r
Error (NULL, 0, 2000, "Invalid parameter", "The component size is more than specified size.");\r
return EFI_ABORTED;\r
}\r
\r
Buffer = malloc ((UINTN) FileSize);\r
if (Buffer == NULL) {\r
\r
Buffer = malloc ((UINTN) FileSize);\r
if (Buffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
memset (Buffer, 0, (UINTN) FileSize);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
memset (Buffer, 0, (UINTN) FileSize);\r
\r
FileSize = _filelength (fileno (Fp));\r
if (FileSize < 64) {\r
\r
FileSize = _filelength (fileno (Fp));\r
if (FileSize < 64) {\r
Error (NULL, 0, 2000, "Invalid parameter", "PAL_A bin header is 64 bytes, so the Bin size must be larger than 64 bytes!");\r
return EFI_INVALID_PARAMETER;\r
}\r
Error (NULL, 0, 2000, "Invalid parameter", "PAL_A bin header is 64 bytes, so the Bin size must be larger than 64 bytes!");\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
if (VtfInfo->PreferredSize) {\r
if (FileSize > VtfInfo->CompSize) {\r
\r
if (VtfInfo->PreferredSize) {\r
if (FileSize > VtfInfo->CompSize) {\r
Error (NULL, 0, 2000, "Invalid parameter", "The PAL_A Size is more than the specified size.");\r
return EFI_ABORTED;\r
}\r
Error (NULL, 0, 2000, "Invalid parameter", "The PAL_A Size is more than the specified size.");\r
return EFI_ABORTED;\r
}\r
\r
Buffer = malloc ((UINTN) FileSize);\r
if (Buffer == NULL) {\r
\r
Buffer = malloc ((UINTN) FileSize);\r
if (Buffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
memset (Buffer, 0, (UINTN) FileSize);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
memset (Buffer, 0, (UINTN) FileSize);\r
FileSize = _filelength (fileno (Fp));\r
\r
if (FileSize > 16) {\r
FileSize = _filelength (fileno (Fp));\r
\r
if (FileSize > 16) {\r
return EFI_ABORTED;\r
}\r
\r
Buffer = malloc (FileSize);\r
if (Buffer == NULL) {\r
return EFI_ABORTED;\r
}\r
\r
Buffer = malloc (FileSize);\r
if (Buffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
// Get the input VTF file name\r
//\r
VtfFileName = argv[Index+1];\r
// Get the input VTF file name\r
//\r
VtfFileName = argv[Index+1];\r
+ if (VtfFP != NULL) {\r
+ //\r
+ // VTF file name has been given previously, override with the new value\r
+ //\r
+ fclose (VtfFP);\r
+ }\r
VtfFP = fopen (LongFilePath (VtfFileName), "rb");\r
if (VtfFP == NULL) {\r
Error (NULL, 0, 0001, "Error opening file", VtfFileName);\r
VtfFP = fopen (LongFilePath (VtfFileName), "rb");\r
if (VtfFP == NULL) {\r
Error (NULL, 0, 0001, "Error opening file", VtfFileName);\r