summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-02-27 20:31:13 +0000
committerru <ru@FreeBSD.org>2005-02-27 20:31:13 +0000
commitf8ec83d9049d4c76c2b9f5a8e74f0b6814c5f481 (patch)
treeac99a95d10edf1ab390259cb8e6b285228037505 /lib
parent2c22bca2202c5469c6318a182ef527e642c96454 (diff)
downloadFreeBSD-src-f8ec83d9049d4c76c2b9f5a8e74f0b6814c5f481.zip
FreeBSD-src-f8ec83d9049d4c76c2b9f5a8e74f0b6814c5f481.tar.gz
Make the format of LC_COLLATE files architecture independent.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/locale/collate.c15
-rw-r--r--lib/libc/locale/collate.h2
2 files changed, 14 insertions, 3 deletions
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;
OpenPOWER on IntegriCloud