From f8ec83d9049d4c76c2b9f5a8e74f0b6814c5f481 Mon Sep 17 00:00:00 2001 From: ru Date: Sun, 27 Feb 2005 20:31:13 +0000 Subject: Make the format of LC_COLLATE files architecture independent. --- lib/libc/locale/collate.c | 15 +++++++++++++-- lib/libc/locale/collate.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c index 82fe8bf..6833598 100644 --- a/lib/libc/locale/collate.c +++ b/lib/libc/locale/collate.c @@ -99,7 +99,7 @@ __collate_load_tables(const char *encoding) chains = -1; if (strcmp(strbuf, COLLATE_VERSION) == 0) chains = 0; - else if (strcmp(strbuf, COLLATE_VERSION1_1) == 0) + else if (strcmp(strbuf, COLLATE_VERSION1_2) == 0) chains = 1; if (chains < 0) { (void)fclose(fp); @@ -172,10 +172,21 @@ __collate_load_tables(const char *encoding) if (__collate_char_pri_table_ptr != NULL) free(__collate_char_pri_table_ptr); __collate_char_pri_table_ptr = TMP_char_pri_table; + for (i = 0; i < UCHAR_MAX + 1; i++) { + __collate_char_pri_table[i].prim = + ntohl(__collate_char_pri_table[i].prim); + __collate_char_pri_table[i].sec = + ntohl(__collate_char_pri_table[i].sec); + } if (__collate_chain_pri_table != NULL) free(__collate_chain_pri_table); __collate_chain_pri_table = TMP_chain_pri_table; - + for (i = 0; i < chains; i++) { + __collate_chain_pri_table[i].prim = + ntohl(__collate_chain_pri_table[i].prim); + __collate_chain_pri_table[i].sec = + ntohl(__collate_chain_pri_table[i].sec); + } __collate_substitute_nontrivial = 0; for (i = 0; i < UCHAR_MAX + 1; i++) { if (__collate_substitute_table[i][0] != i || diff --git a/lib/libc/locale/collate.h b/lib/libc/locale/collate.h index ce03e74..2f5f5d4 100644 --- a/lib/libc/locale/collate.h +++ b/lib/libc/locale/collate.h @@ -37,7 +37,7 @@ #define STR_LEN 10 #define TABLE_SIZE 100 #define COLLATE_VERSION "1.0\n" -#define COLLATE_VERSION1_1 "1.1\n" +#define COLLATE_VERSION1_2 "1.2\n" struct __collate_st_char_pri { int prim, sec; -- cgit v1.1