]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Correct the wrong '?' character to '-', and add check DestinationBuffer == SourceBuff...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 8 Sep 2008 01:24:16 +0000 (01:24 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 8 Sep 2008 01:24:16 +0000 (01:24 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5831 6f19259b-4bc3-4df7-8a09-765794883524

72 files changed:
MdePkg/Include/Library/BaseMemoryLib.h
MdePkg/Include/Library/MemoryAllocationLib.h
MdePkg/Library/BaseDebugLibNull/DebugLib.c
MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
MdePkg/Library/BaseMemoryLib/CompareMemWrapper.c
MdePkg/Library/BaseMemoryLib/MemLibGuid.c
MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.c
MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.c
MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.c
MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.c
MdePkg/Library/BaseMemoryLib/SetMemWrapper.c
MdePkg/Library/BaseMemoryLib/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibMmx/CompareMemWrapper.c
MdePkg/Library/BaseMemoryLibMmx/MemLibGuid.c
MdePkg/Library/BaseMemoryLibMmx/ScanMem16Wrapper.c
MdePkg/Library/BaseMemoryLibMmx/ScanMem32Wrapper.c
MdePkg/Library/BaseMemoryLibMmx/ScanMem64Wrapper.c
MdePkg/Library/BaseMemoryLibMmx/ScanMem8Wrapper.c
MdePkg/Library/BaseMemoryLibMmx/SetMemWrapper.c
MdePkg/Library/BaseMemoryLibMmx/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibOptDxe/CompareMemWrapper.c
MdePkg/Library/BaseMemoryLibOptDxe/MemLibGuid.c
MdePkg/Library/BaseMemoryLibOptDxe/ScanMem16Wrapper.c
MdePkg/Library/BaseMemoryLibOptDxe/ScanMem32Wrapper.c
MdePkg/Library/BaseMemoryLibOptDxe/ScanMem64Wrapper.c
MdePkg/Library/BaseMemoryLibOptDxe/ScanMem8Wrapper.c
MdePkg/Library/BaseMemoryLibOptDxe/SetMemWrapper.c
MdePkg/Library/BaseMemoryLibOptDxe/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibOptPei/CompareMemWrapper.c
MdePkg/Library/BaseMemoryLibOptPei/MemLibGuid.c
MdePkg/Library/BaseMemoryLibOptPei/ScanMem16Wrapper.c
MdePkg/Library/BaseMemoryLibOptPei/ScanMem32Wrapper.c
MdePkg/Library/BaseMemoryLibOptPei/ScanMem64Wrapper.c
MdePkg/Library/BaseMemoryLibOptPei/ScanMem8Wrapper.c
MdePkg/Library/BaseMemoryLibOptPei/SetMemWrapper.c
MdePkg/Library/BaseMemoryLibOptPei/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibRepStr/CompareMemWrapper.c
MdePkg/Library/BaseMemoryLibRepStr/MemLibGuid.c
MdePkg/Library/BaseMemoryLibRepStr/ScanMem16Wrapper.c
MdePkg/Library/BaseMemoryLibRepStr/ScanMem32Wrapper.c
MdePkg/Library/BaseMemoryLibRepStr/ScanMem64Wrapper.c
MdePkg/Library/BaseMemoryLibRepStr/ScanMem8Wrapper.c
MdePkg/Library/BaseMemoryLibRepStr/SetMemWrapper.c
MdePkg/Library/BaseMemoryLibRepStr/ZeroMemWrapper.c
MdePkg/Library/BaseMemoryLibSse2/CompareMemWrapper.c
MdePkg/Library/BaseMemoryLibSse2/MemLibGuid.c
MdePkg/Library/BaseMemoryLibSse2/ScanMem16Wrapper.c
MdePkg/Library/BaseMemoryLibSse2/ScanMem32Wrapper.c
MdePkg/Library/BaseMemoryLibSse2/ScanMem64Wrapper.c
MdePkg/Library/BaseMemoryLibSse2/ScanMem8Wrapper.c
MdePkg/Library/BaseMemoryLibSse2/SetMemWrapper.c
MdePkg/Library/BaseMemoryLibSse2/ZeroMemWrapper.c
MdePkg/Library/DxeMemoryLib/CompareMemWrapper.c
MdePkg/Library/DxeMemoryLib/MemLib.c
MdePkg/Library/DxeMemoryLib/MemLibGuid.c
MdePkg/Library/DxeMemoryLib/ScanMem16Wrapper.c
MdePkg/Library/DxeMemoryLib/ScanMem32Wrapper.c
MdePkg/Library/DxeMemoryLib/ScanMem64Wrapper.c
MdePkg/Library/DxeMemoryLib/ScanMem8Wrapper.c
MdePkg/Library/DxeMemoryLib/SetMemWrapper.c
MdePkg/Library/DxeMemoryLib/ZeroMemWrapper.c
MdePkg/Library/PeiMemoryLib/CompareMemWrapper.c
MdePkg/Library/PeiMemoryLib/MemLib.c
MdePkg/Library/PeiMemoryLib/MemLibGuid.c
MdePkg/Library/PeiMemoryLib/ScanMem16Wrapper.c
MdePkg/Library/PeiMemoryLib/ScanMem32Wrapper.c
MdePkg/Library/PeiMemoryLib/ScanMem64Wrapper.c
MdePkg/Library/PeiMemoryLib/ScanMem8Wrapper.c
MdePkg/Library/PeiMemoryLib/SetMemWrapper.c
MdePkg/Library/PeiMemoryLib/ZeroMemWrapper.c
MdePkg/Library/UefiDebugLibConOut/DebugLib.c
MdePkg/Library/UefiDebugLibStdErr/DebugLib.c

index b680f2b5500c03fb07dc01eda5406e4c782658af..4eb0bf257abf25147742b433b4b2f65942770e30 100644 (file)
@@ -43,7 +43,7 @@ CopyMem (
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
@@ -146,7 +146,7 @@ SetMem64 (
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
@@ -199,7 +199,7 @@ CompareMem (
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
@@ -227,7 +227,7 @@ ScanMem8 (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
@@ -255,7 +255,7 @@ ScanMem16 (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
@@ -283,7 +283,7 @@ ScanMem32 (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
@@ -355,7 +355,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index 935ff3b96bf37170ad565c845ce68e343c024433..76a9f8a564f2bf70b4d0b147160a78ab0951450b 100644 (file)
@@ -304,7 +304,7 @@ AllocateReservedZeroPool (
   allocated buffer.  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there\r
   is not enough memory remaining to satisfy the request, then NULL is returned.\r
   If Buffer is NULL, then ASSERT().\r
-  If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
   @param  Buffer                The buffer to copy to the allocated buffer.\r
@@ -327,7 +327,7 @@ AllocateCopyPool (
   allocated buffer.  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there\r
   is not enough memory remaining to satisfy the request, then NULL is returned.\r
   If Buffer is NULL, then ASSERT().\r
-  If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
   @param  Buffer                The buffer to copy to the allocated buffer.\r
@@ -350,7 +350,7 @@ AllocateRuntimeCopyPool (
   allocated buffer.  If AllocationSize is 0, then a valid buffer of 0 size is returned.  If there\r
   is not enough memory remaining to satisfy the request, then NULL is returned.\r
   If Buffer is NULL, then ASSERT().\r
-  If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  AllocationSize        The number of bytes to allocate and zero.\r
   @param  Buffer                The buffer to copy to the allocated buffer.\r
index 9259ab6432a888ba2910e17c5110146ddd104345..c9916165a04c3c196337897ff8ccf9237a60f5e7 100644 (file)
@@ -80,7 +80,7 @@ DebugAssert (
 \r
   If Buffer is NULL, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param   Buffer  Pointer to the target buffer to fill with PcdDebugClearMemoryValue.\r
   @param   Length  Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r
index 266b25cdcf3e293421c97c791dd4f0fb06bdf71a..4a832b87f15b1616ace9feda55e021c682a5814e 100644 (file)
@@ -140,7 +140,7 @@ DebugAssert (
 \r
   If Buffer is NULL, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param   Buffer  Pointer to the target buffer to be filled with PcdDebugClearMemoryValue.\r
   @param   Length  Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r
index 031b7fcec6456ad767d735d05b4ab9f71a632611..61b01096b26bd4dc0869567907fd79693bb55e65 100644 (file)
@@ -58,7 +58,7 @@ CompareMem (
   IN UINTN       Length\r
   )\r
 {\r
-  if (0 == Length) {\r
+  if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
     return 0;\r
   }\r
   ASSERT (DestinationBuffer != NULL);\r
index 9825b9f7922f6dc5098391426ad41359beb0c6d9..cbc546fa8000b7b87068957318a904ddb6c87372 100644 (file)
@@ -106,7 +106,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index e45202d9501d141b3173dee33061ba7e3bf00170..c9eb0c49e04f94d70574490c61ac933158454954 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index a4a16372e67234206a2f0a32961bbca7255e478e..797879c0b1fd45cc70ef9d2745854d29bc0e0023 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index b182243648989ba1f073dec82c69003c32a166c0..076bb34f1bad4e40c3ba1c805bdf1ca13cf96df1 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 8164e2a181c59ad3069610fbfad437ec235157bd..dc5f3e960f76c9a72c4014ca74c977a27198e958 100644 (file)
@@ -37,7 +37,7 @@
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 0e3428cd7a88d740cf514a20bf8c06dca89592a5..63e7f22085c5dfbed4376ead7fcc145cdf5e149c 100644 (file)
@@ -32,7 +32,7 @@
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
index 87565f1c9a037efc0b9e003ca0f988020fbe51f4..e24b106e76d1b69016196af4d7b44466463f2afc 100644 (file)
@@ -33,7 +33,7 @@
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
index 1886da59df9b120a0837c80da76bdae1b31469d3..3be161278c56e917aa1241abb1ef95af06602dcb 100644 (file)
@@ -55,7 +55,7 @@ CompareMem (
   IN UINTN       Length\r
   )\r
 {\r
-  if (0 == Length) {\r
+  if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
     return 0;\r
   }\r
   ASSERT (DestinationBuffer != NULL);\r
index 15e5294d9fa6116f13c508278dbf860fd720f283..0d46ab92f5c859d213196f4c6544c51ca03484e6 100644 (file)
@@ -104,7 +104,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index d746c8fc606bebf2c2d0e46540b8fac2c87099ea..083400743fd840b2fbaf8901dc14f217d66481f5 100644 (file)
@@ -36,7 +36,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index d6681deecf52b712f37e2263d60e638479d78ab3..25aa05b0a09d0ff77546dd2130df881dd3a56251 100644 (file)
@@ -36,7 +36,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 6d8d8c9d95ff9d516671a726303d6464324d7a60..da7834c68cc0454116e33eaa2547bf30fef6f640 100644 (file)
@@ -36,7 +36,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index ce4eed606a1ddda9b70b79a59a426b5762f0acbd..1396fa1e49a79ea8e4ea8acf6b6d9e78df17314a 100644 (file)
@@ -34,7 +34,7 @@
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 1c1a289b53d163a89264d96b96eafdba247964a5..77e3b326fd54c098f7ee86f0e02ee587591405a2 100644 (file)
@@ -29,7 +29,7 @@
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
index 00205b1908e318922f49841e4cc57590905a54fb..dcebcf5ee6a39c573153a3ede12e0cc95904206a 100644 (file)
@@ -30,7 +30,7 @@
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
index 031b7fcec6456ad767d735d05b4ab9f71a632611..61b01096b26bd4dc0869567907fd79693bb55e65 100644 (file)
@@ -58,7 +58,7 @@ CompareMem (
   IN UINTN       Length\r
   )\r
 {\r
-  if (0 == Length) {\r
+  if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
     return 0;\r
   }\r
   ASSERT (DestinationBuffer != NULL);\r
index 9825b9f7922f6dc5098391426ad41359beb0c6d9..cbc546fa8000b7b87068957318a904ddb6c87372 100644 (file)
@@ -106,7 +106,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index 54abe1c356def40b11f5d80a76df067573f2bab4..82a3528228aafd36eb9bdb7f2e5a98e9c253170e 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index b91a38b973dae7ed3edb864c3f403e46fb3e4885..de744d54e7c7e5efcb5ab499371e136513a3f4a3 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index f47d700c9b1bf2b16b91f8c8a7f292653273742e..6e7c34af608d2d196e0c78298d9c2aa2c67cf10a 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 8164e2a181c59ad3069610fbfad437ec235157bd..dc5f3e960f76c9a72c4014ca74c977a27198e958 100644 (file)
@@ -37,7 +37,7 @@
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 0e3428cd7a88d740cf514a20bf8c06dca89592a5..63e7f22085c5dfbed4376ead7fcc145cdf5e149c 100644 (file)
@@ -32,7 +32,7 @@
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
index e27851b077f8c59913c39c5e2cc2ef873050ffbe..9f90ba98ee822c06ca90aba2666dab0fdee60969 100644 (file)
@@ -33,7 +33,7 @@
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
index 031b7fcec6456ad767d735d05b4ab9f71a632611..61b01096b26bd4dc0869567907fd79693bb55e65 100644 (file)
@@ -58,7 +58,7 @@ CompareMem (
   IN UINTN       Length\r
   )\r
 {\r
-  if (0 == Length) {\r
+  if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
     return 0;\r
   }\r
   ASSERT (DestinationBuffer != NULL);\r
index cbbad2cb5dfb65fe5f30ceb4dc369bd71b646647..9386e751ce4a2e30560561957932ae70a96ae5ee 100644 (file)
@@ -106,7 +106,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index 54abe1c356def40b11f5d80a76df067573f2bab4..82a3528228aafd36eb9bdb7f2e5a98e9c253170e 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index b91a38b973dae7ed3edb864c3f403e46fb3e4885..de744d54e7c7e5efcb5ab499371e136513a3f4a3 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index f47d700c9b1bf2b16b91f8c8a7f292653273742e..6e7c34af608d2d196e0c78298d9c2aa2c67cf10a 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 8164e2a181c59ad3069610fbfad437ec235157bd..dc5f3e960f76c9a72c4014ca74c977a27198e958 100644 (file)
@@ -37,7 +37,7 @@
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 0e3428cd7a88d740cf514a20bf8c06dca89592a5..63e7f22085c5dfbed4376ead7fcc145cdf5e149c 100644 (file)
@@ -32,7 +32,7 @@
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
index e27851b077f8c59913c39c5e2cc2ef873050ffbe..9f90ba98ee822c06ca90aba2666dab0fdee60969 100644 (file)
@@ -33,7 +33,7 @@
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
index 031b7fcec6456ad767d735d05b4ab9f71a632611..61b01096b26bd4dc0869567907fd79693bb55e65 100644 (file)
@@ -58,7 +58,7 @@ CompareMem (
   IN UINTN       Length\r
   )\r
 {\r
-  if (0 == Length) {\r
+  if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
     return 0;\r
   }\r
   ASSERT (DestinationBuffer != NULL);\r
index cbbad2cb5dfb65fe5f30ceb4dc369bd71b646647..9386e751ce4a2e30560561957932ae70a96ae5ee 100644 (file)
@@ -106,7 +106,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index 54abe1c356def40b11f5d80a76df067573f2bab4..82a3528228aafd36eb9bdb7f2e5a98e9c253170e 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index b91a38b973dae7ed3edb864c3f403e46fb3e4885..de744d54e7c7e5efcb5ab499371e136513a3f4a3 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index f47d700c9b1bf2b16b91f8c8a7f292653273742e..6e7c34af608d2d196e0c78298d9c2aa2c67cf10a 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 8164e2a181c59ad3069610fbfad437ec235157bd..dc5f3e960f76c9a72c4014ca74c977a27198e958 100644 (file)
@@ -37,7 +37,7 @@
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 0e3428cd7a88d740cf514a20bf8c06dca89592a5..63e7f22085c5dfbed4376ead7fcc145cdf5e149c 100644 (file)
@@ -32,7 +32,7 @@
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
index e27851b077f8c59913c39c5e2cc2ef873050ffbe..9f90ba98ee822c06ca90aba2666dab0fdee60969 100644 (file)
@@ -33,7 +33,7 @@
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
index 031b7fcec6456ad767d735d05b4ab9f71a632611..61b01096b26bd4dc0869567907fd79693bb55e65 100644 (file)
@@ -58,7 +58,7 @@ CompareMem (
   IN UINTN       Length\r
   )\r
 {\r
-  if (0 == Length) {\r
+  if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
     return 0;\r
   }\r
   ASSERT (DestinationBuffer != NULL);\r
index cf364c1d1fd155a1bb0c20403267db1e055b7131..dcf8d78d7e911d8f6f9b6104c005b5f264cf1376 100644 (file)
@@ -105,7 +105,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index 54abe1c356def40b11f5d80a76df067573f2bab4..82a3528228aafd36eb9bdb7f2e5a98e9c253170e 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index b91a38b973dae7ed3edb864c3f403e46fb3e4885..de744d54e7c7e5efcb5ab499371e136513a3f4a3 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index f47d700c9b1bf2b16b91f8c8a7f292653273742e..6e7c34af608d2d196e0c78298d9c2aa2c67cf10a 100644 (file)
@@ -39,7 +39,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 8164e2a181c59ad3069610fbfad437ec235157bd..dc5f3e960f76c9a72c4014ca74c977a27198e958 100644 (file)
@@ -37,7 +37,7 @@
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 0e3428cd7a88d740cf514a20bf8c06dca89592a5..63e7f22085c5dfbed4376ead7fcc145cdf5e149c 100644 (file)
@@ -32,7 +32,7 @@
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
index e27851b077f8c59913c39c5e2cc2ef873050ffbe..9f90ba98ee822c06ca90aba2666dab0fdee60969 100644 (file)
@@ -33,7 +33,7 @@
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
index ae7accc86f4df4013b5e6a86183b30eba76a3ba7..c62cfe0354f7d956b56b3dcf18d428b293c7ac1f 100644 (file)
@@ -53,7 +53,7 @@ CompareMem (
   IN UINTN       Length\r
   )\r
 {\r
-  if (Length == 0) {\r
+  if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
     return 0;\r
   }\r
   ASSERT (DestinationBuffer != NULL);\r
index faa32f539072edea15a30dda7c1296103406d19b..5489fd0f0890d2005ab0ac51467dfc9d8a9bfe95 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Base Memory Library.\r
+  Base Memory Library functions implementation bases on Uefi Boot Service.\r
 \r
-  Copyright (c) 2006, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
index 9767710e8c165be81d18582252afdbe0cdd6a5f1..b7625d6081062fc9951959ac62d4f05e67ac02db 100644 (file)
@@ -102,7 +102,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index c66f8a3444320118dbcb1fba01e367d244414ac7..8e0b812749f6d15aefbe1e3dc287cd17851f14af 100644 (file)
@@ -35,7 +35,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 896a893095b7e515da753b4e5527cc66e4d2621a..00cdc60cee53e272c976731d6bf0f658e6f791bb 100644 (file)
@@ -34,7 +34,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index aea67e1fdc795b8219c7e9edd1c67dae3471ea9d..b80921b2a681e3402717cdbc9c520b58fb714b32 100644 (file)
@@ -34,7 +34,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index aaaa75f70c53eca27d0bbe45a8367cee09658a4d..d9cd42d9dbde65f9bb9fab53897c2a0c435564ba 100644 (file)
@@ -33,7 +33,7 @@
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index cf07c74c99d9f88b181d232d905118238d3d7d2c..ab7efa90cf86bf5dd8bbb68124274cae84c6d1ff 100644 (file)
@@ -27,7 +27,7 @@
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
index c020c2226c3a9a615f1975848f6b044027a7078b..387700329c27ba41d1a63e9b6891313357a6d3c6 100644 (file)
@@ -29,7 +29,7 @@
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
index 48948617d189a3f52f7eb9a003587aa64163548f..9d85c57fa39ef4880f3055abfe916abe301b2d4f 100644 (file)
@@ -53,7 +53,7 @@ CompareMem (
   IN UINTN       Length\r
   )\r
 {\r
-  if (Length == 0) {\r
+  if (Length == 0 || DestinationBuffer == SourceBuffer) {\r
     return 0;\r
   }\r
   ASSERT (DestinationBuffer != NULL);\r
index 82e50825c05b851e30119c01665b55dad32f2391..cbd88c1c6dd27eb6ecfb3a858cc6d6ba24d38feb 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Base Memory Library.\r
+  Base Memory Library functions implementation bases on PeiServcie.\r
 \r
-  Copyright (c) 2006, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
index f7f1b16beb701a1262e627fdac845c3dcc8ff4ea..db7f3588fc10db700005f042b0e38eb12e10b3f1 100644 (file)
@@ -102,7 +102,7 @@ CompareGuid (
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 128-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer  Pointer to the target buffer to scan.\r
   @param  Length  Number of bytes in Buffer to scan.\r
index 66a2cd40d9ba209e9ef13cef116635b9ff784c91..94541f4f500c7748bb5ee065127f19417ad0084f 100644 (file)
@@ -34,7 +34,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
   If Length is not aligned on a 16-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index f3518b7d8778ac0ebd78f2c73325ee2d5defdaa0..e80d730548db5235d0f508aa2e99a6bf4671d7bf 100644 (file)
@@ -34,7 +34,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r
   If Length is not aligned on a 32-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index 1bd7fe3fe5a3ac5b536354436472bf7079c8ca78..36adb500529fbb76a95527ccc97242fb0e923824 100644 (file)
@@ -34,7 +34,7 @@
   If Length > 0 and Buffer is NULL, then ASSERT().\r
   If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r
   If Length is not aligned on a 64-bit boundary, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index d12af184f7da8f0ccbfb4d74346254e4dc8af223..b30cd320f2482bf84c71a5087b3b2ff6726ef302 100644 (file)
@@ -32,7 +32,7 @@
   then a pointer to the matching byte in the target buffer is returned.  If no match is found,\r
   then NULL is returned.  If Length is 0, then NULL is returned.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to scan.\r
   @param  Length      Number of bytes in Buffer to scan.\r
index ea0a3e0106e5481d8155e341c07d53a6e0b7ccd3..f8c611285f9c5eaa192c12fd1c8762d41a907363 100644 (file)
@@ -27,7 +27,7 @@
   Fills a target buffer with a byte value, and returns the target buffer.\r
 \r
   This function fills Length bytes of Buffer with Value, and returns Buffer.\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer    Memory to set.\r
   @param  Length    Number of bytes to set.\r
index 33b9d07ecf4707983e633987267390029eca1909..337b45346e0d982ddac5368ca7b64ba02690b967 100644 (file)
@@ -28,7 +28,7 @@
 \r
   This function fills Length bytes of Buffer with zeros, and returns Buffer.\r
   If Length > 0 and Buffer is NULL, then ASSERT().\r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().\r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
 \r
   @param  Buffer      Pointer to the target buffer to fill with zeros.\r
   @param  Length      Number of bytes in Buffer to fill with zeros.\r
index 393c69869074be1a7c32f7562c415db08689f32f..63a72e8ab11995ee122f076ff173c50915d9deb2 100644 (file)
@@ -154,7 +154,7 @@ DebugAssert (
 \r
   If Buffer is NULL, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param   Buffer  Pointer to the target buffer to be filled with PcdDebugClearMemoryValue.\r
   @param   Length  Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r
index a7d4d2829bdcac7a770532d7b87c853916183f19..217f164de5d6d386a5ef9b7cb3441ff4687fb4aa 100644 (file)
@@ -152,7 +152,7 @@ DebugAssert (
 \r
   If Buffer is NULL, then ASSERT().\r
 \r
-  If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
+  If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). \r
 \r
   @param   Buffer  Pointer to the target buffer to fill with PcdDebugClearMemoryValue.\r
   @param   Length  Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue. \r