return wxWCharBuffer((wchar_t *) NULL);
}
-const wxCharBuffer wxMBConv::cWC2MB(const wchar_t *psz) const
+const wxCharBuffer wxMBConv::cWC2MB(const wchar_t *pwz) const
{
- if (psz)
- {
- size_t nLen = WC2MB((char *) NULL, psz, 0); // return value excludes /0
- if (nLen == (size_t)-1)
- return wxCharBuffer((char *) NULL);
- wxCharBuffer buf(nLen); // this allocates nLen+1
- WC2MB((char *)(const char *) buf, psz, nLen+1);
- return buf;
- }
- else
- return wxCharBuffer((char *) NULL);
+ // return value excludes NUL
+ size_t nLen = pwz ? WC2MB((char *) NULL, pwz, 0) : (size_t)-1;
+ if (nLen == (size_t)-1)
+ return wxCharBuffer((const char *)NULL);
+
+ wxCharBuffer buf(nLen); // this allocates nLen+1
+ WC2MB((char *)(const char *) buf, pwz, nLen+1);
+ return buf;
}
// ----------------------------------------------------------------------------
cset = NULL;
}
-#if wxUSE_FONTMAP
- cset = new EC_CharSet(name);
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+ cset = new CP_CharSet(name);
if ( cset->usable() )
return cset;
delete cset;
cset = NULL;
-#endif // wxUSE_FONTMAP
+#endif // __WIN32__
-#if defined(__WIN32__) && !defined(__WXMICROWIN__)
- cset = new CP_CharSet(name);
+#if wxUSE_FONTMAP
+ cset = new EC_CharSet(name);
if ( cset->usable() )
return cset;
delete cset;
cset = NULL;
-#endif // __WIN32__
+#endif // wxUSE_FONTMAP
wxLogError(_("Cannot convert from encoding '%s'!"), name);