fixed compilation problems with platforms where wchar_t != ushort
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -293,7 +293,8 @@ size_t wxMBConvUTF8::MB2WC(wchar_t *buf, const char *psz, size_t n) const
|
|||||||
return (size_t)-1;
|
return (size_t)-1;
|
||||||
}
|
}
|
||||||
#ifdef WC_UTF16
|
#ifdef WC_UTF16
|
||||||
size_t pa = encode_utf16(res, buf);
|
// cast is ok because wchar_t == wxUuint16 if WC_UTF16
|
||||||
|
size_t pa = encode_utf16(res, (wxUint16 *)buf);
|
||||||
if (pa == (size_t)-1)
|
if (pa == (size_t)-1)
|
||||||
return (size_t)-1;
|
return (size_t)-1;
|
||||||
if (buf)
|
if (buf)
|
||||||
@@ -320,7 +321,8 @@ size_t wxMBConvUTF8::WC2MB(char *buf, const wchar_t *psz, size_t n) const
|
|||||||
{
|
{
|
||||||
wxUint32 cc;
|
wxUint32 cc;
|
||||||
#ifdef WC_UTF16
|
#ifdef WC_UTF16
|
||||||
size_t pa = decode_utf16(psz, cc);
|
// cast is ok for WC_UTF16
|
||||||
|
size_t pa = decode_utf16((const wxUint16 *)psz, cc);
|
||||||
psz += (pa == (size_t)-1) ? 1 : pa;
|
psz += (pa == (size_t)-1) ? 1 : pa;
|
||||||
#else
|
#else
|
||||||
cc=(*psz++) & 0x7fffffff;
|
cc=(*psz++) & 0x7fffffff;
|
||||||
@@ -631,7 +633,8 @@ size_t wxMBConvUTF32straight::WC2MB(char *buf, const wchar_t *psz, size_t n) con
|
|||||||
{
|
{
|
||||||
wxUint32 cc;
|
wxUint32 cc;
|
||||||
|
|
||||||
size_t pa=decode_utf16(psz, cc);
|
// cast is ok for WC_UTF16
|
||||||
|
size_t pa = decode_utf16((const wxUint16 *)psz, cc);
|
||||||
if (pa == (size_t)-1)
|
if (pa == (size_t)-1)
|
||||||
return pa;
|
return pa;
|
||||||
|
|
||||||
@@ -643,7 +646,9 @@ size_t wxMBConvUTF32straight::WC2MB(char *buf, const wchar_t *psz, size_t n) con
|
|||||||
len += sizeof(wxUint32);
|
len += sizeof(wxUint32);
|
||||||
psz += pa;
|
psz += pa;
|
||||||
}
|
}
|
||||||
if (buf && len<=n-sizeof(wxUint32)) *(wxUint32*)buf=0;
|
|
||||||
|
if (buf && len<=n-sizeof(wxUint32))
|
||||||
|
*(wxUint32*)buf=0;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -677,7 +682,9 @@ size_t wxMBConvUTF32swap::MB2WC(wchar_t *buf, const char *psz, size_t n) const
|
|||||||
len += pa;
|
len += pa;
|
||||||
psz += sizeof(wxUint32);
|
psz += sizeof(wxUint32);
|
||||||
}
|
}
|
||||||
if (buf && len<n) *buf=0;
|
|
||||||
|
if (buf && len<n)
|
||||||
|
*buf=0;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -692,7 +699,8 @@ size_t wxMBConvUTF32swap::WC2MB(char *buf, const wchar_t *psz, size_t n) const
|
|||||||
{
|
{
|
||||||
char cc[4];
|
char cc[4];
|
||||||
|
|
||||||
size_t pa=decode_utf16(psz, *(wxUint32*)cc);
|
// cast is ok for WC_UTF16
|
||||||
|
size_t pa=decode_utf16((const wxUint16 *)psz, *(wxUint32*)cc);
|
||||||
if (pa == (size_t)-1)
|
if (pa == (size_t)-1)
|
||||||
return pa;
|
return pa;
|
||||||
|
|
||||||
@@ -706,7 +714,9 @@ size_t wxMBConvUTF32swap::WC2MB(char *buf, const wchar_t *psz, size_t n) const
|
|||||||
len += sizeof(wxUint32);
|
len += sizeof(wxUint32);
|
||||||
psz += pa;
|
psz += pa;
|
||||||
}
|
}
|
||||||
if (buf && len<=n-sizeof(wxUint32)) *(wxUint32*)buf=0;
|
|
||||||
|
if (buf && len<=n-sizeof(wxUint32))
|
||||||
|
*(wxUint32*)buf=0;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -726,7 +736,9 @@ size_t wxMBConvUTF32straight::MB2WC(wchar_t *buf, const char *psz, size_t n) con
|
|||||||
len++;
|
len++;
|
||||||
psz += sizeof(wxUint32);
|
psz += sizeof(wxUint32);
|
||||||
}
|
}
|
||||||
if (buf && len<n) *buf=0;
|
|
||||||
|
if (buf && len<n)
|
||||||
|
*buf=0;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -749,7 +761,8 @@ size_t wxMBConvUTF32straight::WC2MB(char *buf, const wchar_t *psz, size_t n) con
|
|||||||
psz++;
|
psz++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf && len<=n-sizeof(wxUint32)) *(wxUint32*)buf=0;
|
if (buf && len<=n-sizeof(wxUint32))
|
||||||
|
*(wxUint32*)buf=0;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -773,7 +786,9 @@ size_t wxMBConvUTF32swap::MB2WC(wchar_t *buf, const char *psz, size_t n) const
|
|||||||
len++;
|
len++;
|
||||||
psz += sizeof(wxUint32);
|
psz += sizeof(wxUint32);
|
||||||
}
|
}
|
||||||
if (buf && len<n) *buf=0;
|
|
||||||
|
if (buf && len<n)
|
||||||
|
*buf=0;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -796,7 +811,9 @@ size_t wxMBConvUTF32swap::WC2MB(char *buf, const wchar_t *psz, size_t n) const
|
|||||||
len += sizeof(wxUint32);
|
len += sizeof(wxUint32);
|
||||||
psz++;
|
psz++;
|
||||||
}
|
}
|
||||||
if (buf && len<=n-sizeof(wxUint32)) *(wxUint32*)buf=0;
|
|
||||||
|
if (buf && len<=n-sizeof(wxUint32))
|
||||||
|
*(wxUint32*)buf=0;
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user