* [PATCH] BaseTools/VolInfo: Correct EFI_SECTION_VERSION display
@ 2022-07-18 9:43 Konstantin Aladyshev
2022-07-24 13:45 ` Bob Feng
0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Aladyshev @ 2022-07-18 9:43 UTC (permalink / raw)
To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Konstantin Aladyshev
- Correct typo in print statement,
- "BuildNumber" field is UINT16, therefore it needs "0x%04X" format
modifier,
- "VersionString" field is CHAR16, therefore the input data should be
processed to be displayed with "%s" printf modifier.
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
BaseTools/Source/C/VolInfo/VolInfo.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 8b6fcffa48..ed56587058 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1676,6 +1676,7 @@ Returns:
CHAR8 *ToolInputFileName;
CHAR8 *ToolOutputFileName;
CHAR8 *UIFileName;
+ CHAR8 *VersionString;
ParsedLength = 0;
ToolInputFileName = NULL;
@@ -1816,8 +1817,14 @@ Returns:
break;
case EFI_SECTION_VERSION:
- printf (" Build Number: 0x%02X\n", *(UINT16 *)(Ptr + SectionHeaderLen));
- printf (" Version Strg: %s\n", (char*) (Ptr + SectionHeaderLen + sizeof (UINT16)));
+ printf (" Build Number: 0x%04X\n", *(UINT16 *)(Ptr + SectionHeaderLen));
+ VersionString = (CHAR8 *) malloc (UnicodeStrLen (((EFI_VERSION_SECTION *) Ptr)->VersionString) + 1);
+ if (VersionString == NULL) {
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
+ return EFI_OUT_OF_RESOURCES;
+ }
+ Unicode2AsciiString (((EFI_VERSION_SECTION *) Ptr)->VersionString, VersionString);
+ printf (" Version String: %s\n", VersionString);
break;
case EFI_SECTION_COMPRESSION:
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] BaseTools/VolInfo: Correct EFI_SECTION_VERSION display
2022-07-18 9:43 [PATCH] BaseTools/VolInfo: Correct EFI_SECTION_VERSION display Konstantin Aladyshev
@ 2022-07-24 13:45 ` Bob Feng
0 siblings, 0 replies; 2+ messages in thread
From: Bob Feng @ 2022-07-24 13:45 UTC (permalink / raw)
To: Konstantin Aladyshev, devel@edk2.groups.io; +Cc: Gao, Liming, Chen, Christine
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-----Original Message-----
From: Konstantin Aladyshev <aladyshev22@gmail.com>
Sent: Monday, July 18, 2022 5:44 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Konstantin Aladyshev <aladyshev22@gmail.com>
Subject: [PATCH] BaseTools/VolInfo: Correct EFI_SECTION_VERSION display
- Correct typo in print statement,
- "BuildNumber" field is UINT16, therefore it needs "0x%04X" format modifier,
- "VersionString" field is CHAR16, therefore the input data should be processed to be displayed with "%s" printf modifier.
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
---
BaseTools/Source/C/VolInfo/VolInfo.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 8b6fcffa48..ed56587058 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1676,6 +1676,7 @@ Returns:
CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; CHAR8 *UIFileName;+ CHAR8 *VersionString; ParsedLength = 0; ToolInputFileName = NULL;@@ -1816,8 +1817,14 @@ Returns:
break; case EFI_SECTION_VERSION:- printf (" Build Number: 0x%02X\n", *(UINT16 *)(Ptr + SectionHeaderLen));- printf (" Version Strg: %s\n", (char*) (Ptr + SectionHeaderLen + sizeof (UINT16)));+ printf (" Build Number: 0x%04X\n", *(UINT16 *)(Ptr + SectionHeaderLen));+ VersionString = (CHAR8 *) malloc (UnicodeStrLen (((EFI_VERSION_SECTION *) Ptr)->VersionString) + 1);+ if (VersionString == NULL) {+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");+ return EFI_OUT_OF_RESOURCES;+ }+ Unicode2AsciiString (((EFI_VERSION_SECTION *) Ptr)->VersionString, VersionString);+ printf (" Version String: %s\n", VersionString); break; case EFI_SECTION_COMPRESSION:--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-24 13:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-18 9:43 [PATCH] BaseTools/VolInfo: Correct EFI_SECTION_VERSION display Konstantin Aladyshev
2022-07-24 13:45 ` Bob Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox