aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbTk/FbString.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/FbTk/FbString.cc b/src/FbTk/FbString.cc
index 2bc7516..9c7fca7 100644
--- a/src/FbTk/FbString.cc
+++ b/src/FbTk/FbString.cc
@@ -168,6 +168,10 @@ void init() {
168 s_inited = true; 168 s_inited = true;
169 setlocale(LC_CTYPE, ""); 169 setlocale(LC_CTYPE, "");
170 170
171 for (int i = 0; i < CONVSIZE; i++) {
172 s_iconv_convs[i] = ICONV_NULL;
173 }
174
171#ifdef HAVE_ICONV 175#ifdef HAVE_ICONV
172#if defined(CODESET) && !defined(_WIN32) 176#if defined(CODESET) && !defined(_WIN32)
173 s_locale_codeset = nl_langinfo(CODESET); 177 s_locale_codeset = nl_langinfo(CODESET);
@@ -186,8 +190,6 @@ void init() {
186 s_iconv_convs[X2FB] = iconv_open("UTF-8", "ISO8859-1"); 190 s_iconv_convs[X2FB] = iconv_open("UTF-8", "ISO8859-1");
187 s_iconv_convs[FB2LOCALE] = iconv_open(s_locale_codeset.c_str(), "UTF-8"); 191 s_iconv_convs[FB2LOCALE] = iconv_open(s_locale_codeset.c_str(), "UTF-8");
188 s_iconv_convs[LOCALE2FB] = iconv_open("UTF-8", s_locale_codeset.c_str()); 192 s_iconv_convs[LOCALE2FB] = iconv_open("UTF-8", s_locale_codeset.c_str());
189#else
190 memset(s_iconv_convs, 0, sizeof(s_iconv_convs));
191#endif // HAVE_ICONV 193#endif // HAVE_ICONV
192 194
193} 195}
@@ -195,11 +197,13 @@ void init() {
195void shutdown() { 197void shutdown() {
196#ifdef HAVE_ICONV 198#ifdef HAVE_ICONV
197 int i; 199 int i;
198 for (i = 0; i < CONVSIZE; ++i) 200 for (i = 0; i < CONVSIZE; ++i) {
199 if (s_iconv_convs[i] != ICONV_NULL) 201 if (s_iconv_convs[i] != ICONV_NULL) {
200 iconv_close(s_iconv_convs[i]); 202 iconv_close(s_iconv_convs[i]);
203 s_iconv_convs[i] = ICONV_NULL;
204 }
205 }
201 206
202 memset(s_iconv_convs, 0, sizeof(s_iconv_convs));
203 s_inited = false; 207 s_inited = false;
204#endif // HAVE_ICONV 208#endif // HAVE_ICONV
205} 209}