diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-12-20 06:18:52 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-12-20 06:18:52 +0000 |
commit | ec312741639c447c83ad76683c9f1538a3f5084b (patch) | |
tree | c898f136d20b4e06c0f97471644f5bc9d44d463c /source3/lib/charcnv.c | |
parent | 367c40fd876bb74b5c606f1ea985119a4ba8aca8 (diff) | |
download | samba-ec312741639c447c83ad76683c9f1538a3f5084b.tar.gz samba-ec312741639c447c83ad76683c9f1538a3f5084b.tar.bz2 samba-ec312741639c447c83ad76683c9f1538a3f5084b.zip |
much better auto-init of valid_table[]. This should just about remove
the need for valid.dat
(This used to be commit 0cfd0a5e543181b1384f7afee93fbaf3ccb2b999)
Diffstat (limited to 'source3/lib/charcnv.c')
-rw-r--r-- | source3/lib/charcnv.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 2e5413c5c0..256bd7e88c 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -51,6 +51,7 @@ static char *charset_name(charset_t ch) void init_iconv(void) { int c1, c2; + BOOL did_reload = False; /* so that charset_name() works we need to get the UNIX<->UCS2 going first */ @@ -66,6 +67,12 @@ void init_iconv(void) for (c2=0;c2<NUM_CHARSETS;c2++) { char *n1 = charset_name((charset_t)c1); char *n2 = charset_name((charset_t)c2); + if (conv_handles[c1][c2] && + strcmp(n1, conv_handles[c1][c2]->from_name) == 0 && + strcmp(n2, conv_handles[c1][c2]->to_name) == 0) continue; + + did_reload = True; + if (conv_handles[c1][c2]) { smb_iconv_close(conv_handles[c1][c2]); } @@ -77,6 +84,10 @@ void init_iconv(void) } } } + + if (did_reload) { + init_valid_table(); + } } /** @@ -105,6 +116,7 @@ size_t convert_string(charset_t from, charset_t to, initialized = 1; load_case_tables(); init_iconv(); + init_valid_table(); } descriptor = conv_handles[from][to]; @@ -136,7 +148,6 @@ size_t convert_string(charset_t from, charset_t to, break; case EILSEQ: reason="Illegal myltibyte sequence"; break; } - DEBUG(0,("Conversion error: %s(%s)\n",reason,inbuf)); /* smb_panic(reason); */ } return destlen-o_len; |