]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
MdeModulePkg: Fix MSFT C4255 warning
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Expression.c
index 1938ff2f99cdd5bcc533b622b942f132fdbd187f..297741c0fe9df9d031bd064e5f94e6472c7af8b3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Utility functions for expression evaluation.\r
 \r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -751,6 +751,7 @@ PopExpression (
 **/\r
 UINTN\r
 SaveExpressionEvaluationStackOffset (\r
+  VOID\r
   )\r
 {\r
   UINTN TempStackOffset;\r
@@ -2829,7 +2830,7 @@ EvaluateExpression (
         if (StrPtr != NULL) {\r
           FreePool (StrPtr);\r
         }\r
-      } else if (CompareGuid (&OpCode->Guid, &gZeroGuid) != 0) {\r
+      } else if (IsZeroGuid (&OpCode->Guid)) {\r
         if (!GetQuestionValueFromForm(NULL, FormSet->HiiHandle, &OpCode->Guid, Value->Value.u16, &QuestionVal)){\r
           Value->Type = EFI_IFR_TYPE_UNDEFINED;\r
           break;\r
@@ -3143,7 +3144,14 @@ EvaluateExpression (
             TempBuffer = (UINT8 *) &Value->Value + OpCode->ValueWidth - 1;\r
             StrPtr = NameValue;\r
             for (Index = 0; Index < OpCode->ValueWidth; Index ++, TempBuffer --) {\r
-              StrPtr += UnicodeValueToString (StrPtr, PREFIX_ZERO | RADIX_HEX, *TempBuffer, 2);\r
+              UnicodeValueToStringS (\r
+                StrPtr,\r
+                (OpCode->ValueWidth * 2 + 1) * sizeof (CHAR16) - ((UINTN)StrPtr - (UINTN)NameValue),\r
+                PREFIX_ZERO | RADIX_HEX,\r
+                *TempBuffer,\r
+                2\r
+                );\r
+              StrPtr += StrnLenS (StrPtr, OpCode->ValueWidth * 2 + 1 - ((UINTN)StrPtr - (UINTN)NameValue) / sizeof (CHAR16));\r
             }\r
             Status = SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, GetSetValueWithEditBuffer, NULL);\r
             FreePool (NameValue);\r