From 3e65d11090c5f4f3b87701ed39c8e3cc63e627d0 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 25 Dec 2007 06:21:35 +0000 Subject: * transcode.c (transcode_dispatch): fix for multistep transcode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index e8c6545163..ec05629347 100644 --- a/transcode.c +++ b/transcode.c @@ -117,8 +117,8 @@ transcode_dispatch(const char* from_encoding, const char* to_encoding) st_data_t k, val = 0; k = (st_data_t)key; - if (!st_lookup(transcoder_table, k, &val) && - st_delete(transcoder_lib_table, &k, &val)) { + while (!st_lookup(transcoder_table, k, &val) && + st_delete(transcoder_lib_table, &k, &val)) { const char *const lib = (const char *)val; int len = strlen(lib); char path[sizeof(transcoder_lib_prefix) + MAX_TRANSCODER_LIBNAME_LEN]; @@ -128,6 +128,8 @@ transcode_dispatch(const char* from_encoding, const char* to_encoding) memcpy(path, transcoder_lib_prefix, sizeof(transcoder_lib_prefix) - 1); memcpy(path + sizeof(transcoder_lib_prefix) - 1, lib, len + 1); if (!rb_require(path)) return NULL; + } + if (!val) { if (!st_lookup(transcoder_table, (st_data_t)key, &val)) { /* multistep logic, via UTF-8 */ if (!encoding_equal(from_encoding, "UTF-8") && -- cgit v1.2.1