[edk2] [PATCH] BaseTools/GenVtf & VolInfo: Fix build fail for 'snprintf' not defined

Hao Wu posted 1 patch 7 years, 8 months ago
Failed in applying to current master (apply log)
BaseTools/Source/C/GenVtf/GenVtf.c   | 59 +++---------------------------------
BaseTools/Source/C/VolInfo/VolInfo.c | 24 ++-------------
2 files changed, 8 insertions(+), 75 deletions(-)
[edk2] [PATCH] BaseTools/GenVtf & VolInfo: Fix build fail for 'snprintf' not defined
Posted by Hao Wu 7 years, 8 months ago
Function snprintf() is not supported in Visual Studio 2013 or older
version. The commit replaces the use of snprintf() with sprintf() to avoid
build failure for VS compilers.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 BaseTools/Source/C/GenVtf/GenVtf.c   | 59 +++---------------------------------
 BaseTools/Source/C/VolInfo/VolInfo.c | 24 ++-------------
 2 files changed, 8 insertions(+), 75 deletions(-)

diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c b/BaseTools/Source/C/GenVtf/GenVtf.c
index acc142a..ff0e7cf 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -2,7 +2,7 @@
 This file contains functions required to generate a boot strap file (BSF) also 
 known as the Volume Top File (VTF)
 
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available 
 under the terms and conditions of the BSD License which accompanies this 
 distribution.  The full text of the license may be found at
@@ -1045,7 +1045,6 @@ Arguments:
 Returns:
 
   EFI_INVALID_PARAMETER  - The parameter is invalid
-  EFI_OUT_OF_RESOURCES   - Resource can not be allocated
   EFI_SUCCESS            - The function completed successfully
 
 --*/
@@ -1063,8 +1062,7 @@ Returns:
   CHAR8   Buff4[10];
   CHAR8   Buff5[10];
   CHAR8   Token[50];
-  CHAR8   *FormatString;
-  INTN    FormatLength;
+  CHAR8   FormatString[MAX_LINE_LEN];
 
   Fp = fopen (LongFilePath (VtfInfo->CompSymName), "rb");
 
@@ -1076,30 +1074,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us %%%us %%%us %%%us %%%us %%%us %%%us",
-                   (unsigned) sizeof (Buff1) - 1,
-                   (unsigned) sizeof (Buff2) - 1,
-                   (unsigned) sizeof (OffsetStr) - 1,
-                   (unsigned) sizeof (Buff3) - 1,
-                   (unsigned) sizeof (Buff4) - 1,
-                   (unsigned) sizeof (Buff5) - 1,
-                   (unsigned) sizeof (Token) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (Fp);
-
-    Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us %%%us %%%us %%%us %%%us %%%us %%%us",
     (unsigned) sizeof (Buff1) - 1,
     (unsigned) sizeof (Buff2) - 1,
@@ -1136,10 +1112,6 @@ Returns:
 
   memcpy ((VOID *) RelativeAddress, (VOID *) CompStartAddress, sizeof (UINT64));
 
-  if (FormatString != NULL) {
-    free (FormatString);
-  }
-
   if (Fp != NULL) {
     fclose (Fp);
   }
@@ -2242,8 +2214,7 @@ Returns:
   CHAR8   Section[MAX_LONG_FILE_PATH];
   CHAR8   Token[MAX_LONG_FILE_PATH];
   CHAR8   BaseToken[MAX_LONG_FILE_PATH];
-  CHAR8   *FormatString;
-  INTN    FormatLength;
+  CHAR8   FormatString[MAX_LINE_LEN];
   UINT64  TokenAddress;
   long    StartLocation;
 
@@ -2324,27 +2295,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us | %%%us | %%%us | %%%us\n",
-                   (unsigned) sizeof (Type) - 1,
-                   (unsigned) sizeof (Address) - 1,
-                   (unsigned) sizeof (Section) - 1,
-                   (unsigned) sizeof (Token) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (SourceFile);
-    fclose (DestFile);
-    Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
-    return EFI_ABORTED;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us | %%%us | %%%us | %%%us\n",
     (unsigned) sizeof (Type) - 1,
     (unsigned) sizeof (Address) - 1,
@@ -2383,7 +2335,6 @@ Returns:
     }
   }
 
