X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..48b980fed3435926e0b3a8d72ecb58be703a1c7a:/icuSources/common/cstring.h diff --git a/icuSources/common/cstring.h b/icuSources/common/cstring.h index 8fcda8c3..6d2fd0e8 100644 --- a/icuSources/common/cstring.h +++ b/icuSources/common/cstring.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1997-2003, International Business Machines +* Copyright (C) 1997-2005, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -31,7 +31,6 @@ #include #define uprv_strcpy(dst, src) U_STANDARD_CPP_NAMESPACE strcpy(dst, src) -#define uprv_strcpyWithSize(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size) #define uprv_strncpy(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size) #define uprv_strlen(str) U_STANDARD_CPP_NAMESPACE strlen(str) #define uprv_strcmp(s1, s2) U_STANDARD_CPP_NAMESPACE strcmp(s1, s2) @@ -45,14 +44,32 @@ U_CAPI char U_EXPORT2 uprv_toupper(char c); + +U_CAPI char U_EXPORT2 +uprv_asciitolower(char c); + U_CAPI char U_EXPORT2 -uprv_tolower(char c); +uprv_ebcdictolower(char c); + +#if U_CHARSET_FAMILY==U_ASCII_FAMILY +# define uprv_tolower uprv_asciitolower +#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY +# define uprv_tolower uprv_ebcdictolower +#else +# error U_CHARSET_FAMILY is not valid +#endif +#define uprv_strtod(source, end) U_STANDARD_CPP_NAMESPACE strtod(source, end) #define uprv_strtoul(str, end, base) U_STANDARD_CPP_NAMESPACE strtoul(str, end, base) #define uprv_strtol(str, end, base) U_STANDARD_CPP_NAMESPACE strtol(str, end, base) -#ifdef WIN32 -# define uprv_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE _stricmp(str1, str2) -# define uprv_strnicmp(str1, str2, n) U_STANDARD_CPP_NAMESPACE _strnicmp(str1, str2, n) +#ifdef U_WINDOWS +# if defined(__BORLANDC__) +# define uprv_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE stricmp(str1, str2) +# define uprv_strnicmp(str1, str2, n) U_STANDARD_CPP_NAMESPACE strnicmp(str1, str2, n) +# else +# define uprv_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE _stricmp(str1, str2) +# define uprv_strnicmp(str1, str2, n) U_STANDARD_CPP_NAMESPACE _strnicmp(str1, str2, n) +# endif #elif defined(POSIX) # define uprv_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE strcasecmp(str1, str2) # define uprv_strnicmp(str1, str2, n) U_STANDARD_CPP_NAMESPACE strncasecmp(str1, str2, n) @@ -68,6 +85,17 @@ uprv_tolower(char c); U_CAPI char* U_EXPORT2 uprv_strdup(const char *src); +/** + * uprv_malloc n+1 bytes, and copy n bytes from src into the new string. + * Terminate with a null at offset n. If n is -1, works like uprv_strdup + * @param src + * @param n length of the input string, not including null. + * @return new string (owned by caller, use uprv_free to free). + * @internal + */ +U_CAPI char* U_EXPORT2 +uprv_strndup(const char *src, int32_t n); + U_CAPI char* U_EXPORT2 T_CString_toLowerCase(char* str); @@ -77,6 +105,9 @@ T_CString_toUpperCase(char* str); U_CAPI int32_t U_EXPORT2 T_CString_integerToString(char *buffer, int32_t n, int32_t radix); +U_CAPI int32_t U_EXPORT2 +T_CString_int64ToString(char *buffer, int64_t n, uint32_t radix); + U_CAPI int32_t U_EXPORT2 T_CString_stringToInteger(const char *integerString, int32_t radix);