public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>,
	Ruiyu Ni <ruiyu.ni@intel.com>,
	Jaben Carsey <jaben.carsey@intel.com>
Subject: [patch 3/4] ShellPkg/UefiShellAcpiViewCommandLib: Fix VS build failure
Date: Mon, 30 Jul 2018 10:27:02 +0800	[thread overview]
Message-ID: <20180730022703.101708-4-dandan.bi@intel.com> (raw)
In-Reply-To: <20180730022703.101708-1-dandan.bi@intel.com>

Fix following warnings:
1.
xxx\GtdtParser.c(179): warning C4244:
'=': conversion from 'UINT32' to 'UINT16', possible loss of data
xxx\GtdtParser.c(180): warning C4244:
'-=': conversion from 'UINT32' to 'UINT16', possible loss of data
xxx\GtdtParser.c(196): warning C4244:
'-=': conversion from 'UINT32' to 'UINT16', possible loss of data

2.
xxx\XsdtParser.c(99): warning C4457:
declaration of 'Ptr' hides function parameter

cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
cc: Ruiyu Ni <ruiyu.ni@intel.com>
cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c    |  6 +++---
 .../UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c    | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
index 3a3cee948a..d5671081da 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -174,12 +174,12 @@ DumpGTBlock (
              "GT Block",
              Ptr,
              Length,
              PARSER_PARAMS (GtBlockParser)
              );
-  GTBlockTimerLength = (*GtBlockLength - Offset) / (*GtBlockTimerCount);
-  Length -= Offset;
+  GTBlockTimerLength = (*GtBlockLength - (UINT16)Offset) / (UINT16)(*GtBlockTimerCount);
+  Length -= (UINT16)Offset;
 
   if (*GtBlockTimerCount != 0) {
     Ptr += (*GtBlockTimerOffset);
     Index = 0;
     while ((Index < (*GtBlockTimerCount)) && (Length >= GTBlockTimerLength)) {
@@ -191,11 +191,11 @@ DumpGTBlock (
                  GTBlockTimerLength,
                  PARSER_PARAMS (GtBlockTimerParser)
                  );
       // Increment by GT Block Timer structure size
       Ptr += Offset;
-      Length -= Offset;
+      Length -= (UINT16)Offset;
       Index++;
     }
 
     if (Length != 0) {
       IncrementErrorCount ();
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
index 99521cd67a..341a61b8fb 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
@@ -63,10 +63,11 @@ ParseAcpiXsdt (
   UINT32        Offset;
   UINT32        TableOffset;
   UINT64*       TablePointer;
   UINTN         EntryIndex;
   CHAR16        Buffer[32];
+  UINT8*        Pointer;
 
   // Parse the ACPI header to get the length
   ParseAcpi (
     FALSE,
     0,
@@ -94,30 +95,29 @@ ParseAcpiXsdt (
       CONST UINT32* Signature;
       CONST UINT32* Length;
       CONST UINT8*  Revision;
 
       if ((UINT64*)(UINTN)(*TablePointer) != NULL) {
-        UINT8*      Ptr;
 
         ParseAcpiHeader (
           (UINT8*)(UINTN)(*TablePointer),
           &Signature,
           &Length,
           &Revision
           );
 
-        Ptr = (UINT8*)Signature;
+        Pointer = (UINT8*)Signature;
 
         UnicodeSPrint (
           Buffer,
           sizeof (Buffer),
           L"Entry[%d] - %c%c%c%c",
           EntryIndex++,
-          Ptr[0],
-          Ptr[1],
-          Ptr[2],
-          Ptr[3]
+          Pointer[0],
+          Pointer[1],
+          Pointer[2],
+          Pointer[3]
           );
       } else {
         UnicodeSPrint (
           Buffer,
           sizeof (Buffer),
-- 
2.14.3.windows.1



  parent reply	other threads:[~2018-07-30  2:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30  2:26 [patch 0/4] ShellPkg/UefiShellAcpiViewCommandLib: Fix build issues Dandan Bi
2018-07-30  2:27 ` [patch 1/4] ShellPkg/UefiShellAcpiViewCommandLib: Fix VS2012 build failure Dandan Bi
2018-07-30 17:46   ` Carsey, Jaben
2018-07-30  2:27 ` [patch 2/4] " Dandan Bi
2018-07-30 17:46   ` Carsey, Jaben
2018-07-30  2:27 ` Dandan Bi [this message]
2018-07-30  8:27   ` [patch 3/4] ShellPkg/UefiShellAcpiViewCommandLib: Fix VS " Alexei Fedorov
2018-07-30  8:49     ` Bi, Dandan
2018-07-30  2:27 ` [patch 4/4] ShellPkg/UefiShellAcpiViewCommandLib: Fix GCC " Dandan Bi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180730022703.101708-4-dandan.bi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox