Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
1500:f58c88a4dff5 | 1501:73dc5d39bbf8 |
---|---|
659 } | 659 } |
660 return (int)((unsigned char)*str1 - (unsigned char)*str2); | 660 return (int)((unsigned char)*str1 - (unsigned char)*str2); |
661 } | 661 } |
662 #endif | 662 #endif |
663 | 663 |
664 #ifndef HAVE_STRCASECMP | 664 #if !defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP) |
665 int SDL_strcasecmp(const char *str1, const char *str2) | 665 int SDL_strcasecmp(const char *str1, const char *str2) |
666 { | 666 { |
667 char a = 0; | 667 char a = 0; |
668 char b = 0; | 668 char b = 0; |
669 while (*str1 && *str2) { | 669 while ( *str1 && *str2 ) { |
670 a = SDL_tolower(*str1); | 670 a = SDL_tolower(*str1); |
671 b = SDL_tolower(*str2); | 671 b = SDL_tolower(*str2); |
672 if ( a != b ) | 672 if ( a != b ) |
673 break; | 673 break; |
674 ++str1; | 674 ++str1; |
675 ++str2; | 675 ++str2; |
676 } | |
677 return (int)((unsigned char)a - (unsigned char)b); | |
678 } | |
679 #endif | |
680 | |
681 #ifndef HAVE_STRNCASECMP | |
682 int SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen) | |
683 { | |
684 char a = 0; | |
685 char b = 0; | |
686 while ( *str1 && *str2 && maxlen ) { | |
687 a = SDL_tolower(*str1); | |
688 b = SDL_tolower(*str2); | |
689 if ( a != b ) | |
690 break; | |
691 ++str1; | |
692 ++str2; | |
693 --maxlen; | |
676 } | 694 } |
677 return (int)((unsigned char)a - (unsigned char)b); | 695 return (int)((unsigned char)a - (unsigned char)b); |
678 } | 696 } |
679 #endif | 697 #endif |
680 | 698 |