mirror of https://github.com/fltk/fltk
STR 2771 fix: introduce a new ascii strcasecmp that does not rely on locale sensitive toupper tolower.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9368 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
157a96aa4b
commit
56a184d529
|
@ -312,7 +312,7 @@ int Fl::scheme(const char *s) {
|
|||
int Fl::reload_scheme() {
|
||||
Fl_Window *win;
|
||||
|
||||
if (scheme_ && !strcasecmp(scheme_, "plastic")) {
|
||||
if (scheme_ && !fl_ascii_strcasecmp(scheme_, "plastic")) {
|
||||
// Update the tile image to match the background color...
|
||||
uchar r, g, b;
|
||||
int nr, ng, nb;
|
||||
|
@ -358,7 +358,7 @@ int Fl::reload_scheme() {
|
|||
|
||||
// Use standard size scrollbars...
|
||||
Fl::scrollbar_size(16);
|
||||
} else if (scheme_ && !strcasecmp(scheme_, "gtk+")) {
|
||||
} else if (scheme_ && !fl_ascii_strcasecmp(scheme_, "gtk+")) {
|
||||
// Use a GTK+ inspired look-n-feel...
|
||||
if (scheme_bg_) {
|
||||
delete scheme_bg_;
|
||||
|
|
|
@ -90,6 +90,21 @@ fl_strlcpy(char *dst, /* O - Destination string */
|
|||
return (srclen);
|
||||
}
|
||||
|
||||
/**
|
||||
* locale independent ascii oriented case cmp
|
||||
* returns 0 if string successfully compare, non zero otherwise
|
||||
*/
|
||||
int fl_ascii_strcasecmp(const char *s, const char *t) {
|
||||
if (!s || !t) return (s!=t);
|
||||
if (strlen(s) != strlen(t)) return -1;
|
||||
for(;*s; s++,t++) {
|
||||
if ( *s != *t) {
|
||||
if (*s<*t && (*s+0x20)!=*t ) return -1;
|
||||
if (*s>*t && *s!=(*t+0x20) ) return +1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
|
|
|
@ -84,11 +84,14 @@ FL_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t);
|
|||
# define strlcpy fl_strlcpy
|
||||
# endif /* !HAVE_STRLCPY */
|
||||
|
||||
// locale independent ascii compare, does not introduce locale pbs as w/ case cmp
|
||||
FL_EXPORT extern int fl_ascii_strcasecmp(const char *s, const char *t);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !flstring_h */
|
||||
|
||||
#endif /* !flstring_h */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
|
|
Loading…
Reference in New Issue