]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg/HttpDxe: Fix build warning error if CHAR8 is unsigned.
authorJiaxin Wu <jiaxin.wu@intel.com>
Tue, 2 Jan 2018 03:29:03 +0000 (11:29 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Wed, 10 Jan 2018 00:32:47 +0000 (08:32 +0800)
This patch is to fix the compiler warning error: C4245. The issue will happen
if the below build option is enabled:
  *_*_*_CC_FLAGS = -J.

That's because the value of ('A' - 'a') is a negative value, which will
be converted to an unsigned type if CHAR8 is treated as unsigned:
  Src -= ('A' - 'a');

The above issue is also recorded at:
https://bugzilla.tianocore.org/show_bug.cgi?id=815.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
NetworkPkg/HttpDxe/HttpsSupport.c

index e6f4d5a6ccb285ac626c5e615c0e999829b151a5..6aed61a3a4b8779ba48453fa91a116d81cd078a3 100644 (file)
@@ -67,11 +67,11 @@ AsciiStrCaseStr (
       Dst = *SearchStringTmp;\r
 \r
       if ((Src >= 'A') && (Src <= 'Z')) {\r
-        Src -= ('A' - 'a');\r
+        Src += ('a' - 'A');\r
       }\r
 \r
       if ((Dst >= 'A') && (Dst <= 'Z')) {\r
-        Dst -= ('A' - 'a');\r
+        Dst += ('a' - 'A');\r
       }\r
 \r
       if (Src != Dst) {\r