Mercurial > sdl-ios-xcode
diff src/stdlib/SDL_string.c @ 1501:73dc5d39bbf8
Added UTF-8 <-> UTF-16 <-> UTF-32 <-> UCS-2 <-> UCS-4 conversion capability
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 13 Mar 2006 01:08:00 +0000 |
parents | 84de7511f79f |
children | 720f8bb49d7d |
line wrap: on
line diff
--- a/src/stdlib/SDL_string.c Sun Mar 12 01:47:23 2006 +0000 +++ b/src/stdlib/SDL_string.c Mon Mar 13 01:08:00 2006 +0000 @@ -661,12 +661,12 @@ } #endif -#ifndef HAVE_STRCASECMP +#if !defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP) int SDL_strcasecmp(const char *str1, const char *str2) { char a = 0; char b = 0; - while (*str1 && *str2) { + while ( *str1 && *str2 ) { a = SDL_tolower(*str1); b = SDL_tolower(*str2); if ( a != b ) @@ -678,6 +678,24 @@ } #endif +#ifndef HAVE_STRNCASECMP +int SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen) +{ + char a = 0; + char b = 0; + while ( *str1 && *str2 && maxlen ) { + a = SDL_tolower(*str1); + b = SDL_tolower(*str2); + if ( a != b ) + break; + ++str1; + ++str2; + --maxlen; + } + return (int)((unsigned char)a - (unsigned char)b); +} +#endif + #ifndef HAVE_SSCANF int SDL_sscanf(const char *text, const char *fmt, ...) {