From 4682f9b235e23d7d673b07bb57da5c13ef133c2d Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 5 Oct 2015 02:01:25 +0200 Subject: [PATCH] Windows: remove wrong check for return value of MultiByteToWideChar --- src/Common/Language.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Common/Language.c b/src/Common/Language.c index e6abd38d..dbad2d5e 100644 --- a/src/Common/Language.c +++ b/src/Common/Language.c @@ -299,7 +299,7 @@ BOOL LoadLanguageFile () // UTF8 => wide char len = MultiByteToWideChar (CP_UTF8, 0, attr, -1, wattr, sizeof (wattr) / sizeof(wattr[0])); - if (len == 0 || len == ERROR_NO_UNICODE_TRANSLATION) + if (len == 0) { MessageBox (0, key, "VeraCrypt: Error while decoding UTF-8 string", MB_ICONERROR); return FALSE; @@ -408,7 +408,7 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa XmlGetAttributeText (xml, "name", attr, sizeof (attr)); len = MultiByteToWideChar (CP_UTF8, 0, attr, -1, wattr, sizeof (wattr) / sizeof(wattr[0])); - if (len != 0 && len != ERROR_NO_UNICODE_TRANSLATION + if (len != 0 && (!defaultLangFound || wcscmp (wattr, L"English") != 0)) { int i = (int) SendDlgItemMessageW (hwndDlg, IDC_LANGLIST, LB_ADDSTRING, 0, (LPARAM)wattr); @@ -448,7 +448,7 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa else { nLen = MultiByteToWideChar (CP_UTF8, 0, ActiveLangPackVersion, -1, wversion, sizeof (wversion) / sizeof(wversion[0])); - if (nLen != 0 && nLen != ERROR_NO_UNICODE_TRANSLATION) + if (nLen != 0) StringCbPrintfW (szVers, sizeof(szVers),GetString("LANG_PACK_VERSION"), wversion); } SetWindowTextW (GetDlgItem (hwndDlg, IDC_LANGPACK_VERSION), szVers); @@ -456,7 +456,7 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa // Translator credits XmlGetAttributeText (xml, "translators", credits, sizeof (credits)); nLen = MultiByteToWideChar (CP_UTF8, 0, credits, -1, wcredits, sizeof (wcredits) / sizeof(wcredits[0])); - if (nLen != 0 && nLen != ERROR_NO_UNICODE_TRANSLATION) + if (nLen != 0) { SetWindowTextW (GetDlgItem (hwndDlg, IDC_LANGPACK_CREDITS), wcredits); }