Mercurial > mplayer.hg
changeset 33786:0d3d8db05a59
Compare encodings case insensitively.
Add and use new function gstrcasecmp().
This closes Bugzilla #644.
author | ib |
---|---|
date | Mon, 11 Jul 2011 12:40:30 +0000 |
parents | 0c42fbe235d3 |
children | 42feff0f8a7b |
files | gui/ui/gtk/preferences.c gui/util/string.c gui/util/string.h |
diffstat | 3 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/ui/gtk/preferences.c Mon Jul 11 12:32:03 2011 +0000 +++ b/gui/ui/gtk/preferences.c Mon Jul 11 12:40:30 2011 +0000 @@ -321,7 +321,7 @@ { int i; for ( i=0;lEncoding[i].name;i++ ) - if ( !gstrcmp( sub_cp,lEncoding[i].name ) ) break; + if ( !gstrcasecmp( sub_cp,lEncoding[i].name ) ) break; if ( lEncoding[i].name ) gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lEncoding[i].comment ); } #endif @@ -340,7 +340,7 @@ { int i; for ( i=0;lEncoding[i].name;i++ ) - if ( !gstrcmp( subtitle_font_encoding,lEncoding[i].name ) ) break; + if ( !gstrcasecmp( subtitle_font_encoding,lEncoding[i].name ) ) break; if ( lEncoding[i].name ) gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),lEncoding[i].comment ); } switch ( subtitle_autoscale )
--- a/gui/util/string.c Mon Jul 11 12:32:03 2011 +0000 +++ b/gui/util/string.c Mon Jul 11 12:40:30 2011 +0000 @@ -115,6 +115,16 @@ return strcmp(a, b); } +int gstrcasecmp(const char *a, const char *b) +{ + if (!a && !b) + return 0; + if (!a || !b) + return -1; + + return strcasecmp(a, b); +} + int gstrncmp(const char *a, const char *b, int n) { if (!a && !b)
--- a/gui/util/string.h Mon Jul 11 12:32:03 2011 +0000 +++ b/gui/util/string.h Mon Jul 11 12:40:30 2011 +0000 @@ -20,6 +20,7 @@ #define MPLAYER_GUI_STRING_H char *decomment(char *in); +int gstrcasecmp(const char *a, const char *b); char *gstrchr(const char *str, int c); int gstrcmp(const char *a, const char *b); char *gstrdup(const char *str);