diff --git a/putty.h b/putty.h index 57c23442..6132327f 100644 --- a/putty.h +++ b/putty.h @@ -2118,7 +2118,15 @@ bool conf_deserialise(Conf *conf, BinarySource *src);/*returns true on success*/ * Functions to copy, free, serialise and deserialise FontSpecs. * Provided per-platform, to go with the platform's idea of a * FontSpec's contents. + * + * The full fontspec_new is declared in the platform header, because + * each platform may need it to have a different prototype, due to + * constructing fonts in different ways. But fontspec_new_default() + * will at least produce _some_ kind of a FontSpec, for use in + * situations where one needs to exist (e.g. to put in a Conf) and be + * freeable but won't actually be used for anything important. */ +FontSpec *fontspec_new_default(void); FontSpec *fontspec_copy(const FontSpec *f); void fontspec_free(FontSpec *f); void fontspec_serialise(BinarySink *bs, FontSpec *f); diff --git a/test/fuzzterm.c b/test/fuzzterm.c index 0d4597b1..ae838651 100644 --- a/test/fuzzterm.c +++ b/test/fuzzterm.c @@ -201,7 +201,7 @@ int platform_default_i(const char *name, int def) FontSpec *platform_default_fontspec(const char *name) { - return fontspec_new(""); + return fontspec_new_default(); } Filename *platform_default_filename(const char *name) diff --git a/unix/pageant.c b/unix/pageant.c index e813e934..c77abbac 100644 --- a/unix/pageant.c +++ b/unix/pageant.c @@ -172,7 +172,7 @@ void random_destroy_seed(void) {} char *platform_default_s(const char *name) { return NULL; } bool platform_default_b(const char *name, bool def) { return def; } int platform_default_i(const char *name, int def) { return def; } -FontSpec *platform_default_fontspec(const char *name) { return fontspec_new(""); } +FontSpec *platform_default_fontspec(const char *name) { return fontspec_new_default(); } Filename *platform_default_filename(const char *name) { return filename_from_str(""); } char *x_get_default(const char *key) { return NULL; } diff --git a/unix/plink.c b/unix/plink.c index 503ff8d7..76f4c936 100644 --- a/unix/plink.c +++ b/unix/plink.c @@ -64,7 +64,7 @@ int platform_default_i(const char *name, int def) FontSpec *platform_default_fontspec(const char *name) { - return fontspec_new(""); + return fontspec_new_default(); } Filename *platform_default_filename(const char *name) diff --git a/unix/psusan.c b/unix/psusan.c index 1d5816d5..f5f7ed2a 100644 --- a/unix/psusan.c +++ b/unix/psusan.c @@ -78,7 +78,7 @@ int platform_default_i(const char *name, int def) FontSpec *platform_default_fontspec(const char *name) { - return fontspec_new(""); + return fontspec_new_default(); } Filename *platform_default_filename(const char *name) diff --git a/unix/sftp.c b/unix/sftp.c index dafd4fd9..dd25fa20 100644 --- a/unix/sftp.c +++ b/unix/sftp.c @@ -52,7 +52,7 @@ int platform_default_i(const char *name, int def) FontSpec *platform_default_fontspec(const char *name) { - return fontspec_new(""); + return fontspec_new_default(); } Filename *platform_default_filename(const char *name) diff --git a/unix/uppity.c b/unix/uppity.c index 11fead95..36f2c99d 100644 --- a/unix/uppity.c +++ b/unix/uppity.c @@ -80,7 +80,7 @@ int platform_default_i(const char *name, int def) FontSpec *platform_default_fontspec(const char *name) { - return fontspec_new(""); + return fontspec_new_default(); } Filename *platform_default_filename(const char *name) diff --git a/unix/utils/fontspec.c b/unix/utils/fontspec.c index 7c5a0a2f..b9bf8195 100644 --- a/unix/utils/fontspec.c +++ b/unix/utils/fontspec.c @@ -13,6 +13,11 @@ FontSpec *fontspec_new(const char *name) return f; } +FontSpec *fontspec_new_default(void) +{ + return fontspec_new(""); +} + FontSpec *fontspec_copy(const FontSpec *f) { return fontspec_new(f->name); diff --git a/unix/window.c b/unix/window.c index c4bee7b7..103036b1 100644 --- a/unix/window.c +++ b/unix/window.c @@ -304,7 +304,7 @@ FontSpec *platform_default_fontspec(const char *name) if (!strcmp(name, "Font")) return fontspec_new(DEFAULT_GTK_FONT); else - return fontspec_new(""); + return fontspec_new_default(); } Filename *platform_default_filename(const char *name) diff --git a/windows/controls.c b/windows/controls.c index 8f14796e..1d1c74c0 100644 --- a/windows/controls.c +++ b/windows/controls.c @@ -1683,7 +1683,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, shortcuts[nshortcuts++] = ctrl->fontselect.shortcut; statictext(&pos, escaped, 1, base_id); staticbtn(&pos, "", base_id+1, "Change...", base_id+2); - data = fontspec_new("", false, 0, 0); + data = fontspec_new_default(); sfree(escaped); break; default: diff --git a/windows/utils/defaults.c b/windows/utils/defaults.c index 1a270009..928c02c4 100644 --- a/windows/utils/defaults.c +++ b/windows/utils/defaults.c @@ -11,7 +11,7 @@ FontSpec *platform_default_fontspec(const char *name) if (!strcmp(name, "Font")) return fontspec_new("Courier New", false, 10, ANSI_CHARSET); else - return fontspec_new("", false, 0, 0); + return fontspec_new_default(); } Filename *platform_default_filename(const char *name) diff --git a/windows/utils/fontspec.c b/windows/utils/fontspec.c index 7e8d5175..7bdd3423 100644 --- a/windows/utils/fontspec.c +++ b/windows/utils/fontspec.c @@ -14,6 +14,11 @@ FontSpec *fontspec_new(const char *name, bool bold, int height, int charset) return f; } +FontSpec *fontspec_new_default(void) +{ + return fontspec_new("", false, 0, 0); +} + FontSpec *fontspec_copy(const FontSpec *f) { return fontspec_new(f->name, f->isbold, f->height, f->charset);