From 5ac961c3d79d2ffa8d7bf8163848557f21995770 Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Tue, 23 Dec 2003 14:36:01 +0000 Subject: [PATCH] Corrected language() function. --- src/tuxpaint.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index db57b16cc..f7ce2af3d 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -10882,7 +10882,7 @@ int current_language(void) #ifdef WIN32 char str[128]; #endif - int lang, i; + int lang, i, found; /* Default... */ @@ -10916,15 +10916,18 @@ int current_language(void) { /* Which, if any, of the locales is it? */ - for (i = 0; i < NUM_LANGS; i++) + found = 0; + + for (i = 0; i < NUM_LANGS && found == 0; i++) { /* Case-insensitive */ /* (so that, e.g. "pt_BR" is recognized as "pt_br") */ - /* if (strncasecmp(loc, lang_prefixes[i], strlen(lang_prefixes[i])) == 0) */ - if (strcasecmp(loc, lang_prefixes[i]) == 0) + if (strncasecmp(loc, lang_prefixes[i], strlen(lang_prefixes[i])) == 0) + /* if (strcasecmp(loc, lang_prefixes[i]) == 0) */ { lang = i; + found = 1; } } }