From 9b3d8c574edf021f4f5af3dbb651d880badd92d4 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 5 Feb 2006 16:15:12 +0000 Subject: Fix detection of locale containing a modifier (like "@euro") thanks Reinhard Nissl CVS patchset: 7874 CVS date: 2006/02/05 16:15:12 --- ChangeLog | 3 ++- src/xine-utils/utils.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b81e6cc67..0aa71d705 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,7 +14,8 @@ xine-lib (1.1.2) * Enable AMD64 mmx/sse support in some plugins (tvtime, libmpeg2, goom...) * Fix xxmc subpictures (broken since 1.1.1) * FFmpeg update (version 51.1.0) - + * Fix detection of locale containing a modifier (like "@euro") + xine-lib (1.1.1) * Improve sound quality when using alsa 1.0.9 or above. When playing a 44.1khz stream on a 48khz only capable sound card. diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 98026133d..ee23cae8d 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: utils.c,v 1.42 2005/09/05 17:02:57 valtri Exp $ + * $Id: utils.c,v 1.43 2006/02/05 16:15:12 miguelfreitas Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -490,13 +490,22 @@ void xine_hexdump (const char *buf, int length) { static const lang_locale_t *_get_first_lang_locale(char *lcal) { const lang_locale_t *llocale; + int lang_len; + char *mod; if(lcal && strlen(lcal)) { llocale = &*lang_locales; + + if ((mod = strchr(lcal, '@'))) + lang_len = mod++ - lcal; + else + lang_len = strlen(lcal); while(llocale->language) { - if(!strncmp(lcal, llocale->language, strlen(lcal))) - return llocale; + if(!strncmp(lcal, llocale->language, lang_len)) { + if ((!mod && !llocale->modifier) || (mod && llocale->modifier && !strcmp(mod, llocale->modifier))) + return llocale; + } llocale++; } -- cgit v1.2.3