mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 11:42:21 +00:00
DtHelp: Add the multibyte character support to _DtCvChar.
This commit is contained in:
parent
a9ceb6db7a
commit
a9ddcffd94
1 changed files with 29 additions and 5 deletions
|
@ -155,12 +155,36 @@ _DtCvChar (
|
||||||
int type,
|
int type,
|
||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
wchar_t value = (wchar_t) -1;
|
int i, len;
|
||||||
|
char *ptr;
|
||||||
|
char str[MB_CUR_MAX];
|
||||||
|
wchar_t value;
|
||||||
|
|
||||||
if (0 == type)
|
if (0 == type) {
|
||||||
value = *(((char *) p1) + count);
|
ptr = (char *) p1 + count;
|
||||||
else
|
|
||||||
value = *(((wchar_t *) p1) + count);
|
if (MB_CUR_MAX > 1) {
|
||||||
|
len = mbtowc(&value, ptr, MB_CUR_MAX);
|
||||||
|
|
||||||
|
if (len == -1) {
|
||||||
|
for (i = 1; i < MB_CUR_MAX; ++i) {
|
||||||
|
ptr -= i;
|
||||||
|
|
||||||
|
if (ptr < (char *) p1) {
|
||||||
|
len = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = mbtowc(&value, ptr, MB_CUR_MAX);
|
||||||
|
if (len == -1) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len == -1) value = (wchar_t) -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else value = *ptr;
|
||||||
|
}
|
||||||
|
else value = *(((wchar_t *) p1) + count);
|
||||||
|
|
||||||
return (value);
|
return (value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue