Module: wine Branch: master Commit: 48c36db40c83de59e660182699dcc7a0e1b22813 URL: http://source.winehq.org/git/wine.git/?a=commit;h=48c36db40c83de59e660182699...
Author: Huw Davies huw@codeweavers.com Date: Thu Nov 6 15:55:39 2014 +0000
mlang: Accept "ascii" as an alias for "us-ascii".
---
dlls/mlang/mlang.c | 13 ++++++++++++- dlls/mlang/tests/mlang.c | 12 ++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index e44e862..8a4e78f 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -65,6 +65,7 @@ typedef struct const char *web_charset; const char *header_charset; const char *body_charset; + const WCHAR *alias; } MIME_CP_INFO;
/* These data are based on the codepage info in libs/unicode/cpmap.pl */ @@ -363,6 +364,9 @@ static const MIME_CP_INFO vietnamese_cp[] = MIMECONTF_MIME_LATEST, "windows-1258", "windows-1258", "windows-1258" } }; + +static const WCHAR asciiW[] = {'a','s','c','i','i',0}; + static const MIME_CP_INFO western_cp[] = { { "IBM EBCDIC (US-Canada)", @@ -415,7 +419,7 @@ static const MIME_CP_INFO western_cp[] = 20127, MIMECONTF_MAILNEWS | MIMECONTF_IMPORT | MIMECONTF_EXPORT | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_VALID | MIMECONTF_VALID_NLS | MIMECONTF_MIME_LATEST, - "us-ascii", "us-ascii", "us-ascii" }, + "us-ascii", "us-ascii", "us-ascii", asciiW }, { "Western European (ISO)", 28591, MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_IMPORT | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER | @@ -2600,6 +2604,13 @@ static HRESULT WINAPI fnIMultiLanguage3_GetCharsetInfo( strcpyW(pCharsetInfo->wszCharset, csetW); return S_OK; } + if (mlang_data[i].mime_cp_info[n].alias && !lstrcmpiW(Charset, mlang_data[i].mime_cp_info[n].alias)) + { + pCharsetInfo->uiCodePage = mlang_data[i].family_codepage; + pCharsetInfo->uiInternetEncoding = mlang_data[i].mime_cp_info[n].cp; + strcpyW(pCharsetInfo->wszCharset, mlang_data[i].mime_cp_info[n].alias); + return S_OK; + } } }
diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 1d52af6..a840b4a 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -696,6 +696,17 @@ static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags) IEnumCodePage_Release(iEnumCP); }
+static void test_GetCharsetInfo_alias(IMultiLanguage *ml) +{ + WCHAR asciiW[] = {'a','s','c','i','i',0}; + MIMECSETINFO info; + HRESULT hr; + + hr = IMultiLanguage_GetCharsetInfo(ml, asciiW, &info); + ok(hr == S_OK, "got %08x\n", hr); + ok(!lstrcmpW(info.wszCharset, asciiW), "got %s\n", wine_dbgstr_w(info.wszCharset)); +} + static void scriptinfo_cmp(SCRIPTINFO *sinfo1, SCRIPTINFO *sinfo2) { ok(sinfo1->ScriptId == sinfo2->ScriptId, "ScriptId mismatch: %d != %d\n", sinfo1->ScriptId, sinfo2->ScriptId); @@ -2000,6 +2011,7 @@ START_TEST(mlang)
test_GetNumberOfCodePageInfo((IMultiLanguage2 *)iML); test_IMLangConvertCharset(iML); + test_GetCharsetInfo_alias(iML); IMultiLanguage_Release(iML);