You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2008/05/13 20:42:00 UTC
svn commit: r655967 - /stdcxx/branches/4.2.x/util/charmap.cpp
Author: faridz
Date: Tue May 13 11:42:00 2008
New Revision: 655967
URL: http://svn.apache.org/viewvc?rev=655967&view=rev
Log:
2008-05-13 Farid Zaripov <fa...@epam.com>
* util/charmap.cpp (convert_to_ucs) [_MSC_VER]: Process return code
of MultiByteToWideChar() and fall back to convert_sym_to_ucs() if
the conversion table for the requested codepage is not installed.
Modified:
stdcxx/branches/4.2.x/util/charmap.cpp
Modified: stdcxx/branches/4.2.x/util/charmap.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/util/charmap.cpp?rev=655967&r1=655966&r2=655967&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/util/charmap.cpp (original)
+++ stdcxx/branches/4.2.x/util/charmap.cpp Tue May 13 11:42:00 2008
@@ -690,18 +690,24 @@
if (0 != codepage_) {
wchar_t ret[2] = {0};
- MultiByteToWideChar (codepage_, 0, encoding.c_str(), -1, ret, 2);
- if (ret[1] != 0)
+ const int res = MultiByteToWideChar (codepage_, 0,
+ encoding.c_str(), -1,
+ ret, 2);
+ if (!res && ERROR_INVALID_PARAMETER == GetLastError ()) {
+ // the required codepage conversion table is not installed
+ wc = convert_sym_to_ucs (sym_name);
+ return true;
+ }
+
+ if (!res || ret[1] != 0)
return false;
wc = ret[0];
return true;
- } else {
- wc = convert_sym_to_ucs (sym_name);
- return true;
}
- return false;
+ wc = convert_sym_to_ucs (sym_name);
+ return true;
#endif // _MSC_VER
}