From 8fac2367580fa780995d6ae149451c2ee8225300 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Sat, 25 Mar 2000 22:56:20 +0000 Subject: [PATCH] Improved conversion constructor arrangement to always allow a second wxMBConv-type argument (changes the signature of the non-Unicode create-from-wchar_t constructor). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@6936 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/string.h | 7 +++---- src/common/string.cpp | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/wx/string.h b/include/wx/string.h index 3dae84626a..7969657cc3 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -321,6 +321,8 @@ public: // (default value of wxSTRING_MAXLEN means take all the string) wxString(const wxChar *psz, size_t nLength = wxSTRING_MAXLEN) { InitWith(psz, 0, nLength); } + wxString(const wxChar *psz, wxMBConv& WXUNUSED(conv), size_t nLength = wxSTRING_MAXLEN) + { InitWith(psz, 0, nLength); } #if wxUSE_UNICODE // from multibyte string @@ -334,13 +336,10 @@ public: // from C string (for compilers using unsigned char) wxString(const unsigned char* psz, size_t nLength = wxSTRING_MAXLEN) { InitWith((const char*)psz, 0, nLength); } - // from multibyte string - wxString(const char *psz, wxMBConv& WXUNUSED(conv) , size_t nLength = wxSTRING_MAXLEN) - { InitWith(psz, 0, nLength); } #if wxUSE_WCHAR_T // from wide (Unicode) string - wxString(const wchar_t *pwz); + wxString(const wchar_t *pwz, wxMBConv& conv = wxConvLibc); #endif // !wxUSE_WCHAR_T // from wxCharBuffer diff --git a/src/common/string.cpp b/src/common/string.cpp index bd4dc94a62..7ab0612f65 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -341,15 +341,15 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength) #if wxUSE_WCHAR_T // from wide string -wxString::wxString(const wchar_t *pwz) +wxString::wxString(const wchar_t *pwz, wxMBConv& conv) { // first get necessary size - size_t nLen = pwz ? wxWC2MB((char *) NULL, pwz, 0) : 0; + size_t nLen = pwz ? conv.WC2MB((char *) NULL, pwz, 0) : 0; // empty? if ( (nLen != 0) && (nLen != (size_t)-1) ) { AllocBuffer(nLen); - wxWC2MB(m_pchData, pwz, nLen); + conv.WC2MB(m_pchData, pwz, nLen); } else { Init();