From a09afd5445915f69bec2d374d9145aa6596978c2 Mon Sep 17 00:00:00 2001 From: BYVoid Date: Fri, 18 Jun 2010 13:49:58 +0800 Subject: [PATCH] Fix call of OpenCC --- src/SimpTradConverter.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/SimpTradConverter.cc b/src/SimpTradConverter.cc index f323708..e9a0514 100644 --- a/src/SimpTradConverter.cc +++ b/src/SimpTradConverter.cc @@ -42,19 +42,13 @@ void SimpTradConverter::simpToTrad (const gchar *in, String &out) { static opencc::converter conv (OPENCC_CONVERT_SIMP_TO_TRAD); - static std::wstring outbuf; + static std::string inbuf, outbuf; - gunichar *in_ucs4 = g_utf8_to_ucs4_fast (in, -1, NULL); + inbuf = (const char *) in; - if (conv.convert ((wchar_t*) in_ucs4, outbuf) < 0) - { - g_warning ("An error occurs in SimpTradConverter:"); - conv.perror (); - return; - } + conv.convert (inbuf, outbuf); - out << (const gunichar *) outbuf.c_str (); - g_free (in_ucs4); + out << outbuf.c_str (); } #else -- 2.7.4