1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Selection now supported in pterm. Required small modifications

outside the unix subdir, owing to more things needing to become
platform-dependent.

[originally from svn r2033]
This commit is contained in:
Simon Tatham
2002-10-13 11:24:25 +00:00
parent b65b4e36f5
commit ffff6f32c7
7 changed files with 208 additions and 13 deletions

View File

@ -92,7 +92,29 @@ int mb_to_wc(int codepage, int flags, char *mbstr, int mblen,
int ret = 0;
while (mblen > 0 && wclen > 0) {
*wcstr++ = (unsigned char) *mbstr++;
ret++;
mblen--, wclen--, ret++;
}
return ret; /* FIXME: check error codes! */
}
int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
char *mbstr, int mblen, char *defchr, int *defused)
{
int ret = 0;
if (defused)
*defused = 0;
while (mblen > 0 && wclen > 0) {
if (*wcstr >= 0x100) {
if (defchr)
*mbstr++ = *defchr;
else
*mbstr++ = '\xBF';
if (defused)
*defused = 1;
} else
*mbstr++ = (unsigned char) *wcstr;
wcstr++;
mblen--, wclen--, ret++;
}
return ret; /* FIXME: check error codes! */
}