-  free (FormatString);
   fclose (SourceFile);
   fclose (DestFile);
   return EFI_SUCCESS;
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 71917af..2647cbb 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1,7 +1,7 @@
 /** @file
 The tool dumps the contents of a firmware volume
 
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -2242,8 +2242,7 @@ Returns:
 {
   FILE              *Fptr;
   CHAR8             Line[MAX_LINE_LEN];
-  CHAR8             *FormatString;
-  INTN              FormatLength;
+  CHAR8             FormatString[MAX_LINE_LEN];
   GUID_TO_BASENAME  *GPtr;
 
   if ((Fptr = fopen (LongFilePath (FileName), "r")) == NULL) {
@@ -2254,23 +2253,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us %%%us",
-                   (unsigned) sizeof (GPtr->Guid) - 1,
-                   (unsigned) sizeof (GPtr->BaseName) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (Fptr);
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us %%%us",
     (unsigned) sizeof (GPtr->Guid) - 1,
     (unsigned) sizeof (GPtr->BaseName) - 1
@@ -2282,7 +2266,6 @@ Returns:
     //
     GPtr = malloc (sizeof (GUID_TO_BASENAME));
     if (GPtr == NULL) {
-      free (FormatString);
       fclose (Fptr);
       return EFI_OUT_OF_RESOURCES;
     }
@@ -2299,7 +2282,6 @@ Returns:
     }
   }
 
-  free (FormatString);
   fclose (Fptr);
   return EFI_SUCCESS;
 }
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] BaseTools/GenVtf & VolInfo: Fix build fail for 'snprintf' not defined
Posted by Gao, Liming 7 years, 8 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: Wu, Hao A 
Sent: Tuesday, February 28, 2017 3:57 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH] BaseTools/GenVtf & VolInfo: Fix build fail for 'snprintf' not defined

Function snprintf() is not supported in Visual Studio 2013 or older
version. The commit replaces the use of snprintf() with sprintf() to avoid
build failure for VS compilers.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 BaseTools/Source/C/GenVtf/GenVtf.c   | 59 +++---------------------------------
 BaseTools/Source/C/VolInfo/VolInfo.c | 24 ++-------------
 2 files changed, 8 insertions(+), 75 deletions(-)

diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c b/BaseTools/Source/C/GenVtf/GenVtf.c
index acc142a..ff0e7cf 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -2,7 +2,7 @@
 This file contains functions required to generate a boot strap file (BSF) also 
 known as the Volume Top File (VTF)
 
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available 
 under the terms and conditions of the BSD License which accompanies this 
 distribution.  The full text of the license may be found at
@@ -1045,7 +1045,6 @@ Arguments:
 Returns:
 
   EFI_INVALID_PARAMETER  - The parameter is invalid
-  EFI_OUT_OF_RESOURCES   - Resource can not be allocated
   EFI_SUCCESS            - The function completed successfully
 
 --*/
@@ -1063,8 +1062,7 @@ Returns:
   CHAR8   Buff4[10];
   CHAR8   Buff5[10];
   CHAR8   Token[50];
-  CHAR8   *FormatString;
-  INTN    FormatLength;
+  CHAR8   FormatString[MAX_LINE_LEN];
 
   Fp = fopen (LongFilePath (VtfInfo->CompSymName), "rb");
 
@@ -1076,30 +1074,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us %%%us %%%us %%%us %%%us %%%us %%%us",
-                   (unsigned) sizeof (Buff1) - 1,
-                   (unsigned) sizeof (Buff2) - 1,
-                   (unsigned) sizeof (OffsetStr) - 1,
-                   (unsigned) sizeof (Buff3) - 1,
-                   (unsigned) sizeof (Buff4) - 1,
-                   (unsigned) sizeof (Buff5) - 1,
-                   (unsigned) sizeof (Token) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (Fp);
-
-    Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us %%%us %%%us %%%us %%%us %%%us %%%us",
     (unsigned) sizeof (Buff1) - 1,
     (unsigned) sizeof (Buff2) - 1,
@@ -1136,10 +1112,6 @@ Returns:
 
   memcpy ((VOID *) RelativeAddress, (VOID *) CompStartAddress, sizeof (UINT64));
 
-  if (FormatString != NULL) {
-    free (FormatString);
-  }
-
   if (Fp != NULL) {
     fclose (Fp);
   }
