summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2011-01-07 23:00:16 +0000
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2011-01-07 23:00:16 +0000
commitaf072124e4f2f004f2200d765a72efb7c97c9aec (patch)
treea75c50d2062a71fb839d1f557a9ad920203cec37 /MdePkg
parent2183cf235350694f05b9a18ac9ca26f1efbe1106 (diff)
downloadedk2-platforms-af072124e4f2f004f2200d765a72efb7c97c9aec.tar.xz
Fix InternalMemScanMem* functions so that they return the pointer to the matched object, as specified, instead of the following object.
Replaces the fix instituted in rev. 10821 with a more understandable, sustainable, and efficient fix that behaves the same regardless of compiler. Reviewed by two peers. Fixes HSD tracker 204556. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11237 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BaseMemoryLib/MemLibGeneric.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c b/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
index 1e3c4c3f13..a977c4aadc 100644
--- a/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
+++ b/MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
@@ -162,9 +162,10 @@ InternalMemScanMem8 (
Pointer = (CONST UINT8*)Buffer;
do {
- if (*(Pointer++) == Value) {
- return --Pointer;
+ if (*Pointer == Value) {
+ return Pointer;
}
+ ++Pointer;
} while (--Length != 0);
return NULL;
}
@@ -192,9 +193,10 @@ InternalMemScanMem16 (
Pointer = (CONST UINT16*)Buffer;
do {
- if (*(Pointer++) == Value) {
- return --Pointer;
+ if (*Pointer == Value) {
+ return Pointer;
}
+ ++Pointer;
} while (--Length != 0);
return NULL;
}
@@ -222,9 +224,10 @@ InternalMemScanMem32 (
Pointer = (CONST UINT32*)Buffer;
do {
- if (*(Pointer++) == Value) {
- return --Pointer;
+ if (*Pointer == Value) {
+ return Pointer;
}
+ ++Pointer;
} while (--Length != 0);
return NULL;
}
@@ -252,9 +255,10 @@ InternalMemScanMem64 (
Pointer = (CONST UINT64*)Buffer;
do {
- if (*(Pointer++) == Value) {
- return --Pointer;
+ if (*Pointer == Value) {
+ return Pointer;
}
+ ++Pointer;
} while (--Length != 0);
return NULL;
}