1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Remove 'defused' parameter from wc_to_mb.

It's never set to anything but NULL at any call site, and there's been
a FIXME comment in uxucs.c for ages saying it should be removed. I
think it only existed in the first place because it was a facility
supported by the underlying Windows API function and we couldn't see a
reason _not_ to pass it through. But I'm cleaning up FIXMEs, so we
should get rid of it.

(It stood for 'default used', incidentally - as in 'did the function
at any point have to make use of the parameter providing a default
fallback character?'. Nothing to do with _defusing_ things :-)
This commit is contained in:
Simon Tatham
2018-10-06 11:45:26 +01:00
parent 461ade43d1
commit 07f99e6e82
6 changed files with 12 additions and 15 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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;