msgIdCharset is only needed in ANSI build.

In Unicode build, there's no need to create wxCSConv object for every
loaded catalog when it won't be used for anything.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2010-04-21 16:46:05 +00:00
parent b5415496c3
commit ebeac822d9

View File

@ -1305,6 +1305,8 @@ bool wxMsgCatalogFile::Load(const wxString& szDirPrefix, const wxString& szName,
bool wxMsgCatalogFile::FillHash(wxMessagesHash& hash, bool wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
const wxString& msgIdCharset) const const wxString& msgIdCharset) const
{ {
wxUnusedVar(msgIdCharset); // silence warning in Unicode build
// conversion to use to convert catalog strings to the GUI encoding // conversion to use to convert catalog strings to the GUI encoding
wxMBConv *inputConv, wxMBConv *inputConv,
*inputConvPtr = NULL; // same as inputConv but safely deleteable *inputConvPtr = NULL; // same as inputConv but safely deleteable
@ -1330,12 +1332,14 @@ bool wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
#endif #endif
} }
#if !wxUSE_UNICODE
// conversion to apply to msgid strings before looking them up: we only // conversion to apply to msgid strings before looking them up: we only
// need it if the msgids are neither in 7 bit ASCII nor in the same // need it if the msgids are neither in 7 bit ASCII nor in the same
// encoding as the catalog // encoding as the catalog
wxCSConv *sourceConv = msgIdCharset.empty() || (msgIdCharset == m_charset) wxCSConv *sourceConv = msgIdCharset.empty() || (msgIdCharset == m_charset)
? NULL ? NULL
: new wxCSConv(msgIdCharset); : new wxCSConv(msgIdCharset);
#endif // !wxUSE_UNICODE
for (size_t32 i = 0; i < m_numStrings; i++) for (size_t32 i = 0; i < m_numStrings; i++)
{ {
@ -1390,7 +1394,9 @@ bool wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
} }
} }
#if !wxUSE_UNICODE
delete sourceConv; delete sourceConv;
#endif
delete inputConvPtr; delete inputConvPtr;
return true; return true;