1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Merge legacy-Windows fixes (mostly) from 'pre-0.77'.

This commit is contained in:
Simon Tatham
2022-03-12 18:56:06 +00:00
18 changed files with 607 additions and 89 deletions

View File

@ -347,7 +347,6 @@ char *make_dir_path(const char *path, mode_t mode);
/*
* Exports from unicode.c.
*/
struct unicode_data;
bool init_ucs(struct unicode_data *ucsdata, char *line_codepage,
bool utf8_override, int font_charset, int vtmode);

View File

@ -31,6 +31,8 @@ int mb_to_wc(int codepage, int flags, const char *mbstr, int mblen,
memset(&state, 0, sizeof state);
while (mblen > 0) {
if (n >= wclen)
return n;
size_t i = mbrtowc(wcstr+n, mbstr, (size_t)mblen, &state);
if (i == (size_t)-1 || i == (size_t)-2)
break;
@ -44,6 +46,8 @@ int mb_to_wc(int codepage, int flags, const char *mbstr, int mblen,
int n = 0;
while (mblen > 0) {
if (n >= wclen)
return n;
wcstr[n] = 0xD800 | (mbstr[0] & 0xFF);
n++;
mbstr++;