Annotation of hatari/src/cpu/uae/string.h, revision 1.1.1.2

1.1       root        1: #ifndef UAE_STRING_H
                      2: #define UAE_STRING_H
                      3: 
                      4: #ifdef HAVE_CONFIG_H
                      5: #include "config.h"
                      6: #endif
                      7: #include "uae/types.h"
                      8: #include <string.h>
                      9: 
                     10: #ifdef _WIN32
                     11: /* Make sure the real _tcs* functions are already declared before we
                     12:  * re-define them below. */
                     13: #include <tchar.h>
                     14: #include <wchar.h>
                     15: #include <stdlib.h>
                     16: #endif
                     17: 
                     18: #ifdef _WIN32
                     19: /* Using the real _tcs* functions */
                     20: #else
                     21: #define _istdigit isdigit
                     22: #define _istspace isspace
                     23: #define _istupper isupper
                     24: #define _sntprintf snprintf
                     25: #define _stprintf sprintf
                     26: #define _strtoui64 strtoll
                     27: #define _tcscat strcat
                     28: #define _tcschr strchr
                     29: #define _tcscmp strcmp
                     30: #define _tcscpy strcpy
                     31: #define _tcscspn strcspn
                     32: #define _tcsdup strdup
                     33: #define _tcsftime strftime
                     34: #define _tcsftime strftime
                     35: #define _tcsicmp strcasecmp
                     36: #define _tcslen strlen
                     37: #define _tcsncat strncat
                     38: #define _tcsncmp strncmp
                     39: #define _tcsncpy strncpy
                     40: #define _tcsnicmp strncasecmp
                     41: #define _tcsrchr strrchr
                     42: #define _tcsspn strspn
                     43: #define _tcsstr strstr
                     44: #define _tcstod strtod
                     45: #define _tcstok strtok
                     46: #define _tcstol strtol
1.1.1.2 ! root       47: #define _tcstoul strtoul
1.1       root       48: #define _totlower tolower
                     49: #define _totupper toupper
                     50: #define _tprintf printf
                     51: #define _tstof atof
                     52: #define _tstoi64 atoll
                     53: #define _tstoi atoi
                     54: #define _tstol atol
                     55: #define _vsnprintf vsnprintf
                     56: #define _vsntprintf vsnprintf
                     57: #endif
                     58: 
                     59: static inline size_t uae_tcslcpy(TCHAR *dst, const TCHAR *src, size_t size)
                     60: {
                     61:        if (size == 0) {
                     62:                return 0;
                     63:        }
                     64:        size_t src_len = _tcslen(src);
                     65:        size_t cpy_len = src_len;
                     66:        if (cpy_len >= size) {
                     67:                cpy_len = size - 1;
                     68:        }
                     69:        memcpy(dst, src, cpy_len * sizeof(TCHAR));
                     70:        dst[cpy_len] = _T('\0');
                     71:        return src_len;
                     72: }
                     73: 
                     74: static inline size_t uae_strlcpy(char *dst, const char *src, size_t size)
                     75: {
                     76:        if (size == 0) {
                     77:                return 0;
                     78:        }
                     79:        size_t src_len = strlen(src);
                     80:        size_t cpy_len = src_len;
                     81:        if (cpy_len >= size) {
                     82:                cpy_len = size - 1;
                     83:        }
                     84:        memcpy(dst, src, cpy_len);
                     85:        dst[cpy_len] = '\0';
                     86:        return src_len;
                     87: }
                     88: 
                     89: #endif /* UAE_STRING_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.