don't share iconv_t objects between threads
This commit is contained in:
+11
-10
@@ -257,16 +257,17 @@ std::string TextTranscoderUTF8ToCustomSJIS::on_untranslatable(const void** src,
|
||||
}
|
||||
}
|
||||
|
||||
TextTranscoder tt_8859_to_utf8("UTF-8", "ISO-8859-1");
|
||||
TextTranscoder tt_utf8_to_8859("ISO-8859-1", "UTF-8");
|
||||
TextTranscoder tt_standard_sjis_to_utf8("UTF-8", "SHIFT_JIS");
|
||||
TextTranscoder tt_utf8_to_standard_sjis("SHIFT_JIS", "UTF-8");
|
||||
TextTranscoderCustomSJISToUTF8 tt_sega_sjis_to_utf8;
|
||||
TextTranscoderUTF8ToCustomSJIS tt_utf8_to_sega_sjis;
|
||||
TextTranscoder tt_utf16_to_utf8("UTF-8", "UTF-16LE");
|
||||
TextTranscoder tt_utf8_to_utf16("UTF-16LE", "UTF-8");
|
||||
TextTranscoder tt_ascii_to_utf8("UTF-8", "ASCII");
|
||||
TextTranscoder tt_utf8_to_ascii("ASCII", "UTF-8");
|
||||
// iconv_t is not thread-safe, so we need a separate one of these for each thread
|
||||
thread_local TextTranscoder tt_8859_to_utf8("UTF-8", "ISO-8859-1");
|
||||
thread_local TextTranscoder tt_utf8_to_8859("ISO-8859-1", "UTF-8");
|
||||
thread_local TextTranscoder tt_standard_sjis_to_utf8("UTF-8", "SHIFT_JIS");
|
||||
thread_local TextTranscoder tt_utf8_to_standard_sjis("SHIFT_JIS", "UTF-8");
|
||||
thread_local TextTranscoderCustomSJISToUTF8 tt_sega_sjis_to_utf8;
|
||||
thread_local TextTranscoderUTF8ToCustomSJIS tt_utf8_to_sega_sjis;
|
||||
thread_local TextTranscoder tt_utf16_to_utf8("UTF-8", "UTF-16LE");
|
||||
thread_local TextTranscoder tt_utf8_to_utf16("UTF-16LE", "UTF-8");
|
||||
thread_local TextTranscoder tt_ascii_to_utf8("UTF-8", "ASCII");
|
||||
thread_local TextTranscoder tt_utf8_to_ascii("ASCII", "UTF-8");
|
||||
|
||||
std::string tt_encode_marked_optional(const std::string& utf8, Language default_language, bool is_utf16) {
|
||||
if (is_utf16) {
|
||||
|
||||
+10
-10
@@ -77,16 +77,16 @@ protected:
|
||||
virtual std::string on_untranslatable(const void** src, size_t* size) const;
|
||||
};
|
||||
|
||||
extern TextTranscoder tt_8859_to_utf8;
|
||||
extern TextTranscoder tt_utf8_to_8859;
|
||||
extern TextTranscoder tt_standard_sjis_to_utf8;
|
||||
extern TextTranscoder tt_utf8_to_standard_sjis;
|
||||
extern TextTranscoderCustomSJISToUTF8 tt_sega_sjis_to_utf8;
|
||||
extern TextTranscoderUTF8ToCustomSJIS tt_utf8_to_sega_sjis;
|
||||
extern TextTranscoder tt_utf16_to_utf8;
|
||||
extern TextTranscoder tt_utf8_to_utf16;
|
||||
extern TextTranscoder tt_ascii_to_utf8;
|
||||
extern TextTranscoder tt_utf8_to_ascii;
|
||||
extern thread_local TextTranscoder tt_8859_to_utf8;
|
||||
extern thread_local TextTranscoder tt_utf8_to_8859;
|
||||
extern thread_local TextTranscoder tt_standard_sjis_to_utf8;
|
||||
extern thread_local TextTranscoder tt_utf8_to_standard_sjis;
|
||||
extern thread_local TextTranscoderCustomSJISToUTF8 tt_sega_sjis_to_utf8;
|
||||
extern thread_local TextTranscoderUTF8ToCustomSJIS tt_utf8_to_sega_sjis;
|
||||
extern thread_local TextTranscoder tt_utf16_to_utf8;
|
||||
extern thread_local TextTranscoder tt_utf8_to_utf16;
|
||||
extern thread_local TextTranscoder tt_ascii_to_utf8;
|
||||
extern thread_local TextTranscoder tt_utf8_to_ascii;
|
||||
|
||||
std::string tt_encode_marked_optional(const std::string& utf8, Language default_language, bool is_utf16);
|
||||
std::string tt_encode_marked(const std::string& utf8, Language default_language, bool is_utf16);
|
||||
|
||||
Reference in New Issue
Block a user