diff --git a/ldiscucs.c b/ldiscucs.c index 6c943a09..50ce2094 100644 --- a/ldiscucs.c +++ b/ldiscucs.c @@ -84,7 +84,7 @@ void luni_send(Ldisc *ldisc, const wchar_t *widebuf, int len, int interactive) } else { int rv; rv = wc_to_mb(ldisc->term->ucsdata->line_codepage, 0, widebuf, len, - linebuffer, linesize, NULL, NULL, ldisc->term->ucsdata); + linebuffer, linesize, NULL, ldisc->term->ucsdata); if (rv >= 0) p = linebuffer + rv; else diff --git a/putty.h b/putty.h index aa82890f..242bfa67 100644 --- a/putty.h +++ b/putty.h @@ -1294,7 +1294,7 @@ int is_dbcs_leadbyte(int codepage, char byte); int mb_to_wc(int codepage, int flags, const char *mbstr, int mblen, wchar_t *wcstr, int wclen); int wc_to_mb(int codepage, int flags, const wchar_t *wcstr, int wclen, - char *mbstr, int mblen, const char *defchr, int *defused, + char *mbstr, int mblen, const char *defchr, struct unicode_data *ucsdata); wchar_t xlat_uskbd2cyrllic(int ch); int check_compose(int first, int second); diff --git a/unix/gtkfont.c b/unix/gtkfont.c index d0ecaa96..c2a610f1 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -595,7 +595,7 @@ static int x11font_has_glyph(unifont *font, wchar_t glyph) */ char sbstring[2]; int sblen = wc_to_mb(xfont->real_charset, 0, &glyph, 1, - sbstring, 2, "", NULL, NULL); + sbstring, 2, "", NULL); if (sblen == 0 || !sbstring[0]) return FALSE; /* not even in the charset */ @@ -950,7 +950,7 @@ static void x11font_draw_text(unifont_drawctx *ctx, unifont *font, */ char *sbstring = snewn(len+1, char); int sblen = wc_to_mb(xfont->real_charset, 0, string, len, - sbstring, len+1, ".", NULL, NULL); + sbstring, len+1, ".", NULL); x11font_really_draw_text(x11font_drawfuncs + index + 0, ctx, &xfont->fonts[sfid], xfont->disp, x, y, sbstring, sblen, shadowoffset, @@ -1631,7 +1631,7 @@ static void pangofont_draw_internal(unifont_drawctx *ctx, unifont *font, */ utfstring = snewn(len*6+1, char); /* UTF-8 has max 6 bytes/char */ utflen = wc_to_mb(CS_UTF8, 0, string, len, - utfstring, len*6+1, ".", NULL, NULL); + utfstring, len*6+1, ".", NULL); utfptr = utfstring; while (utflen > 0) { diff --git a/unix/gtkwin.c b/unix/gtkwin.c index ec53b6c8..64aae476 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -3049,7 +3049,7 @@ void write_clip(Frontend *inst, int clipboard, state->pasteout_data_len = wc_to_mb(inst->ucsdata.line_codepage, 0, data, len, state->pasteout_data, state->pasteout_data_len, - NULL, NULL, NULL); + NULL, NULL); if (state->pasteout_data_len == 0) { sfree(state->pasteout_data); state->pasteout_data = NULL; diff --git a/unix/uxucs.c b/unix/uxucs.c index 86cc33d4..edaca92c 100644 --- a/unix/uxucs.c +++ b/unix/uxucs.c @@ -57,13 +57,9 @@ int mb_to_wc(int codepage, int flags, const char *mbstr, int mblen, } int wc_to_mb(int codepage, int flags, const wchar_t *wcstr, int wclen, - char *mbstr, int mblen, const char *defchr, int *defused, + char *mbstr, int mblen, const char *defchr, struct unicode_data *ucsdata) { - /* FIXME: we should remove the defused param completely... */ - if (defused) - *defused = 0; - if (codepage == DEFAULT_CODEPAGE) { char output[MB_LEN_MAX]; mbstate_t state; diff --git a/windows/winucs.c b/windows/winucs.c index 0ecd225e..f40444c9 100644 --- a/windows/winucs.c +++ b/windows/winucs.c @@ -1157,7 +1157,7 @@ void get_unitab(int codepage, wchar_t * unitab, int ftype) } int wc_to_mb(int codepage, int flags, const wchar_t *wcstr, int wclen, - char *mbstr, int mblen, const char *defchr, int *defused, + char *mbstr, int mblen, const char *defchr, struct unicode_data *ucsdata) { char *p; @@ -1180,7 +1180,6 @@ int wc_to_mb(int codepage, int flags, const wchar_t *wcstr, int wclen, int j; for (j = 0; defchr[j]; j++) *p++ = defchr[j]; - if (defused) *defused = 1; } #if 1 else @@ -1189,9 +1188,11 @@ int wc_to_mb(int codepage, int flags, const wchar_t *wcstr, int wclen, assert(p - mbstr < mblen); } return p - mbstr; - } else + } else { + int defused; return WideCharToMultiByte(codepage, flags, wcstr, wclen, - mbstr, mblen, defchr, defused); + mbstr, mblen, defchr, &defused); + } } int mb_to_wc(int codepage, int flags, const char *mbstr, int mblen,