initial version of UTF-8 strings representation (still converting to wchar_t* a lot); it has to be explicitly enabled with --enable-utf8 for now

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-04-12 21:15:07 +00:00
parent 5b077ec744
commit 817270659e
18 changed files with 1286 additions and 257 deletions
+4 -4
View File
@@ -53,7 +53,7 @@ bool wxListKey::operator==(wxListKeyValue value) const
// by not putting return here...
case wxKEY_STRING:
return wxStrcmp(m_key.string, value.string) == 0;
return *m_key.string == *value.string;
case wxKEY_INTEGER:
return m_key.integer == value.integer;
@@ -84,7 +84,7 @@ wxNodeBase::wxNodeBase(wxListBase *list,
case wxKEY_STRING:
// to be free()d later
m_key.string = wxStrdup(key.GetString());
m_key.string = new wxString(key.GetString());
break;
default:
@@ -107,7 +107,7 @@ wxNodeBase::~wxNodeBase()
{
if ( m_list->m_keyType == wxKEY_STRING )
{
free(m_key.string);
delete m_key.string;
}
m_list->DetachNode(this);
@@ -257,7 +257,7 @@ wxNodeBase *wxListBase::Append(long key, void *object)
return AppendCommon(node);
}
wxNodeBase *wxListBase::Append (const wxChar *key, void *object)
wxNodeBase *wxListBase::Append (const wxString& key, void *object)
{
wxCHECK_MSG( (m_keyType == wxKEY_STRING) ||
(m_keyType == wxKEY_NONE && m_count == 0),
+17 -17
View File
@@ -84,10 +84,10 @@
// ----------------------------------------------------------------------------
// generic log function
void wxVLogGeneric(wxLogLevel level, const wxChar *szFormat, va_list argptr)
void wxVLogGeneric(wxLogLevel level, const wxString& format, va_list argptr)
{
if ( wxLog::IsEnabled() ) {
wxLog::OnLog(level, wxString::FormatV(szFormat, argptr), time(NULL));
wxLog::OnLog(level, wxString::FormatV(format, argptr), time(NULL));
}
}
@@ -100,11 +100,11 @@ void wxDoLogGeneric(wxLogLevel level, const wxChar *szFormat, ...)
}
#define IMPLEMENT_LOG_FUNCTION(level) \
void wxVLog##level(const wxChar *szFormat, va_list argptr) \
void wxVLog##level(const wxString& format, va_list argptr) \
{ \
if ( wxLog::IsEnabled() ) { \
wxLog::OnLog(wxLOG_##level, \
wxString::FormatV(szFormat, argptr), time(NULL));\
wxString::FormatV(format, argptr), time(NULL)); \
} \
} \
\
@@ -134,9 +134,9 @@ void wxSafeShowMessage(const wxString& title, const wxString& text)
// fatal errors can't be suppressed nor handled by the custom log target and
// always terminate the program
void wxVLogFatalError(const wxChar *szFormat, va_list argptr)
void wxVLogFatalError(const wxString& format, va_list argptr)
{
wxSafeShowMessage(_T("Fatal Error"), wxString::FormatV(szFormat, argptr));
wxSafeShowMessage(_T("Fatal Error"), wxString::FormatV(format, argptr));
#ifdef __WXWINCE__
ExitThread(3);
@@ -157,12 +157,12 @@ void wxDoLogFatalError(const wxChar *szFormat, ...)
}
// same as info, but only if 'verbose' mode is on
void wxVLogVerbose(const wxChar *szFormat, va_list argptr)
void wxVLogVerbose(const wxString& format, va_list argptr)
{
if ( wxLog::IsEnabled() ) {
if ( wxLog::GetActiveTarget() != NULL && wxLog::GetVerbose() ) {
wxLog::OnLog(wxLOG_Info,
wxString::FormatV(szFormat, argptr), time(NULL));
wxString::FormatV(format, argptr), time(NULL));
}
}
}
@@ -194,17 +194,17 @@ void wxDoLogVerbose(const wxChar *szFormat, ...)
va_end(argptr); \
}
void wxVLogTrace(const wxChar *mask, const wxChar *szFormat, va_list argptr)
void wxVLogTrace(const wxString& mask, const wxString& format, va_list argptr)
{
if ( wxLog::IsEnabled() && wxLog::IsAllowedTraceMask(mask) ) {
wxString msg;
msg << _T("(") << mask << _T(") ") << wxString::FormatV(szFormat, argptr);
msg << _T("(") << mask << _T(") ") << wxString::FormatV(format, argptr);
wxLog::OnLog(wxLOG_Trace, msg, time(NULL));
}
}
void wxDoLogTrace(const wxChar *mask, const wxChar *szFormat, ...)
void wxDoLogTrace(const wxString& mask, const wxChar *szFormat, ...)
{
va_list argptr;
va_start(argptr, szFormat);
@@ -212,13 +212,13 @@ void wxDoLogVerbose(const wxChar *szFormat, ...)
va_end(argptr);
}
void wxVLogTrace(wxTraceMask mask, const wxChar *szFormat, va_list argptr)
void wxVLogTrace(wxTraceMask mask, const wxString& format, va_list argptr)
{
// we check that all of mask bits are set in the current mask, so
// that wxLogTrace(wxTraceRefCount | wxTraceOle) will only do something
// if both bits are set.
if ( wxLog::IsEnabled() && ((wxLog::GetTraceMask() & mask) == mask) ) {
wxLog::OnLog(wxLOG_Trace, wxString::FormatV(szFormat, argptr), time(NULL));
wxLog::OnLog(wxLOG_Trace, wxString::FormatV(format, argptr), time(NULL));
}
}
@@ -246,9 +246,9 @@ static inline wxString wxLogSysErrorHelper(long err)
return wxString::Format(_(" (error %ld: %s)"), err, wxSysErrorMsg(err));
}
void WXDLLEXPORT wxVLogSysError(const wxChar *szFormat, va_list argptr)
void WXDLLEXPORT wxVLogSysError(const wxString& format, va_list argptr)
{
wxVLogSysError(wxSysErrorCode(), szFormat, argptr);
wxVLogSysError(wxSysErrorCode(), format, argptr);
}
void WXDLLEXPORT wxDoLogSysError(const wxChar *szFormat, ...)
@@ -259,11 +259,11 @@ void WXDLLEXPORT wxDoLogSysError(const wxChar *szFormat, ...)
va_end(argptr);
}
void WXDLLEXPORT wxVLogSysError(long err, const wxChar *fmt, va_list argptr)
void WXDLLEXPORT wxVLogSysError(long err, const wxString& format, va_list argptr)
{
if ( wxLog::IsEnabled() ) {
wxLog::OnLog(wxLOG_Error,
wxString::FormatV(fmt, argptr) + wxLogSysErrorHelper(err),
wxString::FormatV(format, argptr) + wxLogSysErrorHelper(err),
time(NULL));
}
}
+493 -16
View File
File diff suppressed because it is too large Load Diff
+50 -35
View File
@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/common/string.cpp
// Name: src/common/stringimpl.cpp
// Purpose: wxString class
// Author: Vadim Zeitlin, Ryan Norton
// Modified by:
@@ -56,12 +56,10 @@
#define wxStringMemcpy memcpy
#define wxStringMemcmp memcmp
#define wxStringMemchr memchr
#define wxStringStrlen strlen
#else
#define wxStringMemcpy wxTmemcpy
#define wxStringMemcmp wxTmemcmp
#define wxStringMemchr wxTmemchr
#define wxStringStrlen wxStrlen
#endif
@@ -80,6 +78,10 @@ const size_t wxStringImpl::npos = (size_t) -1;
#if wxUSE_STL_BASED_WXSTRING
// FIXME-UTF8: get rid of this, have only one wxEmptyString
#if wxUSE_UNICODE_UTF8
extern const wxStringCharType WXDLLIMPEXP_BASE *wxEmptyStringImpl = "";
#endif
extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = _T("");
#else
@@ -90,11 +92,17 @@ extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = _T("");
static const struct
{
wxStringData data;
wxChar dummy;
wxStringCharType dummy;
} g_strEmpty = { {-1, 0, 0}, wxT('\0') };
// empty C style string: points to 'string data' byte of g_strEmpty
extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = &g_strEmpty.dummy;
#if wxUSE_UNICODE_UTF8
// FIXME-UTF8: get rid of this, have only one wxEmptyString
extern const wxStringCharType WXDLLIMPEXP_BASE *wxEmptyStringImpl = &g_strEmpty.dummy;
extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = _T("");
#else
extern const wxStringCharType WXDLLIMPEXP_BASE *wxEmptyString = &g_strEmpty.dummy;
#endif
#endif
@@ -111,7 +119,7 @@ extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = &g_strEmpty.dummy;
class Averager
{
public:
Averager(const wxChar *sz) { m_sz = sz; m_nTotal = m_nCount = 0; }
Averager(const wxStringCharType *sz) { m_sz = sz; m_nTotal = m_nCount = 0; }
~Averager()
{ wxPrintf("wxString: average %s = %f\n", m_sz, ((float)m_nTotal)/m_nCount); }
@@ -119,7 +127,7 @@ extern const wxChar WXDLLIMPEXP_BASE *wxEmptyString = &g_strEmpty.dummy;
private:
size_t m_nCount, m_nTotal;
const wxChar *m_sz;
const wxStringCharType *m_sz;
} g_averageLength("allocation size"),
g_averageSummandLength("summand length"),
g_averageConcatHit("hit probability in concat"),
@@ -147,15 +155,16 @@ void wxStringData::Free()
// ===========================================================================
// takes nLength elements of psz starting at nPos
void wxStringImpl::InitWith(const wxChar *psz, size_t nPos, size_t nLength)
void wxStringImpl::InitWith(const wxStringCharType *psz,
size_t nPos, size_t nLength)
{
Init();
// if the length is not given, assume the string to be NUL terminated
if ( nLength == npos ) {
wxASSERT_MSG( nPos <= wxStrlen(psz), _T("index out of bounds") );
wxASSERT_MSG( nPos <= Strsize(psz), _T("index out of bounds") );
nLength = wxStrlen(psz + nPos);
nLength = Strsize(psz + nPos);
}
STATISTICS_ADD(InitialLength, nLength);
@@ -201,7 +210,7 @@ bool wxStringImpl::AllocBuffer(size_t nLen)
wxASSERT( nLen > 0 );
// make sure that we don't overflow
wxASSERT( nLen < (INT_MAX / sizeof(wxChar)) -
wxASSERT( nLen < (INT_MAX / sizeof(wxStringCharType)) -
(sizeof(wxStringData) + EXTRA_ALLOC + 1) );
STATISTICS_ADD(Length, nLen);
@@ -210,7 +219,7 @@ bool wxStringImpl::AllocBuffer(size_t nLen)
// 1) one extra character for '\0' termination
// 2) sizeof(wxStringData) for housekeeping info
wxStringData* pData = (wxStringData*)
malloc(sizeof(wxStringData) + (nLen + EXTRA_ALLOC + 1)*sizeof(wxChar));
malloc(sizeof(wxStringData) + (nLen + EXTRA_ALLOC + 1)*sizeof(wxStringCharType));
if ( pData == NULL ) {
// allocation failures are handled by the caller
@@ -269,7 +278,8 @@ bool wxStringImpl::AllocBeforeWrite(size_t nLen)
nLen += EXTRA_ALLOC;
pData = (wxStringData*)
realloc(pData, sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar));
realloc(pData,
sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType));
if ( pData == NULL ) {
// allocation failures are handled by the caller
@@ -331,7 +341,7 @@ bool wxStringImpl::Alloc(size_t nLen)
nLen += EXTRA_ALLOC;
pData = (wxStringData *)
malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar));
malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType));
if ( pData == NULL ) {
// allocation failure handled by caller
@@ -352,14 +362,14 @@ bool wxStringImpl::Alloc(size_t nLen)
return false;
}
// +1 to copy the terminator, too
memcpy(m_pchData, pData->data(), (nOldLen+1)*sizeof(wxChar));
memcpy(m_pchData, pData->data(), (nOldLen+1)*sizeof(wxStringCharType));
GetStringData()->nDataLength = nOldLen;
}
else {
nLen += EXTRA_ALLOC;
pData = (wxStringData *)
realloc(pData, sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar));
realloc(pData, sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType));
if ( pData == NULL ) {
// allocation failure handled by caller
@@ -411,11 +421,12 @@ wxStringImpl& wxStringImpl::erase(size_t nStart, size_t nLen)
return *this;
}
wxStringImpl& wxStringImpl::insert(size_t nPos, const wxChar *sz, size_t n)
wxStringImpl& wxStringImpl::insert(size_t nPos,
const wxStringCharType *sz, size_t n)
{
wxASSERT( nPos <= length() );
if ( n == npos ) n = wxStrlen(sz);
if ( n == npos ) n = Strsize(sz);
if ( n == 0 ) return *this;
if ( !Alloc(length() + n) || !CopyBeforeWrite() ) {
@@ -424,8 +435,8 @@ wxStringImpl& wxStringImpl::insert(size_t nPos, const wxChar *sz, size_t n)
}
memmove(m_pchData + nPos + n, m_pchData + nPos,
(length() - nPos) * sizeof(wxChar));
memcpy(m_pchData + nPos, sz, n * sizeof(wxChar));
(length() - nPos) * sizeof(wxStringCharType));
memcpy(m_pchData + nPos, sz, n * sizeof(wxStringCharType));
GetStringData()->nDataLength = length() + n;
m_pchData[length()] = '\0';
@@ -487,7 +498,8 @@ size_t wxStringImpl::find(const wxStringImpl& str, size_t nStart) const
return p - c_str() + nLenOther <= nLen ? p - c_str() : npos;
}
size_t wxStringImpl::find(const wxChar* sz, size_t nStart, size_t n) const
size_t wxStringImpl::find(const wxStringCharType* sz,
size_t nStart, size_t n) const
{
return find(wxStringImpl(sz, n), nStart);
}
@@ -534,7 +546,8 @@ size_t wxStringImpl::rfind(const wxStringImpl& str, size_t nStart) const
return npos;
}
size_t wxStringImpl::rfind(const wxChar* sz, size_t nStart, size_t n) const
size_t wxStringImpl::rfind(const wxStringCharType* sz,
size_t nStart, size_t n) const
{
return rfind(wxStringImpl(sz, n), nStart);
}
@@ -562,7 +575,7 @@ size_t wxStringImpl::rfind(wxStringCharType ch, size_t nStart) const
}
wxStringImpl& wxStringImpl::replace(size_t nStart, size_t nLen,
const wxChar *sz)
const wxStringCharType *sz)
{
wxASSERT_MSG( nStart <= length(),
_T("index out of bounds in wxStringImpl::replace") );
@@ -607,7 +620,7 @@ wxStringImpl& wxStringImpl::replace(size_t nStart, size_t nLen,
}
wxStringImpl& wxStringImpl::replace(size_t nStart, size_t nLen,
const wxChar* sz, size_t nCount)
const wxStringCharType* sz, size_t nCount)
{
return replace(nStart, nLen, wxStringImpl(sz, nCount).c_str());
}
@@ -643,24 +656,25 @@ wxStringImpl& wxStringImpl::operator=(const wxStringImpl& stringSrc)
// assigns a single character
wxStringImpl& wxStringImpl::operator=(wxStringCharType ch)
{
wxChar c(ch);
wxStringCharType c(ch);
if ( !AssignCopy(1, &c) ) {
wxFAIL_MSG( _T("out of memory in wxStringImpl::operator=(wxChar)") );
wxFAIL_MSG( _T("out of memory in wxStringImpl::operator=(wxStringCharType)") );
}
return *this;
}
// assigns C string
wxStringImpl& wxStringImpl::operator=(const wxChar *psz)
wxStringImpl& wxStringImpl::operator=(const wxStringCharType *psz)
{
if ( !AssignCopy(wxStrlen(psz), psz) ) {
wxFAIL_MSG( _T("out of memory in wxStringImpl::operator=(const wxChar *)") );
if ( !AssignCopy(Strsize(psz), psz) ) {
wxFAIL_MSG( _T("out of memory in wxStringImpl::operator=(const wxStringCharType *)") );
}
return *this;
}
// helper function: does real copy
bool wxStringImpl::AssignCopy(size_t nSrcLen, const wxChar *pszSrcData)
bool wxStringImpl::AssignCopy(size_t nSrcLen,
const wxStringCharType *pszSrcData)
{
if ( nSrcLen == 0 ) {
Reinit();
@@ -670,7 +684,7 @@ bool wxStringImpl::AssignCopy(size_t nSrcLen, const wxChar *pszSrcData)
// allocation failure handled by caller
return false;
}
memcpy(m_pchData, pszSrcData, nSrcLen*sizeof(wxChar));
memcpy(m_pchData, pszSrcData, nSrcLen*sizeof(wxStringCharType));
GetStringData()->nDataLength = nSrcLen;
m_pchData[nSrcLen] = wxT('\0');
}
@@ -682,7 +696,8 @@ bool wxStringImpl::AssignCopy(size_t nSrcLen, const wxChar *pszSrcData)
// ---------------------------------------------------------------------------
// add something to this string
bool wxStringImpl::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData,
bool wxStringImpl::ConcatSelf(size_t nSrcLen,
const wxStringCharType *pszSrcData,
size_t nMaxLen)
{
STATISTICS_ADD(SummandLength, nSrcLen);
@@ -705,7 +720,7 @@ bool wxStringImpl::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData,
// allocation failure handled by caller
return false;
}
memcpy(m_pchData, pOldData->data(), nLen*sizeof(wxChar));
memcpy(m_pchData, pOldData->data(), nLen*sizeof(wxStringCharType));
pOldData->Unlock();
}
else if ( nNewLen > pData->nAllocLength ) {
@@ -728,7 +743,7 @@ bool wxStringImpl::ConcatSelf(size_t nSrcLen, const wxChar *pszSrcData,
wxASSERT( nNewLen <= GetStringData()->nAllocLength );
// fast concatenation - all is done in our buffer
memcpy(m_pchData + nLen, pszSrcData, nSrcLen*sizeof(wxChar));
memcpy(m_pchData + nLen, pszSrcData, nSrcLen*sizeof(wxStringCharType));
m_pchData[nNewLen] = wxT('\0'); // put terminating '\0'
GetStringData()->nDataLength = nNewLen; // and fix the length
@@ -755,7 +770,7 @@ wxChar *wxStringImpl::DoGetWriteBuf(size_t nLen)
// put string back in a reasonable state after GetWriteBuf
void wxStringImpl::DoUngetWriteBuf()
{
DoUngetWriteBuf(wxStrlen(m_pchData));
DoUngetWriteBuf(Strsize(m_pchData));
}
void wxStringImpl::DoUngetWriteBuf(size_t nLen)
+54 -7
View File
@@ -32,20 +32,30 @@
// implementation
// ============================================================================
const wxStringCharType *wxArgNormalizer<const wxCStrData&>::get() const
const wxChar *wxArgNormalizer<const wxCStrData&>::get() const
{
// FIXME-UTF8: use some way that doesn't involve implicit conversion,
// so that we deallocate any converted buffer immediately;
// can't use AsString() because it returns wxString and not
// const wxString&, unfortunately; use As[W]CharBuf() when
// available.
return m_value;
}
const wxStringCharType *wxArgNormalizer<const wxString&>::get() const
const wxChar *wxArgNormalizer<const wxString&>::get() const
{
#if wxUSE_UNICODE_UTF8 // FIXME-UTF8
return (const wxChar*)m_value;
#else
return m_value.wx_str();
#endif
}
#if wxUSE_UNICODE_WCHAR
#if wxUSE_UNICODE // FIXME-UTF8: should be wxUSE_UNICODE_WCHAR
wxArgNormalizer<const char*>::wxArgNormalizer(const char *value)
{
// FIXME-UTF8: move this to the header so that m_value doesn't have
// to be dynamically allocated
m_value = new wxWCharBuffer(wxConvLibc.cMB2WC(value));
}
@@ -58,12 +68,17 @@ const wchar_t *wxArgNormalizer<const char*>::get() const
{
return m_value->data();
}
#endif // wxUSE_UNICODE_WCHAR
#elif wxUSE_WCHAR_T // !wxUSE_UNICODE_WCHAR && wxUSE_WCHAR_T
#if /*wxUSE_UNICODE_UTF8 ||*/ !wxUSE_UNICODE // FIXME-UTF8
wxArgNormalizer<const wchar_t*>::wxArgNormalizer(const wchar_t *value)
{
#if wxUSE_UNICODE_UTF8 // FIXME-UTF8: this will be the only case
m_value = new wxCharBuffer(wxConvUTF8.cWC2MB(value));
#else
m_value = new wxCharBuffer(wxConvLibc.cWC2MB(value));
#endif
}
wxArgNormalizer<const wchar_t*>::~wxArgNormalizer()
@@ -75,12 +90,44 @@ const char *wxArgNormalizer<const wchar_t*>::get() const
{
return m_value->data();
}
#endif // wxUSE_UNICODE_UTF8 || !wxUSE_UNICODE
#if 0 // wxUSE_UNICODE_UTF8 - FIXME-UTF8
wxArgNormalizer<const char*>::wxArgNormalizer(const char *value)
{
// FIXME-UTF8: move this to the header so that m_value doesn't have
// to be dynamically allocated
// FIXME-UTF8: optimize this if current locale is UTF-8 one
// convert to widechar string first:
wxWCharBuffer buf(wxConvLibc.cMB2WC(value));
if ( buf )
{
// then to UTF-8:
m_value = new wxCharBuffer(wxConvUTF8.cWC2MB(value));
}
else
{
m_value = new wxCharBuffer();
}
}
wxArgNormalizer<const char*>::~wxArgNormalizer()
{
delete m_value;
}
const char *wxArgNormalizer<const char*>::get() const
{
return m_value->data();
}
#endif // wxUSE_UNICODE_UTF8
#endif // wxUSE_UNICODE_WCHAR / !wxUSE_UNICODE_WCHAR && wxUSE_WCHAR_T
// FIXME-UTF8: move this to the header once it's possible to include buffer.h
// without including wxcrt.h
wxArgNormalizer<wxCharBuffer>::wxArgNormalizer(const wxCharBuffer& buf)
: wxArgNormalizer<const char*>(buf.data())
{
+39
View File
@@ -25,10 +25,17 @@
#include "wx/unichar.h"
// FIXME-UTF8: remove once UTF-8 functions moved outside
#include "wx/string.h"
// ===========================================================================
// implementation
// ===========================================================================
// ---------------------------------------------------------------------------
// wxUniChar
// ---------------------------------------------------------------------------
/* static */
wxUniChar::value_type wxUniChar::From8bit(char c)
{
@@ -55,3 +62,35 @@ char wxUniChar::To8bit(wxUniChar::value_type c)
return '?'; // FIXME-UTF8: what to use as failure character?
return buf[0];
}
// ---------------------------------------------------------------------------
// wxUniCharRef
// ---------------------------------------------------------------------------
#if wxUSE_UNICODE_UTF8
wxUniCharRef& wxUniCharRef::operator=(const wxUniChar& c)
{
wxString::Utf8CharBuffer utf(wxString::EncodeChar(c));
size_t lenOld = wxString::GetUtf8CharLength(*m_pos);
size_t lenNew = wxString::GetUtf8CharLength(utf[0]);
if ( lenNew == lenOld )
{
iterator pos(m_pos);
for ( size_t i = 0; i < lenNew; ++i, ++pos )
*pos = utf[i];
}
else
{
size_t idx = m_pos - m_str.begin();
m_str.replace(m_pos, m_pos + lenOld, utf, lenNew);
// this is needed to keep m_pos valid:
m_pos = m_str.begin() + idx;
}
return *this;
}
#endif // wxUSE_UNICODE_UTF8
+4 -2
View File
@@ -641,7 +641,8 @@ const wxChar* wxURI::ParsePath(const wxChar* uri, bool bReference, bool bNormali
if (bNormalize)
{
wxStringBufferLength theBuffer(m_path, m_path.length() + 1);
#if wxUSE_STL
#if wxUSE_STL || wxUSE_UNICODE_UTF8
// FIXME-UTF8: have some wxReadWriteStringBuffer instead?
wxTmemcpy(theBuffer, m_path.c_str(), m_path.length()+1);
#endif
Normalize(theBuffer, true);
@@ -693,7 +694,8 @@ const wxChar* wxURI::ParsePath(const wxChar* uri, bool bReference, bool bNormali
if (bNormalize)
{
wxStringBufferLength theBuffer(m_path, m_path.length() + 1);
#if wxUSE_STL
#if wxUSE_STL || wxUSE_UNICODE_UTF8
// FIXME-UTF8: have some wxReadWriteStringBuffer instead?
wxTmemcpy(theBuffer, m_path.c_str(), m_path.length()+1);
#endif
Normalize(theBuffer);