OptionRomPkg: Fix Visual Studio compiler warnings

These changes fix compiler warnings with Visual Studio 2005.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11545 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jljusten 2011-04-17 05:47:13 +00:00
parent a49f6a2f7e
commit f057c25bc2
3 changed files with 28 additions and 23 deletions

View File

@ -43,7 +43,8 @@ Rand32 (
if (Bits > 0) { if (Bits > 0) {
Bits = Bits - 1; Bits = Bits - 1;
} }
R32 = (R32 << Bits) | RShiftU64 (LShiftU64 (TscBits, 64 - Bits), 64 - Bits); R32 = (UINT32)((R32 << Bits) |
RShiftU64 (LShiftU64 (TscBits, 64 - Bits), 64 - Bits));
Found = Found + Bits; Found = Found + Bits;
} while (Found < 32); } while (Found < 32);
@ -101,9 +102,9 @@ TestColor1 (
for (Y = 0; Y < Height; Y++) { for (Y = 0; Y < Height; Y++) {
for (X = 0; X < Width; X++) { for (X = 0; X < Width; X++) {
Color.Red = ((X * 0x100) / Width); Color.Red = (UINT8) ((X * 0x100) / Width);
Color.Green = ((Y * 0x100) / Height); Color.Green = (UINT8) ((Y * 0x100) / Height);
Color.Blue = ((Y * 0x100) / Height); Color.Blue = (UINT8) ((Y * 0x100) / Height);
BltLibVideoFill (&Color, X, Y, 1, 1); BltLibVideoFill (&Color, X, Y, 1, 1);
} }
} }
@ -115,7 +116,7 @@ Uint32SqRt (
IN UINT32 Uint32 IN UINT32 Uint32
) )
{ {
UINTN Mask; UINT32 Mask;
UINT32 SqRt; UINT32 SqRt;
UINT32 SqRtMask; UINT32 SqRtMask;
UINT32 Squared; UINT32 Squared;
@ -124,7 +125,7 @@ Uint32SqRt (
return 0; return 0;
} }
for (SqRt = 0, Mask = 1 << (HighBitSet32 (Uint32) / 2); for (SqRt = 0, Mask = (UINT32) (1 << (HighBitSet32 (Uint32) / 2));
Mask != 0; Mask != 0;
Mask = Mask >> 1 Mask = Mask >> 1
) { ) {
@ -146,20 +147,20 @@ Uint32SqRt (
UINT32 UINT32
Uint32Dist ( Uint32Dist (
IN UINT32 X, IN UINTN X,
IN UINT32 Y IN UINTN Y
) )
{ {
return Uint32SqRt ((X * X) + (Y * Y)); return Uint32SqRt ((UINT32) ((X * X) + (Y * Y)));
} }
UINT32 UINT8
GetTriColor ( GetTriColor (
IN UINT32 ColorDist, IN UINTN ColorDist,
IN UINT32 TriWidth IN UINTN TriWidth
) )
{ {
return (((TriWidth - ColorDist) * 0x100) / TriWidth); return (UINT8) (((TriWidth - ColorDist) * 0x100) / TriWidth);
//return (((TriWidth * TriWidth - ColorDist * ColorDist) * 0x100) / (TriWidth * TriWidth)); //return (((TriWidth * TriWidth - ColorDist * ColorDist) * 0x100) / (TriWidth * TriWidth));
} }
@ -174,14 +175,20 @@ TestColor (
UINTN Y1, Y2; UINTN Y1, Y2;
UINTN LineWidth, TriWidth, ScreenWidth; UINTN LineWidth, TriWidth, ScreenWidth;
UINTN TriHeight, ScreenHeight; UINTN TriHeight, ScreenHeight;
UINTN ColorDist; UINT32 ColorDist;
BltLibGetSizes (&ScreenWidth, &ScreenHeight); BltLibGetSizes (&ScreenWidth, &ScreenHeight);
*(UINT32*) (&Color) = 0; *(UINT32*) (&Color) = 0;
BltLibVideoFill (&Color, 0, 0, ScreenWidth, ScreenHeight); BltLibVideoFill (&Color, 0, 0, ScreenWidth, ScreenHeight);
TriWidth = DivU64x32 (MultU64x32 (11547005, ScreenHeight), 10000000); TriWidth = (UINTN) DivU64x32 (
TriHeight = DivU64x32 (MultU64x32 (8660254, ScreenWidth), 10000000); MultU64x32 (11547005, (UINT32) ScreenHeight),
10000000
);
TriHeight = (UINTN) DivU64x32 (
MultU64x32 (8660254, (UINT32) ScreenWidth),
10000000
);
if (TriWidth > ScreenWidth) { if (TriWidth > ScreenWidth) {
DEBUG ((EFI_D_INFO, "TriWidth at %d was too big\n", TriWidth)); DEBUG ((EFI_D_INFO, "TriWidth at %d was too big\n", TriWidth));
TriWidth = ScreenWidth; TriWidth = ScreenWidth;
@ -200,8 +207,8 @@ TestColor (
for (Y = Y2; Y <= Y1; Y++) { for (Y = Y2; Y <= Y1; Y++) {
LineWidth = LineWidth =
DivU64x32 ( (UINTN) DivU64x32 (
MultU64x32 (11547005, (Y - Y2)), MultU64x32 (11547005, (UINT32) (Y - Y2)),
20000000 20000000
); );
for (X = X2 - LineWidth; X < (X2 + LineWidth); X++) { for (X = X2 - LineWidth; X < (X2 + LineWidth); X++) {

View File

@ -615,7 +615,7 @@ BltLibBufferToVideoEx (
BltMemDst = (VOID*) (mBltLibFrameBuffer + Offset); BltMemDst = (VOID*) (mBltLibFrameBuffer + Offset);
if (mPixelFormat == PixelBlueGreenRedReserved8BitPerColor) { if (mPixelFormat == PixelBlueGreenRedReserved8BitPerColor) {
BltMemSrc = (VOID *) (UINT8 *) BltBuffer + (SrcY * Delta); BltMemSrc = (VOID *) ((UINT8 *) BltBuffer + (SrcY * Delta));
} else { } else {
for (X = 0; X < Width; X++) { for (X = 0; X < Width; X++) {
Blt = Blt =

View File

@ -113,8 +113,6 @@ InternalGopBltCommon (
IN UINTN Delta IN UINTN Delta
) )
{ {
EFI_STATUS Status;
if (mGop == NULL) { if (mGop == NULL) {
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }