diff options
Diffstat (limited to 'LibOVR/Src/Kernel/OVR_Std.h')
-rw-r--r-- | LibOVR/Src/Kernel/OVR_Std.h | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/LibOVR/Src/Kernel/OVR_Std.h b/LibOVR/Src/Kernel/OVR_Std.h index c11f853..d421ca7 100644 --- a/LibOVR/Src/Kernel/OVR_Std.h +++ b/LibOVR/Src/Kernel/OVR_Std.h @@ -1,6 +1,6 @@ /************************************************************************************ -PublicHeader: OVR.h +PublicHeader: OVR_Kernel.h Filename : OVR_Std.h Content : Standard C function interface Created : September 19, 2012 @@ -46,8 +46,8 @@ limitations under the License. namespace OVR { -#if defined(OVR_OS_WIN32) -inline char* OVR_CDECL OVR_itoa(int val, char *dest, UPInt destsize, int radix) +#if defined(OVR_OS_WIN32) +inline char* OVR_CDECL OVR_itoa(int val, char *dest, size_t destsize, int radix) { #if defined(OVR_MSVC_SAFESTRING) _itoa_s(val, dest, destsize, radix); @@ -140,12 +140,12 @@ inline char* OVR_itoa(int val, char* dest, unsigned int len, int radix) // String functions -inline UPInt OVR_CDECL OVR_strlen(const char* str) +inline size_t OVR_CDECL OVR_strlen(const char* str) { return strlen(str); } -inline char* OVR_CDECL OVR_strcpy(char* dest, UPInt destsize, const char* src) +inline char* OVR_CDECL OVR_strcpy(char* dest, size_t destsize, const char* src) { #if defined(OVR_MSVC_SAFESTRING) strcpy_s(dest, destsize, src); @@ -156,7 +156,7 @@ inline char* OVR_CDECL OVR_strcpy(char* dest, UPInt destsize, const char* src) #endif } -inline char* OVR_CDECL OVR_strncpy(char* dest, UPInt destsize, const char* src, UPInt count) +inline char* OVR_CDECL OVR_strncpy(char* dest, size_t destsize, const char* src, size_t count) { #if defined(OVR_MSVC_SAFESTRING) strncpy_s(dest, destsize, src, count); @@ -167,7 +167,7 @@ inline char* OVR_CDECL OVR_strncpy(char* dest, UPInt destsize, const char* src, #endif } -inline char * OVR_CDECL OVR_strcat(char* dest, UPInt destsize, const char* src) +inline char * OVR_CDECL OVR_strcat(char* dest, size_t destsize, const char* src) { #if defined(OVR_MSVC_SAFESTRING) strcat_s(dest, destsize, src); @@ -195,16 +195,16 @@ inline char* OVR_CDECL OVR_strchr(char* str, char c) inline const char* OVR_strrchr(const char* str, char c) { - UPInt len = OVR_strlen(str); - for (UPInt i=len; i>0; i--) + size_t len = OVR_strlen(str); + for (size_t i=len; i>0; i--) if (str[i]==c) return str+i; return 0; } -inline const UByte* OVR_CDECL OVR_memrchr(const UByte* str, UPInt size, UByte c) +inline const uint8_t* OVR_CDECL OVR_memrchr(const uint8_t* str, size_t size, uint8_t c) { - for (SPInt i = (SPInt)size - 1; i >= 0; i--) + for (intptr_t i = (intptr_t)size - 1; i >= 0; i--) { if (str[i] == c) return str + i; @@ -214,8 +214,8 @@ inline const UByte* OVR_CDECL OVR_memrchr(const UByte* str, UPInt size, UByte c) inline char* OVR_CDECL OVR_strrchr(char* str, char c) { - UPInt len = OVR_strlen(str); - for (UPInt i=len; i>0; i--) + size_t len = OVR_strlen(str); + for (size_t i=len; i>0; i--) if (str[i]==c) return str+i; return 0; @@ -234,12 +234,12 @@ inline long OVR_CDECL OVR_strtoul(const char* string, char** tailptr, int radix) return strtoul(string, tailptr, radix); } -inline int OVR_CDECL OVR_strncmp(const char* ws1, const char* ws2, UPInt size) +inline int OVR_CDECL OVR_strncmp(const char* ws1, const char* ws2, size_t size) { return strncmp(ws1, ws2, size); } -inline UInt64 OVR_CDECL OVR_strtouq(const char *nptr, char **endptr, int base) +inline uint64_t OVR_CDECL OVR_strtouq(const char *nptr, char **endptr, int base) { #if defined(OVR_CC_MSVC) && !defined(OVR_OS_WINCE) return _strtoui64(nptr, endptr, base); @@ -248,7 +248,7 @@ inline UInt64 OVR_CDECL OVR_strtouq(const char *nptr, char **endptr, int base) #endif } -inline SInt64 OVR_CDECL OVR_strtoq(const char *nptr, char **endptr, int base) +inline int64_t OVR_CDECL OVR_strtoq(const char *nptr, char **endptr, int base) { #if defined(OVR_CC_MSVC) && !defined(OVR_OS_WINCE) return _strtoi64(nptr, endptr, base); @@ -258,7 +258,7 @@ inline SInt64 OVR_CDECL OVR_strtoq(const char *nptr, char **endptr, int base) } -inline SInt64 OVR_CDECL OVR_atoq(const char* string) +inline int64_t OVR_CDECL OVR_atoq(const char* string) { #if defined(OVR_CC_MSVC) && !defined(OVR_OS_WINCE) return _atoi64(string); @@ -267,7 +267,7 @@ inline SInt64 OVR_CDECL OVR_atoq(const char* string) #endif } -inline UInt64 OVR_CDECL OVR_atouq(const char* string) +inline uint64_t OVR_CDECL OVR_atouq(const char* string) { return OVR_strtouq(string, NULL, 10); } @@ -275,13 +275,13 @@ inline UInt64 OVR_CDECL OVR_atouq(const char* string) // Implemented in GStd.cpp in platform-specific manner. int OVR_CDECL OVR_stricmp(const char* dest, const char* src); -int OVR_CDECL OVR_strnicmp(const char* dest, const char* src, UPInt count); +int OVR_CDECL OVR_strnicmp(const char* dest, const char* src, size_t count); -inline UPInt OVR_CDECL OVR_sprintf(char *dest, UPInt destsize, const char* format, ...) +inline size_t OVR_CDECL OVR_sprintf(char *dest, size_t destsize, const char* format, ...) { va_list argList; va_start(argList,format); - UPInt ret; + size_t ret; #if defined(OVR_CC_MSVC) #if defined(OVR_MSVC_SAFESTRING) ret = _vsnprintf_s(dest, destsize, _TRUNCATE, format, argList); @@ -301,9 +301,9 @@ inline UPInt OVR_CDECL OVR_sprintf(char *dest, UPInt destsize, const char* forma return ret; } -inline UPInt OVR_CDECL OVR_vsprintf(char *dest, UPInt destsize, const char * format, va_list argList) +inline size_t OVR_CDECL OVR_vsprintf(char *dest, size_t destsize, const char * format, va_list argList) { - UPInt ret; + size_t ret; #if defined(OVR_CC_MSVC) #if defined(OVR_MSVC_SAFESTRING) dest[0] = '\0'; @@ -314,45 +314,45 @@ inline UPInt OVR_CDECL OVR_vsprintf(char *dest, UPInt destsize, const char * for ret = destsize - 1; } else - ret = (UPInt)rv; + ret = (size_t)rv; #else OVR_UNUSED(destsize); int rv = _vsnprintf(dest, destsize - 1, format, argList); OVR_ASSERT(rv != -1); - ret = (UPInt)rv; + ret = (size_t)rv; dest[destsize-1] = 0; #endif #else OVR_UNUSED(destsize); - ret = (UPInt)vsprintf(dest, format, argList); + ret = (size_t)vsprintf(dest, format, argList); OVR_ASSERT(ret < destsize); #endif return ret; } // Returns the number of characters in the formatted string. -inline UPInt OVR_CDECL OVR_vscprintf(const char * format, va_list argList) +inline size_t OVR_CDECL OVR_vscprintf(const char * format, va_list argList) { - UPInt ret; + size_t ret; #if defined(OVR_CC_MSVC) - ret = (UPInt) _vscprintf(format, argList); + ret = (size_t) _vscprintf(format, argList); #else - ret = (UPInt) vsnprintf(NULL, 0, format, argList); + ret = (size_t) vsnprintf(NULL, 0, format, argList); #endif return ret; } -wchar_t* OVR_CDECL OVR_wcscpy(wchar_t* dest, UPInt destsize, const wchar_t* src); -wchar_t* OVR_CDECL OVR_wcsncpy(wchar_t* dest, UPInt destsize, const wchar_t* src, UPInt count); -wchar_t* OVR_CDECL OVR_wcscat(wchar_t* dest, UPInt destsize, const wchar_t* src); -UPInt OVR_CDECL OVR_wcslen(const wchar_t* str); +wchar_t* OVR_CDECL OVR_wcscpy(wchar_t* dest, size_t destsize, const wchar_t* src); +wchar_t* OVR_CDECL OVR_wcsncpy(wchar_t* dest, size_t destsize, const wchar_t* src, size_t count); +wchar_t* OVR_CDECL OVR_wcscat(wchar_t* dest, size_t destsize, const wchar_t* src); +size_t OVR_CDECL OVR_wcslen(const wchar_t* str); int OVR_CDECL OVR_wcscmp(const wchar_t* a, const wchar_t* b); int OVR_CDECL OVR_wcsicmp(const wchar_t* a, const wchar_t* b); inline int OVR_CDECL OVR_wcsicoll(const wchar_t* a, const wchar_t* b) { -#if defined(OVR_OS_WIN32) +#if defined(OVR_OS_WIN32) #if defined(OVR_CC_MSVC) && (OVR_CC_MSVC >= 1400) return ::_wcsicoll(a, b); #else @@ -366,7 +366,7 @@ inline int OVR_CDECL OVR_wcsicoll(const wchar_t* a, const wchar_t* b) inline int OVR_CDECL OVR_wcscoll(const wchar_t* a, const wchar_t* b) { -#if defined(OVR_OS_WIN32) || defined(OVR_OS_LINUX) +#if defined(OVR_OS_WIN32) || defined(OVR_OS_LINUX) return wcscoll(a, b); #else // not supported, use regular wcscmp @@ -376,7 +376,7 @@ inline int OVR_CDECL OVR_wcscoll(const wchar_t* a, const wchar_t* b) #ifndef OVR_NO_WCTYPE -inline int OVR_CDECL UnicodeCharIs(const UInt16* table, wchar_t charCode) +inline int OVR_CDECL UnicodeCharIs(const uint16_t* table, wchar_t charCode) { unsigned offset = table[charCode >> 8]; if (offset == 0) return 0; @@ -384,19 +384,19 @@ inline int OVR_CDECL UnicodeCharIs(const UInt16* table, wchar_t charCode) return (table[offset + ((charCode >> 4) & 15)] & (1 << (charCode & 15))) != 0; } -extern const UInt16 UnicodeAlnumBits[]; -extern const UInt16 UnicodeAlphaBits[]; -extern const UInt16 UnicodeDigitBits[]; -extern const UInt16 UnicodeSpaceBits[]; -extern const UInt16 UnicodeXDigitBits[]; +extern const uint16_t UnicodeAlnumBits[]; +extern const uint16_t UnicodeAlphaBits[]; +extern const uint16_t UnicodeDigitBits[]; +extern const uint16_t UnicodeSpaceBits[]; +extern const uint16_t UnicodeXDigitBits[]; // Uncomment if necessary -//extern const UInt16 UnicodeCntrlBits[]; -//extern const UInt16 UnicodeGraphBits[]; -//extern const UInt16 UnicodeLowerBits[]; -//extern const UInt16 UnicodePrintBits[]; -//extern const UInt16 UnicodePunctBits[]; -//extern const UInt16 UnicodeUpperBits[]; +//extern const uint16_t UnicodeCntrlBits[]; +//extern const uint16_t UnicodeGraphBits[]; +//extern const uint16_t UnicodeLowerBits[]; +//extern const uint16_t UnicodePrintBits[]; +//extern const uint16_t UnicodePunctBits[]; +//extern const uint16_t UnicodeUpperBits[]; inline int OVR_CDECL OVR_iswalnum (wchar_t charCode) { return UnicodeCharIs(UnicodeAlnumBits, charCode); } inline int OVR_CDECL OVR_iswalpha (wchar_t charCode) { return UnicodeCharIs(UnicodeAlphaBits, charCode); } @@ -473,10 +473,10 @@ inline double OVR_CDECL OVR_wcstod(const wchar_t* string, wchar_t** tailptr) OVR_UNUSED(tailptr); char buffer[64]; char* tp = NULL; - UPInt max = OVR_wcslen(string); + size_t max = OVR_wcslen(string); if (max > 63) max = 63; unsigned char c = 0; - for (UPInt i=0; i < max; i++) + for (size_t i=0; i < max; i++) { c = (unsigned char)string[i]; buffer[i] = ((c) < 128 ? (char)c : '!'); @@ -494,10 +494,10 @@ inline long OVR_CDECL OVR_wcstol(const wchar_t* string, wchar_t** tailptr, int r OVR_UNUSED(tailptr); char buffer[64]; char* tp = NULL; - UPInt max = OVR_wcslen(string); + size_t max = OVR_wcslen(string); if (max > 63) max = 63; unsigned char c = 0; - for (UPInt i=0; i < max; i++) + for (size_t i=0; i < max; i++) { c = (unsigned char)string[i]; buffer[i] = ((c) < 128 ? (char)c : '!'); |