Changeset 66756 in webkit
- Timestamp:
- Sep 3, 2010 12:14:07 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r66755 r66756 1 2010-09-03 Patrick Gansterer <paroga@paroga.com> 2 3 Reviewed by Adam Roben. 4 5 [WINCE] Remove usage of ce_textcodecs.h 6 https://bugs.webkit.org/show_bug.cgi?id=45169 7 8 ce_textcodecs.h was a non public header for (not required) 9 additonal codecs in the original Torch Mobile port. 10 11 * platform/text/wince/TextCodecWinCE.cpp: 12 (WebCore::LanguageManager::LanguageManager): 13 (WebCore::decode): 14 1 15 2010-09-03 Chris Rogers <crogers@google.com> 2 16 -
trunk/WebCore/platform/text/wince/TextCodecWinCE.cpp
r65077 r66756 25 25 #include "TextCodecWinCE.h" 26 26 27 #include "ce_textcodecs.h"28 27 #include "FontCache.h" 29 28 #include "PlatformString.h" … … 44 43 UINT m_codePage; 45 44 Vector<CString> m_aliases; 46 bool m_usesNativeCodec;47 45 }; 48 46 … … 83 81 } 84 82 85 static void addCharset(UINT codePage, const char* charsetName, const wchar_t* friendlyName, const char* charsetAliases, bool nativeSupport = false)86 {87 CharsetInfo info;88 info.m_codePage = codePage;89 info.m_name = charsetName;90 info.m_friendlyName = friendlyName;91 info.m_usesNativeCodec = nativeSupport;92 const char* begin = charsetAliases;93 for (;;) {94 const char* end = strchr(begin, '|');95 CString alias = end ? CString(begin, end - begin) : begin;96 if (alias.length())97 info.m_aliases.append(alias);98 if (!end)99 break;100 begin = end + 1;101 }102 knownCharsets().set(info.m_name.data(), info);103 if (codePage != CP_ACP)104 codePageCharsets().set(codePage, info.m_name);105 }106 107 83 LanguageManager::LanguageManager() 108 84 { 109 // 437, 708, 709, 710, 720, 737, 775, 850, 852110 addCharset(932, "SHIFT_JIS", L"Japanese (SHIFT_JIS)", "shift_jis");111 addCharset(936, "GBK", L"Chinese Simplified (GBK)", "gbk|gb2312");112 addCharset(949, "KSC5601", L"Korean (KSC5601)", "ks_c_5601-1987|ksc5601|euc-kr|euckr|x-euc-kr");113 addCharset(950, "BIG5", L"Chinese Traditional (BIG5)", "big5");114 addCharset(1361, "JOHAB", L"Korean (Johab)", "johab|korean.johab");115 addCharset(51932, "EUC-JP", L"Japanese (EUC)", "euc-jp|eucjp|x-euc-jp", true);116 addCharset(874, "CP874", L"Thai (Windows)", "cp874|windows-874", true);117 addCharset(CP_ACP, "TIS620", L"Thai (TIS 620)", "tis620|ISO-8859-11|ISO-IR-166|TIS-620|TIS620-0TIS620.2529-1|TIS620.2533-0|TIS620.2533-1|thai8", true);118 addCharset(CP_ACP, "MACTHAI", L"Thai (Mac OS)", "macthai|x-mac-thai|mac-thai", true);119 supportedCharsets().add("EUC-JP");120 supportedCharsets().add("CP874");121 supportedCharsets().add("TIS620");122 supportedCharsets().add("MACTHAI");123 124 85 IEnumCodePage* enumInterface; 125 86 IMultiLanguage* mli = FontCache::getMultiLanguageInterface(); … … 149 110 info.m_aliases.append(String(cpInfo.wszHeaderCharset).latin1()); 150 111 info.m_aliases.append(String(cpInfo.wszBodyCharset).latin1()); 151 info.m_usesNativeCodec = false;152 112 String cpName = String::format("cp%d", cpInfo.uiCodePage); 153 113 info.m_aliases.append(cpName.latin1()); … … 266 226 else 267 227 codePage = CP_ACP; 268 } else {269 codePage = i->second.m_codePage;270 if (i->second.m_usesNativeCodec) {271 typedef int (*FuncEucMbToWc)(wchar_t *pwc, const unsigned char *s, int n);272 FuncEucMbToWc encMbToWc = 0;273 if (!strcmp(encodingName, "EUC-JP"))274 encMbToWc = TextCodecsCE::euc_jp_mbtowc;275 else if (!strcmp(encodingName, "CP874"))276 encMbToWc = TextCodecsCE::cp874_mbtowc;277 else if (!strcmp(encodingName, "TIS620"))278 encMbToWc = TextCodecsCE::tis620_mbtowc;279 else if (!strcmp(encodingName, "MACTHAI"))280 encMbToWc = TextCodecsCE::mac_thai_mbtowc;281 282 if (encMbToWc) {283 const char* const srcStart = bytes;284 const char* const srcEnd = bytes + length;285 int lastSize = result.size();286 result.resize(lastSize + length);287 for (;;) {288 UChar* dst = result.data() + lastSize;289 const UChar* const dstEnd = result.data() + result.size();290 for (; dst < dstEnd && bytes < srcEnd; ++dst) {291 int numberEncoded = encMbToWc(dst, (const unsigned char*)bytes, srcEnd - bytes);292 if (numberEncoded >= 0)293 bytes += numberEncoded;294 else {295 if (numberEncoded == RET_ILSEQ)296 sawInvalidChar = true;297 break;298 }299 }300 if (bytes == srcEnd || dst != dstEnd) {301 *left = srcEnd - bytes;302 result.resize(dst - result.data());303 return;304 }305 lastSize = result.size();306 result.resize(result.size() + 256);307 }308 } else {309 *left = 0;310 result.append(bytes, length);311 return;312 }313 }314 228 } 315 229
Note: See TracChangeset
for help on using the changeset viewer.