Fixed bug in wxConv_local.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2089,33 +2089,34 @@ size_t wxCSConv::MB2WC(wchar_t *buf, const char *psz, size_t n) const
|
|||||||
((wxCSConv *)this)->LoadNow(); // discard constness
|
((wxCSConv *)this)->LoadNow(); // discard constness
|
||||||
if (buf) {
|
if (buf) {
|
||||||
if (m_cset) {
|
if (m_cset) {
|
||||||
for (size_t c=0; c<=n; c++)
|
for (size_t c=0; c<n; c++)
|
||||||
buf[c] = m_cset->data[psz[c]];
|
buf[c] = m_cset->data[psz[c]];
|
||||||
} else {
|
} else {
|
||||||
// latin-1 (direct)
|
// latin-1 (direct)
|
||||||
for (size_t c=0; c<=n; c++)
|
for (size_t c=0; c<n; c++)
|
||||||
buf[c] = psz[c];
|
buf[c] = psz[c];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
return strlen(psz);
|
||||||
|
}
|
||||||
|
|
||||||
size_t wxCSConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const
|
size_t wxCSConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const
|
||||||
{
|
{
|
||||||
((wxCSConv *)this)->LoadNow(); // discard constness
|
((wxCSConv *)this)->LoadNow(); // discard constness
|
||||||
if (buf) {
|
if (buf) {
|
||||||
if (m_cset) {
|
if (m_cset) {
|
||||||
for (size_t c=0; c<=n; c++) {
|
for (size_t c=0; c<n; c++) {
|
||||||
size_t n;
|
size_t n;
|
||||||
for (n=0; (n<256) && (m_cset->data[n] != psz[c]); n++);
|
for (n=0; (n<256) && (m_cset->data[n] != psz[c]); n++);
|
||||||
buf[c] = (n>0xff) ? '?' : n;
|
buf[c] = (n>0xff) ? '?' : n;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// latin-1 (direct)
|
// latin-1 (direct)
|
||||||
for (size_t c=0; c<=n; c++)
|
for (size_t c=0; c<n; c++)
|
||||||
buf[c] = (psz[c]>0xff) ? '?' : psz[c];
|
buf[c] = (psz[c]>0xff) ? '?' : psz[c];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
return wcslen(psz);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user