[libxslt] Small fixes to locale code
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Small fixes to locale code
- Date: Mon, 8 Nov 2010 10:13:42 +0000 (UTC)
commit 2c2872e2481d8aac5f1d591f5f0a6150204ad93f
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Mon Nov 8 11:09:25 2010 +0100
Small fixes to locale code
libxslt/xsltlocale.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/libxslt/xsltlocale.c b/libxslt/xsltlocale.c
index ec03cde..2caa2ec 100644
--- a/libxslt/xsltlocale.c
+++ b/libxslt/xsltlocale.c
@@ -26,9 +26,9 @@
#define LC_COLLATE_MASK (1 << LC_COLLATE)
#endif
-#define ISALPHA(c) ((c & 0xc0) == 0x40 && (unsigned)((c & 0x1f) - 1) < 26)
#define TOUPPER(c) (c & ~0x20)
#define TOLOWER(c) (c | 0x20)
+#define ISALPHA(c) ((unsigned)(TOUPPER(c) - 'A') < 26)
/*without terminating null character*/
#define XSLTMAX_ISO639LANGLEN 8
@@ -97,11 +97,11 @@ xsltNewLocale(const xmlChar *languageTag) {
return(NULL);
llen = i;
- *q++ = '_';
if (*p) {
if (*p++ != '-')
return(NULL);
+ *q++ = '_';
for (i=0; i<XSLTMAX_ISO3166CNTRYLEN && ISALPHA(*p); ++i)
*q++ = TOUPPER(*p++);
@@ -116,7 +116,7 @@ xsltNewLocale(const xmlChar *languageTag) {
/* Continue without using country code */
- q = localeName + llen + 1;
+ q = localeName + llen;
}
/* Try locale without territory, e.g. for Esperanto (eo) */
@@ -135,7 +135,8 @@ xsltNewLocale(const xmlChar *languageTag) {
if (region == NULL)
return(NULL);
- q = localeName + llen + 1;
+ q = localeName + llen;
+ *q++ = '_';
*q++ = region[0];
*q++ = region[1];
memcpy(q, ".utf8", 6);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]