summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-23 08:44:26 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-23 08:44:26 +0000
commit02313d1e793e51a5712cca692886f9eff3606faf (patch)
treee6043e90e69c055a9a0ffa400ca4e0a0fa61db22 /MdePkg
parent70e5ca2731d35392db05c283a6bfae4a2a960f32 (diff)
downloadedk2-platforms-02313d1e793e51a5712cca692886f9eff3606faf.tar.xz
Remove volatile for local Index, and Use Memory library functions to fix the reference to compiler intrinsic functions.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7359 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c32
-rw-r--r--MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf1
2 files changed, 12 insertions, 21 deletions
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
index 58f7791fe7..840ea5f2c1 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
@@ -14,11 +14,10 @@
#include <Base.h>
-
-
#include <Library/BaseLib.h>
-#include <Library/UefiDecompressLib.h>
#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiDecompressLib.h>
#include "BaseUefiDecompressLibInternals.h"
@@ -142,7 +141,7 @@ MakeTable (
UINT16 Start[18];
UINT16 *Pointer;
UINT16 Index3;
- volatile UINT16 Index;
+ UINT16 Index;
UINT16 Len;
UINT16 Char;
UINT16 JuBits;
@@ -192,8 +191,8 @@ MakeTable (
if (Index != 0) {
Index3 = (UINT16) (1U << TableBits);
- while (Index != Index3) {
- Table[Index++] = 0;
+ if (Index < Index3) {
+ SetMem16 (Table + Index, (Index3 - Index) * sizeof (*Table), 0);
}
}
@@ -322,7 +321,7 @@ ReadPTLen (
{
UINT16 Number;
UINT16 CharC;
- volatile UINT16 Index;
+ UINT16 Index;
UINT32 Mask;
//
@@ -340,9 +339,7 @@ ReadPTLen (
Sd->mPTTable[Index] = CharC;
}
- for (Index = 0; Index < nn; Index++) {
- Sd->mPTLen[Index] = 0;
- }
+ SetMem (Sd->mPTLen, nn, 0);
return 0;
}
@@ -407,7 +404,7 @@ ReadCLen (
{
UINT16 Number;
UINT16 CharC;
- volatile UINT16 Index;
+ UINT16 Index;
UINT32 Mask;
Number = (UINT16) GetBits (Sd, CBIT);
@@ -418,9 +415,7 @@ ReadCLen (
//
CharC = (UINT16) GetBits (Sd, CBIT);
- for (Index = 0; Index < NC; Index++) {
- Sd->mCLen[Index] = 0;
- }
+ SetMem (Sd->mCLen, NC, 0);
for (Index = 0; Index < 4096; Index++) {
Sd->mCTable[Index] = CharC;
@@ -473,9 +468,7 @@ ReadCLen (
}
}
- while (Index < NC) {
- Sd->mCLen[Index++] = 0;
- }
+ SetMem (Sd->mCLen + Index, NC - Index, 0);
MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
@@ -743,7 +736,6 @@ UefiDecompress (
IN OUT VOID *Scratch OPTIONAL
)
{
- volatile UINT32 Index;
UINT32 CompSize;
UINT32 OrigSize;
SCRATCH_DATA *Sd;
@@ -770,10 +762,8 @@ UefiDecompress (
}
Src = Src + 8;
+ SetMem (Sd, sizeof (SCRATCH_DATA), 0);
- for (Index = 0; Index < sizeof (SCRATCH_DATA); Index++) {
- ((UINT8 *) Sd)[Index] = 0;
- }
//
// The length of the field 'Position Set Code Length Array Size' in Block Header.
// For UEFI 2.0 de/compression algorithm(Version 1), mPBit = 4
diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
index 28b7043cc2..b4e9843936 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
@@ -38,4 +38,5 @@
[LibraryClasses]
BaseLib
DebugLib
+ BaseMemoryLib