@@ -2242,8 +2214,7 @@ Returns:
   CHAR8   Section[MAX_LONG_FILE_PATH];
   CHAR8   Token[MAX_LONG_FILE_PATH];
   CHAR8   BaseToken[MAX_LONG_FILE_PATH];
-  CHAR8   *FormatString;
-  INTN    FormatLength;
+  CHAR8   FormatString[MAX_LINE_LEN];
   UINT64  TokenAddress;
   long    StartLocation;
 
@@ -2324,27 +2295,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us | %%%us | %%%us | %%%us\n",
-                   (unsigned) sizeof (Type) - 1,
-                   (unsigned) sizeof (Address) - 1,
-                   (unsigned) sizeof (Section) - 1,
-                   (unsigned) sizeof (Token) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (SourceFile);
-    fclose (DestFile);
-    Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
-    return EFI_ABORTED;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us | %%%us | %%%us | %%%us\n",
     (unsigned) sizeof (Type) - 1,
     (unsigned) sizeof (Address) - 1,
@@ -2383,7 +2335,6 @@ Returns:
     }
   }
 
-  free (FormatString);
   fclose (SourceFile);
   fclose (DestFile);
   return EFI_SUCCESS;
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 71917af..2647cbb 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1,7 +1,7 @@
 /** @file
 The tool dumps the contents of a firmware volume
 
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -2242,8 +2242,7 @@ Returns:
 {
   FILE              *Fptr;
   CHAR8             Line[MAX_LINE_LEN];
-  CHAR8             *FormatString;
-  INTN              FormatLength;
+  CHAR8             FormatString[MAX_LINE_LEN];
   GUID_TO_BASENAME  *GPtr;
 
   if ((Fptr = fopen (LongFilePath (FileName), "r")) == NULL) {
@@ -2254,23 +2253,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us %%%us",
-                   (unsigned) sizeof (GPtr->Guid) - 1,
-                   (unsigned) sizeof (GPtr->BaseName) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (Fptr);
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us %%%us",
     (unsigned) sizeof (GPtr->Guid) - 1,
     (unsigned) sizeof (GPtr->BaseName) - 1
@@ -2282,7 +2266,6 @@ Returns:
     //
     GPtr = malloc (sizeof (GUID_TO_BASENAME));
     if (GPtr == NULL) {
-      free (FormatString);
       fclose (Fptr);
       return EFI_OUT_OF_RESOURCES;
     }
@@ -2299,7 +2282,6 @@ Returns:
     }
   }
 
-  free (FormatString);
   fclose (Fptr);
   return EFI_SUCCESS;
 }
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] BaseTools/GenVtf & VolInfo: Fix build fail for 'snprintf' not defined
Posted by Zhu, Yonghong 7 years, 8 months ago
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong

-----Original Message-----
From: Wu, Hao A 
Sent: Tuesday, February 28, 2017 3:57 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH] BaseTools/GenVtf & VolInfo: Fix build fail for 'snprintf' not defined

Function snprintf() is not supported in Visual Studio 2013 or older version. The commit replaces the use of snprintf() with sprintf() to avoid build failure for VS compilers.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 BaseTools/Source/C/GenVtf/GenVtf.c   | 59 +++---------------------------------
 BaseTools/Source/C/VolInfo/VolInfo.c | 24 ++-------------
 2 files changed, 8 insertions(+), 75 deletions(-)

diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c b/BaseTools/Source/C/GenVtf/GenVtf.c
index acc142a..ff0e7cf 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -2,7 +2,7 @@
 This file contains functions required to generate a boot strap file (BSF) also  known as the Volume Top File (VTF)
 
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available  under the terms and conditions of the BSD License which accompanies this  distribution.  The full text of the license may be found at @@ -1045,7 +1045,6 @@ Arguments:
 Returns:
 
   EFI_INVALID_PARAMETER  - The parameter is invalid
-  EFI_OUT_OF_RESOURCES   - Resource can not be allocated
   EFI_SUCCESS            - The function completed successfully
 
 --*/
@@ -1063,8 +1062,7 @@ Returns:
   CHAR8   Buff4[10];
   CHAR8   Buff5[10];
   CHAR8   Token[50];
