2020-03-21 14:12:26 +01:00
|
|
|
#ifndef __CLOVER_STRING_H__
|
|
|
|
#define __CLOVER_STRING_H__
|
|
|
|
|
2020-04-16 11:09:22 +02:00
|
|
|
#ifdef __cplusplus
|
2020-03-21 14:12:26 +01:00
|
|
|
extern "C" {
|
2020-04-16 11:09:22 +02:00
|
|
|
#endif
|
|
|
|
|
2020-04-23 15:20:48 +02:00
|
|
|
#include <Library/BaseLib.h>
|
2020-03-21 14:12:26 +01:00
|
|
|
#include <Library/BaseMemoryLib.h>
|
2020-04-16 11:09:22 +02:00
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
//void* memset(void* dst, int ch, UINT64 count) __attribute__ ((used));
|
|
|
|
void* memcpy(void *dst, const void *src, size_t len) __attribute__ ((used));
|
|
|
|
#else
|
|
|
|
// void* memset(void* dst, int ch, UINT64 count);
|
|
|
|
void* memcpy(void *dst, const void *src, size_t len);
|
|
|
|
#endif
|
|
|
|
|
2020-03-21 14:12:26 +01:00
|
|
|
|
|
|
|
inline void* memmove(void *dst, const void *src, size_t len)
|
|
|
|
{
|
|
|
|
return CopyMem(dst, (void*)(src), len);
|
|
|
|
}
|
|
|
|
|
2020-04-15 19:28:59 +02:00
|
|
|
inline void* memcpy(void *dst, const void *src, size_t len)
|
|
|
|
{
|
|
|
|
return CopyMem(dst,src,len);
|
|
|
|
}
|
|
|
|
|
2020-04-23 15:20:48 +02:00
|
|
|
inline char* strcat(char* s1, const char* s2)
|
|
|
|
{
|
|
|
|
AsciiStrCatS(s1, AsciiStrLen(s1)+1, s2);
|
|
|
|
return s1;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline char* strcpy(char* dst, const char* src)
|
|
|
|
{
|
2020-05-03 22:53:50 +02:00
|
|
|
AsciiStrCpyS(dst,AsciiStrLen(src)+1,src);
|
2020-04-23 15:20:48 +02:00
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline char* strncpy(char * dst, const char * src, size_t len)
|
|
|
|
{
|
|
|
|
AsciiStrnCpyS(dst,(UINTN)len+1,src,(UINTN)len);
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:15:47 +02:00
|
|
|
extern void* memset(void *b, int c, size_t len); // memset is defined in cpp_util/memory.cpp because it is required by c++
|
|
|
|
//inline void* memset(void *b, int c, size_t len)
|
|
|
|
//{
|
|
|
|
// SetMem(b, len, c);
|
|
|
|
// return b;
|
|
|
|
//}
|
|
|
|
|
2020-04-23 15:20:48 +02:00
|
|
|
//inline char* strncat(char *restrict s1, const char *restrict s2, size_t n)
|
|
|
|
//{
|
|
|
|
// return AsciiStrCatS(s1, AsciiStrLen(strDest)+1,strSource)
|
|
|
|
//}
|
|
|
|
//
|
2020-04-16 11:09:22 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-04-23 15:20:48 +02:00
|
|
|
#endif // __CLOVER_STRING_H__
|