]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
Refine the code logic for browser and display engine.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Expression.c
index 1a47f2b0a901c063f46e6dc3a9edc829113b02ab..44dae1ba03c76f77d79fdf3d7da0ed31e97910f2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Utility functions for expression evaluation.\r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, 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
@@ -787,7 +787,7 @@ FORM_BROWSER_FORM *
 IdToForm (\r
   IN FORM_BROWSER_FORMSET  *FormSet,\r
   IN UINT16                FormId\r
-)\r
+  )\r
 {\r
   LIST_ENTRY         *Link;\r
   FORM_BROWSER_FORM  *Form;\r
@@ -1446,7 +1446,6 @@ IfrMid (
   UINTN          Base;\r
   UINTN          Length;\r
   CHAR16         *SubString;\r
-  UINT8          *Buffer;\r
   UINT16         BufferLen;\r
 \r
   ZeroMem (Value, sizeof (Value));\r
@@ -1502,7 +1501,6 @@ IfrMid (
 \r
     FreePool (String);\r
   } else {\r
-    Buffer    = Value[2].Buffer;\r
     BufferLen = Value[2].BufferLen;\r
     \r
     Result->Type = EFI_IFR_TYPE_BUFFER;\r
@@ -2107,7 +2105,7 @@ GetQuestionValueFromForm (
   //\r
   FormSet = AllocateZeroPool (sizeof (FORM_BROWSER_FORMSET));\r
   ASSERT (FormSet != NULL);\r
-  Status = InitializeFormSet(HiiHandle, FormSetGuid, FormSet, FALSE);\r
+  Status = InitializeFormSet(HiiHandle, FormSetGuid, FormSet);\r
   if (EFI_ERROR (Status)) {\r
     GetTheVal = FALSE;\r
     goto Done;\r
@@ -2470,22 +2468,21 @@ EvaluateExpression (
       }\r
 \r
       if (OpCode->DevicePath != 0) {\r
-        StrPtr = GetToken (OpCode->DevicePath, FormSet->HiiHandle);\r
-        if (StrPtr == NULL) {\r
-          Value->Type = EFI_IFR_TYPE_UNDEFINED;\r
-          break;\r
-        }\r
-\r
-        DevicePath = ConvertDevicePathFromText(StrPtr);\r
+        Value->Type = EFI_IFR_TYPE_UNDEFINED;\r
 \r
-        if (!GetQuestionValueFromForm(DevicePath, NULL, &OpCode->Guid, Value->Value.u16, &QuestionVal)){\r
-          Value->Type = EFI_IFR_TYPE_UNDEFINED;\r
-        } else {\r
-          Value = &QuestionVal;\r
+        StrPtr = GetToken (OpCode->DevicePath, FormSet->HiiHandle);\r
+        if (StrPtr != NULL && mPathFromText != NULL) {\r
+          DevicePath = mPathFromText->ConvertTextToDevicePath(StrPtr);\r
+          if (DevicePath != NULL && GetQuestionValueFromForm(DevicePath, NULL, &OpCode->Guid, Value->Value.u16, &QuestionVal)) {\r
+            Value = &QuestionVal;\r
+          }\r
+          if (DevicePath != NULL) {\r
+            FreePool (DevicePath);\r
+          }\r
         }\r
 \r
-        if (DevicePath != NULL) {\r
-          FreePool (DevicePath);\r
+        if (StrPtr != NULL) {\r
+          FreePool (StrPtr);\r
         }\r
       } else if (CompareGuid (&OpCode->Guid, &gZeroGuid) != 0) {\r
         if (!GetQuestionValueFromForm(NULL, FormSet->HiiHandle, &OpCode->Guid, Value->Value.u16, &QuestionVal)){\r
@@ -2803,7 +2800,7 @@ EvaluateExpression (
             for (Index = 0; Index < OpCode->ValueWidth; Index ++, TempBuffer --) {\r
               StrPtr += UnicodeValueToString (StrPtr, PREFIX_ZERO | RADIX_HEX, *TempBuffer, 2);\r
             }\r
-            Status = SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, GetSetValueWithEditBuffer);\r
+            Status = SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, GetSetValueWithEditBuffer, NULL);\r
             FreePool (NameValue);\r
             if (!EFI_ERROR (Status)) {\r
               Data1.Value.b = TRUE;\r