X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FHiiDatabaseDxe%2FString.c;fp=MdeModulePkg%2FUniversal%2FHiiDatabaseDxe%2FString.c;h=aeda47430f7203c5c2f82756ad125a3a59655955;hp=d5a7488a79d39ee2201560dc8146881e805451e0;hb=d1102dba7210b95e41d06c2338a22ba6af248645;hpb=ca79bab7af4770c5eb578f6d495af01705aedb79 diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c index d5a7488a79..aeda47430f 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c @@ -2,7 +2,7 @@ Implementation for EFI_HII_STRING_PROTOCOL. -Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -236,7 +236,7 @@ GetStringFontInfo ( /** Parse all string blocks to find a String block specified by StringId. If StringId = (EFI_STRING_ID) (-1), find out all EFI_HII_SIBT_FONT blocks - within this string package and backup its information. If LastStringId is + within this string package and backup its information. If LastStringId is specified, the string id of last string block will also be output. If StringId = 0, output the string id of last string block (EFI_HII_SIBT_STRING). @@ -524,7 +524,7 @@ FindStringBlock ( // Since string package tool set FontId initially to 0 and increases it // progressively by one, StringPackage->FondId always represents an unique // and available FontId. - // + // StringPackage->FontId++; FreePool (FontInfo); @@ -574,7 +574,7 @@ FindStringBlock ( *StartStringId = CurrentStringId; } } - + // // Get last string ID // @@ -681,7 +681,7 @@ GetStringWorker ( } // - // Get the string font. The FontId 0 is the default font for those string blocks which + // Get the string font. The FontId 0 is the default font for those string blocks which // do not specify a font identifier. If default font is not specified, return NULL. // if (StringFontInfo != NULL) { @@ -706,17 +706,17 @@ GetStringWorker ( /** If GetStringBlock find the StringId's string is not saved in the exist string block, - this function will create the UCS2 string block to save the string; also split the + this function will create the UCS2 string block to save the string; also split the skip block into two or one skip block. This is a internal function. - + @param StringPackage Hii string package instance. @param StartStringId The first id in the skip block which StringId in the block. @param StringId The string's id, which is unique within - PackageList. - @param BlockType Output the block type of found string block. - @param StringBlockAddr Output the block address of found string block. + PackageList. + @param BlockType Output the block type of found string block. + @param StringBlockAddr Output the block address of found string block. @param FontBlock whether this string block has font info. @retval EFI_SUCCESS The string font is outputted successfully. @@ -735,7 +735,7 @@ InsertLackStringBlock ( { UINT8 *BlockPtr; UINT8 *StringBlock; - UINT32 SkipLen; + UINT32 SkipLen; UINT32 OldBlockSize; UINT32 NewBlockSize; UINT32 FrontSkipNum; @@ -746,7 +746,7 @@ InsertLackStringBlock ( FrontSkipNum = 0; SkipLen = 0; OldStringAddr = *StringBlockAddr; - + ASSERT (*BlockType == EFI_HII_SIBT_SKIP1 || *BlockType == EFI_HII_SIBT_SKIP2); // // Old skip block size. @@ -757,7 +757,7 @@ InsertLackStringBlock ( } else { SkipLen = sizeof (EFI_HII_SIBT_SKIP2_BLOCK); IdCount = *(UINT16*)(OldStringAddr + sizeof (EFI_HII_STRING_BLOCK)); - } + } // // New create UCS or UCS2 block size. @@ -801,7 +801,7 @@ InsertLackStringBlock ( // // Copy old block in front of skip block. // - CopyMem (StringBlock, StringPackage->StringBlock, OldStringAddr - StringPackage->StringBlock); + CopyMem (StringBlock, StringPackage->StringBlock, OldStringAddr - StringPackage->StringBlock); BlockPtr = StringBlock + (OldStringAddr - StringPackage->StringBlock); if (FrontSkipNum > 0) { @@ -838,7 +838,7 @@ InsertLackStringBlock ( // // Append a EFI_HII_SIBT_END block to the end. // - CopyMem (BlockPtr, OldStringAddr + SkipLen, OldBlockSize - (OldStringAddr - StringPackage->StringBlock) - SkipLen); + CopyMem (BlockPtr, OldStringAddr + SkipLen, OldBlockSize - (OldStringAddr - StringPackage->StringBlock) - SkipLen); if (FontBlock) { *BlockType = EFI_HII_SIBT_STRING_UCS2_FONT; @@ -918,9 +918,9 @@ SetStringWorker ( &StartStringId ); if (EFI_ERROR (Status) && (BlockType == EFI_HII_SIBT_SKIP1 || BlockType == EFI_HII_SIBT_SKIP2)) { - Status = InsertLackStringBlock(StringPackage, - StartStringId, - StringId, + Status = InsertLackStringBlock(StringPackage, + StartStringId, + StringId, &BlockType, &StringBlockAddr, (BOOLEAN)(StringFontInfo != NULL) @@ -947,11 +947,11 @@ SetStringWorker ( return EFI_INVALID_PARAMETER; } else { Referred = ReferFontInfoLocally ( - Private, - StringPackage, - StringPackage->FontId, - FALSE, - GlobalFont, + Private, + StringPackage, + StringPackage->FontId, + FALSE, + GlobalFont, &LocalFont ); if (!Referred) { @@ -962,7 +962,7 @@ SetStringWorker ( // Update the FontId of the specified string block to input font info. // switch (BlockType) { - case EFI_HII_SIBT_STRING_SCSU_FONT: + case EFI_HII_SIBT_STRING_SCSU_FONT: case EFI_HII_SIBT_STRINGS_SCSU_FONT: case EFI_HII_SIBT_STRING_UCS2_FONT: case EFI_HII_SIBT_STRINGS_UCS2_FONT: @@ -973,7 +973,7 @@ SetStringWorker ( // When modify the font info of these blocks, the block type should be updated // to contain font info thus the whole structure should be revised. // It is recommended to use tool to modify the block type not in the code. - // + // return EFI_UNSUPPORTED; } } @@ -1004,7 +1004,7 @@ SetStringWorker ( } *BlockPtr++ = 0; - + TmpSize = OldBlockSize - (StringTextPtr - StringPackage->StringBlock) - AsciiStrSize ((CHAR8 *) StringTextPtr); CopyMem ( BlockPtr, @@ -1107,9 +1107,9 @@ SetStringWorker ( /** This function adds the string String to the group of strings owned by PackageList, with the - specified font information StringFontInfo and returns a new string id. - The new string identifier is guaranteed to be unique within the package list. - That new string identifier is reserved for all languages in the package list. + specified font information StringFontInfo and returns a new string id. + The new string identifier is guaranteed to be unique within the package list. + That new string identifier is reserved for all languages in the package list. @param This A pointer to the EFI_HII_STRING_PROTOCOL instance. @@ -1341,7 +1341,7 @@ HiiNewString ( // Calculate the length of the string blocks, including string block to record // printable language full name and EFI_HII_SIBT_END_BLOCK. // - Ucs2BlockSize = (UINT32) (StrSize ((CHAR16 *) LanguageName) + + Ucs2BlockSize = (UINT32) (StrSize ((CHAR16 *) LanguageName) + (*StringId - 1) * sizeof (EFI_HII_SIBT_STRING_UCS2_BLOCK) - sizeof (CHAR16)); BlockSize = Ucs2BlockSize + sizeof (EFI_HII_SIBT_END_BLOCK); @@ -1519,7 +1519,7 @@ HiiNewString ( PackageListNode->PackageListHdr.PackageLength += FontBlockSize + Ucs2FontBlockSize; // - // Increase the FontId to make it unique since we already add + // Increase the FontId to make it unique since we already add // a EFI_HII_SIBT_FONT block to this string package. // StringPackage->FontId++; @@ -1671,16 +1671,16 @@ HiiGetString ( // // Second search: to match the StringId in other available languages if exist. // - for (Link = PackageListNode->StringPkgHdr.ForwardLink; + for (Link = PackageListNode->StringPkgHdr.ForwardLink; Link != &PackageListNode->StringPkgHdr; Link = Link->ForwardLink ) { - StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE); + StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE); Status = GetStringWorker (Private, StringPackage, StringId, NULL, NULL, NULL); if (!EFI_ERROR (Status)) { return EFI_INVALID_LANGUAGE; } - } + } } return EFI_NOT_FOUND; @@ -1940,7 +1940,7 @@ HiiGetSecondaryLanguages ( Private = HII_STRING_DATABASE_PRIVATE_DATA_FROM_THIS (This); - PackageListNode = NULL; + PackageListNode = NULL; for (Link = Private->DatabaseList.ForwardLink; Link != &Private->DatabaseList; Link = Link->ForwardLink) { DatabaseRecord = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE); if (DatabaseRecord->Handle == PackageList) { @@ -1951,7 +1951,7 @@ HiiGetSecondaryLanguages ( if (PackageListNode == NULL) { return EFI_NOT_FOUND; } - + Languages = NULL; ResultSize = 0; for (Link1 = PackageListNode->StringPkgHdr.ForwardLink;