]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Merged in the bug fixes from EDK I.
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Sep 2008 01:21:43 +0000 (01:21 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Sep 2008 01:21:43 +0000 (01:21 +0000)
*** Press F9 in Uefi64 FrontPage shouldnot enter sub-menu
** [FT] Some UI error on multiple platforms on framework_20080811
** [FT] UI test of How tall are you(Hex) on framework_20080811

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5767 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
MdeModulePkg/Universal/HiiDatabaseDxe/Font.c

index 73c4e0f362aafaece78cad2caf5fac4a8e7e5928..a60538d42fd2fef675f726d4452fde06079c1fc8 100644 (file)
@@ -664,6 +664,7 @@ HiiConfigRoutingExtractConfig (
   EFI_STATUS                          Status;\r
   LIST_ENTRY                          *Link;\r
   HII_DATABASE_RECORD                 *Database;\r
+  UINT8                               *DevicePathPkg;\r
   UINT8                               *CurrentDevicePath;\r
   EFI_HANDLE                          DriverHandle;\r
   EFI_HII_CONFIG_ACCESS_PROTOCOL      *ConfigAccess;\r
@@ -750,8 +751,9 @@ HiiConfigRoutingExtractConfig (
          Link = Link->ForwardLink\r
         ) {\r
       Database = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);\r
-      CurrentDevicePath = Database->PackageList->DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);\r
-      if (CurrentDevicePath != NULL) {\r
+   \r
+      if ((DevicePathPkg = Database->PackageList->DevicePathPkg) != NULL) {\r
+        CurrentDevicePath = DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);\r
         if (CompareMem (\r
               DevicePath,\r
               CurrentDevicePath,\r
@@ -877,7 +879,6 @@ HiiConfigRoutingExportConfig (
   EFI_HII_CONFIG_ACCESS_PROTOCOL      *ConfigAccess;\r
   EFI_STRING                          AccessProgress;\r
   EFI_STRING                          AccessResults;\r
-  UINTN                               TmpSize;\r
 \r
   //\r
   // For size reduction, please define PcdSupportFullConfigRoutingProtocol \r
@@ -943,9 +944,11 @@ HiiConfigRoutingExportConfig (
     // Generate a <ConfigRequest> with one <ConfigHdr> and zero <RequestElement>.\r
     // It means extract all possible configurations from this specific driver.\r
     //\r
-    TmpSize = StrLen (L"GUID=&NAME=&PATH=");\r
-    RequestSize   = (TmpSize + 32 +  StrLen (Storage->Name) * 4)\r
-                     * sizeof (CHAR16) + PathHdrSize;\r
+    RequestSize = (StrLen (L"GUID=&NAME=&PATH=") + 32) * sizeof (CHAR16) + PathHdrSize;\r
+    if (Storage->Name != NULL) {\r
+      RequestSize += StrLen (Storage->Name) * 4 * sizeof (CHAR16);\r
+    }\r
+    \r
     ConfigRequest = (EFI_STRING) AllocateZeroPool (RequestSize);\r
     if (ConfigRequest == NULL) {\r
       SafeFreePool (PathHdr);\r
@@ -976,10 +979,12 @@ HiiConfigRoutingExportConfig (
     StrnCpy (StringPtr, L"NAME=", StrLen (L"NAME="));\r
     StringPtr += StrLen (L"NAME=");\r
 \r
-    Length = (StrLen (Storage->Name) * 4 + 1) * sizeof (CHAR16);\r
-    Status = UnicodeToConfigString (StringPtr, &Length, Storage->Name);\r
-    ASSERT_EFI_ERROR (Status);\r
-    StringPtr += StrLen (Storage->Name) * 4;\r
+    if (Storage->Name != NULL) {\r
+      Length = (StrLen (Storage->Name) * 4 + 1) * sizeof (CHAR16);\r
+      Status = UnicodeToConfigString (StringPtr, &Length, Storage->Name);\r
+      ASSERT_EFI_ERROR (Status);\r
+      StringPtr += StrLen (Storage->Name) * 4;\r
+    }\r
     \r
     *StringPtr = L'&';\r
     StringPtr++;\r
@@ -1101,6 +1106,7 @@ HiiConfigRoutingRouteConfig (
   EFI_DEVICE_PATH_PROTOCOL            *DevicePath;\r
   LIST_ENTRY                          *Link;\r
   HII_DATABASE_RECORD                 *Database;\r
+  UINT8                               *DevicePathPkg;\r
   UINT8                               *CurrentDevicePath;\r
   EFI_HANDLE                          DriverHandle;\r
   EFI_HII_CONFIG_ACCESS_PROTOCOL      *ConfigAccess;\r
@@ -1180,8 +1186,9 @@ HiiConfigRoutingRouteConfig (
          Link = Link->ForwardLink\r
         ) {\r
       Database = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);\r
-      CurrentDevicePath = Database->PackageList->DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);\r
-      if (CurrentDevicePath != NULL) {\r
+\r
+      if ((DevicePathPkg = Database->PackageList->DevicePathPkg) != NULL) {\r
+        CurrentDevicePath = DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);\r
         if (CompareMem (\r
               DevicePath,\r
               CurrentDevicePath,\r
@@ -1355,7 +1362,19 @@ HiiBlockToConfig (
     Status = EFI_INVALID_PARAMETER;\r
     goto Exit;\r
   }\r
-  while (*StringPtr++ != L'&');\r
+\r
+  while (*StringPtr != L'&' && *StringPtr != 0) {\r
+    StringPtr++;\r
+  }\r
+  if (*StringPtr == 0) {\r
+    *Progress = StringPtr;\r
+    Status = EFI_INVALID_PARAMETER;\r
+    goto Exit;\r
+  }\r
+  //\r
+  // Skip '&'\r
+  //\r
+  StringPtr++;\r
 \r
   //\r
   // Copy <ConfigHdr> and an additional '&' to <ConfigResp>\r
@@ -1604,7 +1623,19 @@ HiiConfigToBlock (
     Status = EFI_INVALID_PARAMETER;\r
     goto Exit;\r
   }\r
-  while (*StringPtr++ != L'&');\r
+\r
+  while (*StringPtr != L'&' && *StringPtr != 0) {\r
+    StringPtr++;\r
+  }\r
+  if (*StringPtr == 0) {\r
+    *Progress = StringPtr;\r
+    Status = EFI_INVALID_PARAMETER;\r
+    goto Exit;\r
+  }\r
+  //\r
+  // Skip '&'\r
+  //\r
+  StringPtr++;\r
 \r
   //\r
   // Parse each <ConfigElement> if exists\r
index 9c68ac89b64d95640e84c6ec8b3beb92de70be46..23b15475dac488582fb0d0c983307495fc01517b 100644 (file)
@@ -1730,7 +1730,6 @@ HiiStringToImage (
         if (LineHeight < Cell[Index].Height) {\r
           LineHeight = (UINTN) Cell[Index].Height;\r
         }\r
-        BaseLineOffset += (UINTN) Cell[Index].OffsetY;\r
 \r
         if ((Flags & EFI_HII_IGNORE_LINE_BREAK) == 0 &&\r
             (Flags & EFI_HII_OUT_FLAG_WRAP) == 0 &&\r
@@ -1799,7 +1798,7 @@ HiiStringToImage (
         if (Index > 0) {\r
           RowInfo[RowIndex].EndIndex       = Index - 1;\r
           RowInfo[RowIndex].LineWidth      = LineWidth - Cell[Index].AdvanceX;\r
-          RowInfo[RowIndex].BaselineOffset = BaseLineOffset - Cell[Index].OffsetY;\r
+          RowInfo[RowIndex].BaselineOffset = BaseLineOffset;\r
           if (LineHeight > Cell[Index - 1].Height) {\r
             LineHeight = Cell[Index - 1].Height;\r
           }\r
@@ -2497,10 +2496,10 @@ HiiGetFontInfo (
   FontInfo->FontStyle = InfoOut.FontInfo.FontStyle;\r
 \r
   if (IsFontInfoExisted (Private, FontInfo, &InfoOut.FontInfoMask, LocalFontHandle, &GlobalFont)) {\r
+    //\r
+    // Test to guarantee all characters are available in the found font.\r
+    //    \r
     if (String != NULL) {\r
-      //\r
-      // Test to guarantee all characters are available in the found font.\r
-      //\r
       StringIn = String;\r
       while (*StringIn != 0) {\r
         Status = FindGlyphBlock (GlobalFont->FontPackage, *StringIn, NULL, NULL, NULL);\r
@@ -2510,29 +2509,27 @@ HiiGetFontInfo (
         }\r
         StringIn++;\r
       }\r
-\r
-      //\r
-      // Write to output parameter\r
-      //\r
-      if (StringInfoOut != NULL) {\r
-        StringInfoOutLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (EFI_FONT_INFO) + GlobalFont->FontInfoSize;\r
-        *StringInfoOut   = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (StringInfoOutLen);\r
-        if (*StringInfoOut == NULL) {\r
-          Status = EFI_OUT_OF_RESOURCES;\r
-          LocalFontHandle = NULL;\r
-          goto Exit;\r
-        }\r
-        CopyMem (*StringInfoOut, &InfoOut, sizeof (EFI_FONT_DISPLAY_INFO));\r
-        CopyMem (&(*StringInfoOut)->FontInfo, GlobalFont->FontInfo, GlobalFont->FontInfoSize);\r
+    }\r
+    //\r
+    // Write to output parameter\r
+    //\r
+    if (StringInfoOut != NULL) {\r
+      StringInfoOutLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (EFI_FONT_INFO) + GlobalFont->FontInfoSize;\r
+      *StringInfoOut   = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (StringInfoOutLen);      \r
+      if (*StringInfoOut == NULL) {\r
+        Status = EFI_OUT_OF_RESOURCES;\r
+        LocalFontHandle = NULL;\r
+        goto Exit;\r
       }\r
-      LocalFontHandle = GlobalFont->Entry.ForwardLink;\r
-\r
-      Status = EFI_SUCCESS;\r
-      goto Exit;\r
+      \r
+      CopyMem (*StringInfoOut, &InfoOut, sizeof (EFI_FONT_DISPLAY_INFO));\r
+      CopyMem (&(*StringInfoOut)->FontInfo, GlobalFont->FontInfo, GlobalFont->FontInfoSize);\r
     }\r
-  } else {\r
-    LocalFontHandle = NULL;\r
-  }\r
+    \r
+    LocalFontHandle = GlobalFont->Entry.ForwardLink;    \r
+    Status = EFI_SUCCESS;\r
+    goto Exit;\r
+  }  \r
 \r
   Status = EFI_NOT_FOUND;\r
 \r