]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/IntrinsicLib/MemoryIntrinsics.c
CryptoPkg/IntrinsicLib: Fix the warning on memset
[mirror_edk2.git] / CryptoPkg / Library / IntrinsicLib / MemoryIntrinsics.c
index e8a76d07ff4dc4f0f804e4011578e45b70acbbbc..e095f9aa0dd64c20a6b96a190f8ee14f9b492780 100644 (file)
@@ -17,12 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/BaseLib.h>\r
 \r
+typedef UINTN  size_t;\r
+\r
 /* OpenSSL will use floating point support, and C compiler produces the _fltused\r
    symbol by default. Simply define this symbol here to satisfy the linker. */\r
 int _fltused = 1;\r
 \r
 /* Sets buffers to a specified character */\r
-void * memset (void *dest, char ch, unsigned int count)\r
+void * memset (void *dest, int ch, size_t count)\r
 {\r
   //\r
   // NOTE: Here we use one base implementation for memset, instead of the direct\r
@@ -40,12 +42,18 @@ void * memset (void *dest, char ch, unsigned int count)
 \r
   Pointer = (UINT8 *)dest;\r
   while (count-- != 0) {\r
-    *(Pointer++) = ch;\r
+    *(Pointer++) = (UINT8)ch;\r
   }\r
   \r
   return dest;\r
 }\r
 \r
+/* Compare bytes in two buffers. */\r
+int memcmp (const void *buf1, const void *buf2, size_t count)\r
+{\r
+  return (int)CompareMem(buf1, buf2, count);\r
+}\r
+\r
 int strcmp (const char *s1, const char *s2)\r
 {\r
   return (int)AsciiStrCmp(s1, s2);\r