summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/HiiDatabaseDxe
diff options
context:
space:
mode:
authorFeng Tian <feng.tian@intel.com>2014-08-07 08:54:34 +0000
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-07 08:54:34 +0000
commit6e1e5405544724406f07344a5911298c3df44129 (patch)
tree1f723606676a8f4fef5ac4aac1682c171ce21381 /MdeModulePkg/Universal/HiiDatabaseDxe
parente935092fa7e1401201e6faadb04b0ae239dd97a5 (diff)
downloadedk2-platforms-6e1e5405544724406f07344a5911298c3df44129.tar.xz
1) Add type cast for better coding style.
2) replace StrCpy() usage in Variable driver with StrnCpy(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15770 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/HiiDatabaseDxe')
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Font.c8
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Image.c12
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/String.c26
3 files changed, 23 insertions, 23 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
index eef31d5bb8..6cc350c42d 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
@@ -757,12 +757,12 @@ FindGlyphBlock (
break;
case EFI_HII_GIBT_EXT1:
- BlockPtr += *(BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8));
+ BlockPtr += *(UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8));
break;
case EFI_HII_GIBT_EXT2:
CopyMem (
&Length16,
- BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8)),
sizeof (UINT16)
);
BlockPtr += Length16;
@@ -770,7 +770,7 @@ FindGlyphBlock (
case EFI_HII_GIBT_EXT4:
CopyMem (
&Length32,
- BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8)),
sizeof (UINT32)
);
BlockPtr += Length32;
@@ -793,7 +793,7 @@ FindGlyphBlock (
BufferLen = BITMAP_LEN_1_BIT (LocalCell.Width, LocalCell.Height);
if (CharCurrent == CharValue) {
return WriteOutputParam (
- BlockPtr + sizeof (EFI_HII_GIBT_GLYPH_BLOCK) - sizeof (UINT8),
+ (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GIBT_GLYPH_BLOCK) - sizeof (UINT8)),
BufferLen,
&LocalCell,
GlyphBuffer,
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index ed0cf83c48..560cf8fe2c 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -79,13 +79,13 @@ GetImageIdOrAddress (
}
switch (((EFI_HII_IMAGE_BLOCK *) ImageBlock)->BlockType) {
case EFI_HII_IIBT_EXT1:
- Length8 = *(ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8));
+ Length8 = *(UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8));
ImageBlock += Length8;
break;
case EFI_HII_IIBT_EXT2:
CopyMem (
&Length16,
- ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8)),
sizeof (UINT16)
);
ImageBlock += Length16;
@@ -93,7 +93,7 @@ GetImageIdOrAddress (
case EFI_HII_IIBT_EXT4:
CopyMem (
&Length32,
- ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8)),
sizeof (UINT32)
);
ImageBlock += Length32;
@@ -920,19 +920,19 @@ HiiGetImage (
if (BlockType == EFI_HII_IIBT_IMAGE_1BIT || BlockType == EFI_HII_IIBT_IMAGE_1BIT_TRANS) {
Output1bitPixel (
Image,
- (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK) - sizeof (UINT8)),
+ (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK) - sizeof (UINT8)),
(EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo
);
} else if (BlockType == EFI_HII_IIBT_IMAGE_4BIT || BlockType == EFI_HII_IIBT_IMAGE_4BIT_TRANS) {
Output4bitPixel (
Image,
- (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_4BIT_BLOCK) - sizeof (UINT8)),
+ (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_4BIT_BLOCK) - sizeof (UINT8)),
(EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo
);
} else {
Output8bitPixel (
Image,
- (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8)),
+ (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8)),
(EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo
);
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index f3c0555cbc..1f4be0c405 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 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -335,7 +335,7 @@ FindStringBlock (
case EFI_HII_SIBT_STRINGS_SCSU:
CopyMem (&StringCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));
- StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) - sizeof (UINT8);
+ StringTextPtr = (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) - sizeof (UINT8));
BlockSize += StringTextPtr - BlockHdr;
for (Index = 0; Index < StringCount; Index++) {
@@ -355,10 +355,10 @@ FindStringBlock (
case EFI_HII_SIBT_STRINGS_SCSU_FONT:
CopyMem (
&StringCount,
- BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),
sizeof (UINT16)
);
- StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) - sizeof (UINT8);
+ StringTextPtr = (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) - sizeof (UINT8));
BlockSize += StringTextPtr - BlockHdr;
for (Index = 0; Index < StringCount; Index++) {
@@ -425,7 +425,7 @@ FindStringBlock (
BlockSize += Offset;
CopyMem (
&StringCount,
- BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),
sizeof (UINT16)
);
for (Index = 0; Index < StringCount; Index++) {
@@ -465,7 +465,7 @@ FindStringBlock (
break;
case EFI_HII_SIBT_SKIP1:
- SkipCount = (UINT16) (*(BlockHdr + sizeof (EFI_HII_STRING_BLOCK)));
+ SkipCount = (UINT16) (*(UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK)));
CurrentStringId = (UINT16) (CurrentStringId + SkipCount);
BlockSize += sizeof (EFI_HII_SIBT_SKIP1_BLOCK);
break;
@@ -479,7 +479,7 @@ FindStringBlock (
case EFI_HII_SIBT_EXT1:
CopyMem (
&Length8,
- BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),
sizeof (UINT8)
);
BlockSize += Length8;
@@ -494,7 +494,7 @@ FindStringBlock (
//
BlockHdr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);
CopyMem (&FontId, BlockHdr, sizeof (UINT8));
- BlockHdr += sizeof (UINT8);
+ BlockHdr ++;
CopyMem (&FontSize, BlockHdr, sizeof (UINT16));
BlockHdr += sizeof (UINT16);
CopyMem (&FontStyle, BlockHdr, sizeof (EFI_HII_FONT_STYLE));
@@ -535,7 +535,7 @@ FindStringBlock (
case EFI_HII_SIBT_EXT4:
CopyMem (
&Length32,
- BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),
sizeof (UINT32)
);
@@ -1080,7 +1080,7 @@ SetStringWorker (
BlockPtr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);
*BlockPtr = LocalFont->FontId;
- BlockPtr += sizeof (UINT8);
+ BlockPtr ++;
CopyMem (BlockPtr, &GlobalFont->FontInfo->FontSize, sizeof (UINT16));
BlockPtr += sizeof (UINT16);
CopyMem (BlockPtr, &GlobalFont->FontInfo->FontStyle, sizeof (UINT32));
@@ -1442,7 +1442,7 @@ HiiNewString (
*BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;
BlockPtr += sizeof (EFI_HII_STRING_BLOCK);
*BlockPtr = LocalFont->FontId;
- BlockPtr += sizeof (UINT8);
+ BlockPtr ++;
CopyMem (BlockPtr, (EFI_STRING) String, StrSize ((EFI_STRING) String));
BlockPtr += StrSize ((EFI_STRING) String);
@@ -1486,7 +1486,7 @@ HiiNewString (
BlockPtr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);
*BlockPtr = LocalFont->FontId;
- BlockPtr += sizeof (UINT8);
+ BlockPtr ++;
CopyMem (BlockPtr, &((EFI_FONT_INFO *) StringFontInfo)->FontSize, sizeof (UINT16));
BlockPtr += sizeof (UINT16);
CopyMem (BlockPtr, &((EFI_FONT_INFO *) StringFontInfo)->FontStyle, sizeof (EFI_HII_FONT_STYLE));
@@ -1503,7 +1503,7 @@ HiiNewString (
*BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;
BlockPtr += sizeof (EFI_HII_STRING_BLOCK);
*BlockPtr = LocalFont->FontId;
- BlockPtr += sizeof (UINT8);
+ BlockPtr ++;
CopyMem (BlockPtr, (EFI_STRING) String, StrSize ((EFI_STRING) String));
BlockPtr += StrSize ((EFI_STRING) String);