-  CHAR8   *FormatString;
-  INTN    FormatLength;
+  CHAR8   FormatString[MAX_LINE_LEN];
 
   Fp = fopen (LongFilePath (VtfInfo->CompSymName), "rb");
 
@@ -1076,30 +1074,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us %%%us %%%us %%%us %%%us %%%us %%%us",
-                   (unsigned) sizeof (Buff1) - 1,
-                   (unsigned) sizeof (Buff2) - 1,
-                   (unsigned) sizeof (OffsetStr) - 1,
-                   (unsigned) sizeof (Buff3) - 1,
-                   (unsigned) sizeof (Buff4) - 1,
-                   (unsigned) sizeof (Buff5) - 1,
-                   (unsigned) sizeof (Token) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (Fp);
-
-    Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us %%%us %%%us %%%us %%%us %%%us %%%us",
     (unsigned) sizeof (Buff1) - 1,
     (unsigned) sizeof (Buff2) - 1,
@@ -1136,10 +1112,6 @@ Returns:
 
   memcpy ((VOID *) RelativeAddress, (VOID *) CompStartAddress, sizeof (UINT64));
 
-  if (FormatString != NULL) {
-    free (FormatString);
-  }
-
   if (Fp != NULL) {
     fclose (Fp);
   }
@@ -2242,8 +2214,7 @@ Returns:
   CHAR8   Section[MAX_LONG_FILE_PATH];
   CHAR8   Token[MAX_LONG_FILE_PATH];
   CHAR8   BaseToken[MAX_LONG_FILE_PATH];
-  CHAR8   *FormatString;
-  INTN    FormatLength;
+  CHAR8   FormatString[MAX_LINE_LEN];
   UINT64  TokenAddress;
   long    StartLocation;
 
@@ -2324,27 +2295,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us | %%%us | %%%us | %%%us\n",
-                   (unsigned) sizeof (Type) - 1,
-                   (unsigned) sizeof (Address) - 1,
-                   (unsigned) sizeof (Section) - 1,
-                   (unsigned) sizeof (Token) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (SourceFile);
-    fclose (DestFile);
-    Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
-    return EFI_ABORTED;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us | %%%us | %%%us | %%%us\n",
     (unsigned) sizeof (Type) - 1,
     (unsigned) sizeof (Address) - 1,
@@ -2383,7 +2335,6 @@ Returns:
     }
   }
 
-  free (FormatString);
   fclose (SourceFile);
   fclose (DestFile);
   return EFI_SUCCESS;
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 71917af..2647cbb 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1,7 +1,7 @@
 /** @file
 The tool dumps the contents of a firmware volume
 
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials  are licensed and made available under the terms and conditions of the BSD License  which accompanies this distribution.  The full text of the license may be found at @@ -2242,8 +2242,7 @@ Returns:
 {
   FILE              *Fptr;
   CHAR8             Line[MAX_LINE_LEN];
-  CHAR8             *FormatString;
-  INTN              FormatLength;
+  CHAR8             FormatString[MAX_LINE_LEN];
   GUID_TO_BASENAME  *GPtr;
 
   if ((Fptr = fopen (LongFilePath (FileName), "r")) == NULL) { @@ -2254,23 +2253,8 @@ Returns:
   //
   // Generate the format string for fscanf
   //
-  FormatLength = snprintf (
-                   NULL,
-                   0,
-                   "%%%us %%%us",
-                   (unsigned) sizeof (GPtr->Guid) - 1,
-                   (unsigned) sizeof (GPtr->BaseName) - 1
-                   ) + 1;
-
-  FormatString = (CHAR8 *) malloc (FormatLength);
-  if (FormatString == NULL) {
-    fclose (Fptr);
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  snprintf (
+  sprintf (
     FormatString,
-    FormatLength,
     "%%%us %%%us",
     (unsigned) sizeof (GPtr->Guid) - 1,
     (unsigned) sizeof (GPtr->BaseName) - 1 @@ -2282,7 +2266,6 @@ Returns:
     //
     GPtr = malloc (sizeof (GUID_TO_BASENAME));
     if (GPtr == NULL) {
-      free (FormatString);
       fclose (Fptr);
       return EFI_OUT_OF_RESOURCES;
     }
@@ -2299,7 +2282,6 @@ Returns:
     }
   }
 
-  free (FormatString);
   fclose (Fptr);
   return EFI_SUCCESS;
 }
--
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel