WIP - merge from Pandora's port
This commit is contained in:
parent
546562cff3
commit
a2850730e0
309 changed files with 239342 additions and 114388 deletions
76
src/include/uae/string.h
Normal file
76
src/include/uae/string.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
#ifndef UAE_STRING_H
|
||||
#define UAE_STRING_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "uae/types.h"
|
||||
#include <string.h>
|
||||
|
||||
#define _istdigit isdigit
|
||||
#define _istspace isspace
|
||||
#define _istupper isupper
|
||||
#define _sntprintf snprintf
|
||||
#define _stprintf sprintf
|
||||
#define _strtoui64 strtoll
|
||||
#define _tcscat strcat
|
||||
#define _tcschr strchr
|
||||
#define _tcscmp strcmp
|
||||
#define _tcscpy strcpy
|
||||
#define _tcscspn strcspn
|
||||
#define _tcsdup strdup
|
||||
#define _tcsftime strftime
|
||||
#define _tcsftime strftime
|
||||
#define _tcsicmp strcasecmp
|
||||
#define _tcslen strlen
|
||||
#define _tcsncat strncat
|
||||
#define _tcsncmp strncmp
|
||||
#define _tcsncpy strncpy
|
||||
#define _tcsnicmp strncasecmp
|
||||
#define _tcsrchr strrchr
|
||||
#define _tcsspn strspn
|
||||
#define _tcsstr strstr
|
||||
#define _tcstod strtod
|
||||
#define _tcstok strtok
|
||||
#define _tcstol strtol
|
||||
#define _totlower tolower
|
||||
#define _totupper toupper
|
||||
#define _tprintf printf
|
||||
#define _tstof atof
|
||||
#define _tstoi64 atoll
|
||||
#define _tstoi atoi
|
||||
#define _tstol atol
|
||||
#define _vsnprintf vsnprintf
|
||||
#define _vsntprintf vsnprintf
|
||||
|
||||
static inline size_t uae_tcslcpy(char *dst, const TCHAR *src, size_t size)
|
||||
{
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
size_t src_len = _tcslen(src);
|
||||
size_t cpy_len = src_len;
|
||||
if (cpy_len >= size) {
|
||||
cpy_len = size - 1;
|
||||
}
|
||||
memcpy(dst, src, cpy_len * sizeof(TCHAR));
|
||||
dst[cpy_len] = _T('\0');
|
||||
return src_len;
|
||||
}
|
||||
|
||||
static inline size_t uae_strlcpy(char *dst, const char *src, size_t size)
|
||||
{
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
size_t src_len = strlen(src);
|
||||
size_t cpy_len = src_len;
|
||||
if (cpy_len >= size) {
|
||||
cpy_len = size - 1;
|
||||
}
|
||||
memcpy(dst, src, cpy_len);
|
||||
dst[cpy_len] = '\0';
|
||||
return src_len;
|
||||
}
|
||||
|
||||
#endif /* UAE_STRING_H */
|
Loading…
Add table
Add a link
Reference in a new issue