]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OptionRomPkg: Fix Visual Studio compiler warnings
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 17 Apr 2011 05:47:13 +0000 (05:47 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 17 Apr 2011 05:47:13 +0000 (05:47 +0000)
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

OptionRomPkg/Application/BltLibSample/BltLibSample.c
OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
OptionRomPkg/Library/GopBltLib/GopBltLib.c

index 24718131a48c2f3a87313a8138ed47ccc2abcc04..fd2b2ce345b3b4e9610baaa807350f568a9b2bc5 100644 (file)
@@ -43,7 +43,8 @@ Rand32 (
     if (Bits > 0) {\r
       Bits = Bits - 1;\r
     }\r
-    R32 = (R32 << Bits) | RShiftU64 (LShiftU64 (TscBits, 64 - Bits), 64 - Bits);\r
+    R32 = (UINT32)((R32 << Bits) |\r
+                   RShiftU64 (LShiftU64 (TscBits, 64 - Bits), 64 - Bits));\r
     Found = Found + Bits;\r
   } while (Found < 32);\r
 \r
@@ -101,9 +102,9 @@ TestColor1 (
 \r
   for (Y = 0; Y < Height; Y++) {\r
     for (X = 0; X < Width; X++) {\r
-      Color.Red = ((X * 0x100) / Width);\r
-      Color.Green = ((Y * 0x100) / Height);\r
-      Color.Blue = ((Y * 0x100) / Height);\r
+      Color.Red =   (UINT8) ((X * 0x100) / Width);\r
+      Color.Green = (UINT8) ((Y * 0x100) / Height);\r
+      Color.Blue =  (UINT8) ((Y * 0x100) / Height);\r
       BltLibVideoFill (&Color, X, Y, 1, 1);\r
     }\r
   }\r
@@ -115,7 +116,7 @@ Uint32SqRt (
   IN  UINT32  Uint32\r
   )\r
 {\r
-  UINT Mask;\r
+  UINT32 Mask;\r
   UINT32 SqRt;\r
   UINT32 SqRtMask;\r
   UINT32 Squared;\r
@@ -124,7 +125,7 @@ Uint32SqRt (
     return 0;\r
   }\r
 \r
-  for (SqRt = 0, Mask = 1 << (HighBitSet32 (Uint32) / 2);\r
+  for (SqRt = 0, Mask = (UINT32) (1 << (HighBitSet32 (Uint32) / 2));\r
        Mask != 0;\r
        Mask = Mask >> 1\r
       ) {\r
@@ -146,20 +147,20 @@ Uint32SqRt (
 \r
 UINT32\r
 Uint32Dist (\r
-  IN UINT32 X,\r
-  IN UINT32 Y\r
+  IN UINTN X,\r
+  IN UINTN Y\r
   )\r
 {\r
-  return Uint32SqRt ((X * X) + (Y * Y));\r
+  return Uint32SqRt ((UINT32) ((X * X) + (Y * Y)));\r
 }\r
 \r
-UINT32\r
+UINT8\r
 GetTriColor (\r
-  IN UINT32 ColorDist,\r
-  IN UINT32 TriWidth\r
+  IN UINTN ColorDist,\r
+  IN UINTN TriWidth\r
   )\r
 {\r
-  return (((TriWidth - ColorDist) * 0x100) / TriWidth);\r
+  return (UINT8) (((TriWidth - ColorDist) * 0x100) / TriWidth);\r
   //return (((TriWidth * TriWidth - ColorDist * ColorDist) * 0x100) / (TriWidth * TriWidth));\r
 }\r
 \r
@@ -174,14 +175,20 @@ TestColor (
   UINTN                          Y1, Y2;\r
   UINTN                          LineWidth, TriWidth, ScreenWidth;\r
   UINTN                          TriHeight, ScreenHeight;\r
-  UINT                         ColorDist;\r
+  UINT32                         ColorDist;\r
 \r
   BltLibGetSizes (&ScreenWidth, &ScreenHeight);\r
   *(UINT32*) (&Color) = 0;\r
   BltLibVideoFill (&Color, 0, 0, ScreenWidth, ScreenHeight);\r
 \r
-  TriWidth = DivU64x32 (MultU64x32 (11547005, ScreenHeight), 10000000);\r
-  TriHeight = DivU64x32 (MultU64x32 (8660254, ScreenWidth), 10000000);\r
+  TriWidth = (UINTN) DivU64x32 (\r
+                       MultU64x32 (11547005, (UINT32) ScreenHeight),\r
+                       10000000\r
+                       );\r
+  TriHeight = (UINTN) DivU64x32 (\r
+                        MultU64x32 (8660254, (UINT32) ScreenWidth),\r
+                        10000000\r
+                        );\r
   if (TriWidth > ScreenWidth) {\r
     DEBUG ((EFI_D_INFO, "TriWidth at %d was too big\n", TriWidth));\r
     TriWidth = ScreenWidth;\r
@@ -200,10 +207,10 @@ TestColor (
 \r
   for (Y = Y2; Y <= Y1; Y++) {\r
     LineWidth =\r
-      DivU64x32 (\r
-        MultU64x32 (11547005, (Y - Y2)),\r
-        20000000\r
-        );\r
+      (UINTN) DivU64x32 (\r
+                MultU64x32 (11547005, (UINT32) (Y - Y2)),\r
+                20000000\r
+                );\r
     for (X = X2 - LineWidth; X < (X2 + LineWidth); X++) {\r
       ColorDist = Uint32Dist(X - X1, Y1 - Y);\r
       Color.Red = GetTriColor (ColorDist, TriWidth);\r
index dd54b0799b26676542d7c5b530b7b7174b0296a5..5bb3cfbb28c0fa87ec88459e2150081b89d4bbac 100644 (file)
@@ -615,7 +615,7 @@ BltLibBufferToVideoEx (
     BltMemDst = (VOID*) (mBltLibFrameBuffer + Offset);\r
 \r
     if (mPixelFormat == PixelBlueGreenRedReserved8BitPerColor) {\r
-      BltMemSrc = (VOID *) (UINT8 *) BltBuffer + (SrcY * Delta);\r
+      BltMemSrc = (VOID *) ((UINT8 *) BltBuffer + (SrcY * Delta));\r
     } else {\r
       for (X = 0; X < Width; X++) {\r
         Blt =\r
index 5c353bc4832b6d872452e6da26c7c34de3aa8891..5a90d9b614eb525bf51692a7296e3412aaf5ffab 100644 (file)
@@ -113,8 +113,6 @@ InternalGopBltCommon (
   IN  UINTN                                 Delta\r
   )\r
 {\r
-  EFI_STATUS                    Status;\r
-\r
   if (mGop == NULL) {\r
     return EFI_DEVICE_ERROR;\r
   }\r