\r
#include "HiiDatabase.h"\r
\r
-STATIC EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {\r
+EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {\r
//\r
// B G R\r
//\r
\r
Exit:\r
if (SystemInfo == NULL) {\r
- SafeFreePool (SystemDefault); \r
+ if (SystemDefault != NULL) {\r
+ FreePool (SystemDefault);\r
+ }\r
}\r
return Flag;\r
}\r
Status = GetGlyphBuffer (Private, *StringPtr, FontInfo, &GlyphBuf[Index], &Cell[Index], &Attributes[Index]);\r
if (Status == EFI_NOT_FOUND) {\r
if ((Flags & EFI_HII_IGNORE_IF_NO_GLYPH) == EFI_HII_IGNORE_IF_NO_GLYPH) {\r
- SafeFreePool (GlyphBuf[Index]);\r
+ if (GlyphBuf[Index] != NULL) {\r
+ FreePool (GlyphBuf[Index]);\r
+ }\r
GlyphBuf[Index] = NULL;\r
StringPtr++;\r
} else {\r
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
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
0\r
);\r
if (EFI_ERROR (Status)) {\r
- SafeFreePool (BltBuffer);\r
+ FreePool (BltBuffer);\r
goto Exit;\r
}\r
\r
- SafeFreePool (BltBuffer);\r
+ FreePool (BltBuffer);\r
\r
} else {\r
for (Index1 = RowInfo[RowIndex].StartIndex; Index1 <= RowInfo[RowIndex].EndIndex; Index1++) {\r
Image->Height = 600;\r
Image->Image.Bitmap = AllocateZeroPool (Image->Width * Image->Height *sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
if (Image->Image.Bitmap == NULL) {\r
- SafeFreePool (Image);\r
+ FreePool (Image);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
Exit:\r
\r
for (Index = 0; Index < MAX_STRING_LENGTH; Index++) {\r
- SafeFreePool (GlyphBuf[Index]);\r
+ if (GlyphBuf[Index] != NULL) {\r
+ FreePool (GlyphBuf[Index]);\r
+ }\r
+ }\r
+ if (StringIn != NULL) {\r
+ FreePool (StringIn);\r
+ }\r
+ if (StringIn2 != NULL) {\r
+ FreePool (StringIn2);\r
+ }\r
+ if (StringInfoOut != NULL) {\r
+ FreePool (StringInfoOut);\r
+ }\r
+ if (RowInfo != NULL) {\r
+ FreePool (RowInfo);\r
+ }\r
+ if (SystemDefault != NULL) {\r
+ FreePool (SystemDefault);\r
+ }\r
+ if (GlyphBuf != NULL) {\r
+ FreePool (GlyphBuf);\r
+ }\r
+ if (Cell != NULL) {\r
+ FreePool (Cell);\r
+ }\r
+ if (Attributes != NULL) {\r
+ FreePool (Attributes);\r
}\r
- SafeFreePool (StringIn);\r
- SafeFreePool (StringIn2);\r
- SafeFreePool (StringInfoOut);\r
- SafeFreePool (RowInfo);\r
- SafeFreePool (SystemDefault);\r
- SafeFreePool (GlyphBuf);\r
- SafeFreePool (Cell);\r
- SafeFreePool (Attributes);\r
\r
return Status;\r
}\r
if (Language != NULL) {\r
AsciiStrCpy (CurrentLang, (CHAR8 *) Language);\r
} else {\r
- HiiLibGetCurrentLanguage (CurrentLang);\r
+ GetCurrentLanguage (CurrentLang);\r
}\r
\r
//\r
&StringFontInfo\r
);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
- SafeFreePool (String);\r
+ FreePool (String);\r
String = (EFI_STRING) AllocateZeroPool (StringSize);\r
if (String == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
);\r
\r
Exit:\r
- SafeFreePool (String);\r
- SafeFreePool (StringFontInfo);\r
- SafeFreePool (NewStringInfo);\r
+ if (String != NULL) {\r
+ FreePool (String);\r
+ }\r
+ if (StringFontInfo != NULL) {\r
+ FreePool (StringFontInfo);\r
+ }\r
+ if (NewStringInfo != NULL) {\r
+ FreePool (NewStringInfo);\r
+ }\r
\r
return Status;\r
}\r
\r
Image->Image.Bitmap = AllocateZeroPool (Image->Width * Image->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
if (Image->Image.Bitmap == NULL) {\r
- SafeFreePool (Image);\r
+ FreePool (Image);\r
Status = EFI_OUT_OF_RESOURCES;\r
goto Exit;\r
}\r
}\r
}\r
\r
- SafeFreePool (SystemDefault);\r
- SafeFreePool (StringInfoOut);\r
- SafeFreePool (String);\r
- SafeFreePool (GlyphBuffer);\r
+ if (SystemDefault != NULL) {\r
+ FreePool (SystemDefault);\r
+ }\r
+ if (StringInfoOut != NULL) {\r
+ FreePool (StringInfoOut);\r
+ }\r
+ if (String != NULL) {\r
+ FreePool (String);\r
+ }\r
+ if (GlyphBuffer != NULL) {\r
+ FreePool (GlyphBuffer);\r
+ }\r
\r
return Status;\r
}\r
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
}\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
*FontHandle = LocalFontHandle;\r
}\r
\r
- SafeFreePool (SystemDefault);\r
- SafeFreePool (FontInfo);\r
+ if (SystemDefault != NULL) {\r
+ FreePool (SystemDefault);\r
+ }\r
+ if (FontInfo != NULL) {\r
+ FreePool (FontInfo);\r
+ }\r
return Status;\r
}\r
\r