diff options
author | Simo Sorce <idra@samba.org> | 2006-02-04 16:44:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:51:47 -0500 |
commit | e1e693792c1af66283e869dc427d03c6e9983776 (patch) | |
tree | 06d45e5373ecfea9ba43d6bb83407da7fea5f20c /source4/lib/util_unistr.c | |
parent | 1a53c1dc927efbc6a594ed513feb9ab9247078e8 (diff) | |
download | samba-e1e693792c1af66283e869dc427d03c6e9983776.tar.gz samba-e1e693792c1af66283e869dc427d03c6e9983776.tar.bz2 samba-e1e693792c1af66283e869dc427d03c6e9983776.zip |
r13347: - Now we compare values with an optimized utf8
safe function if the user provides an utf8
compliant casefold function to ldb.
- Fix toupper_m and tolower_m to not crash if
the case tables are not found
- Let load_case_table() search into the correct
directory in the search tree for the case
tables so that we can test utf8
Simo
(This used to be commit e12f070958eb3c144beb81c5cb878db122249021)
Diffstat (limited to 'source4/lib/util_unistr.c')
-rw-r--r-- | source4/lib/util_unistr.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source4/lib/util_unistr.c b/source4/lib/util_unistr.c index e589e6493a..b35822877c 100644 --- a/source4/lib/util_unistr.c +++ b/source4/lib/util_unistr.c @@ -43,10 +43,18 @@ static void load_case_tables(void) lowcase_table = map_file(lib_path(mem_ctx, "lowcase.dat"), 0x20000); talloc_free(mem_ctx); if (upcase_table == NULL) { - upcase_table = (void *)-1; + /* try also under codepages for testing purposes */ + upcase_table = map_file("codepages/upcase.dat", 0x20000); + if (upcase_table == NULL) { + upcase_table = (void *)-1; + } } if (lowcase_table == NULL) { - lowcase_table = (void *)-1; + /* try also under codepages for testing purposes */ + lowcase_table = map_file("codepages/lowcase.dat", 0x20000); + if (lowcase_table == NULL) { + lowcase_table = (void *)-1; + } } } @@ -58,12 +66,12 @@ codepoint_t toupper_w(codepoint_t val) if (val < 128) { return toupper(val); } - if (upcase_table == (void *)-1) { - return val; - } if (upcase_table == NULL) { load_case_tables(); } + if (upcase_table == (void *)-1) { + return val; + } if (val & 0xFFFF0000) { return val; } @@ -78,12 +86,12 @@ codepoint_t tolower_w(codepoint_t val) if (val < 128) { return tolower(val); } - if (lowcase_table == (void *)-1) { - return val; - } if (lowcase_table == NULL) { load_case_tables(); } + if (lowcase_table == (void *)-1) { + return val; + } if (val & 0xFFFF0000) { return val; } |