From aa895b8061ac0710660189e2ce3d026729ca1154 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 3 Aug 2024 16:46:47 +0800 Subject: [PATCH] Fix various typos reported by Pip Cet * src/ftfont.c (get_adstyle_property): * src/sfntfont.c (sfntfont_list_1): Correct typos. Reported by Pip Cet . (cherry picked from commit c25687e860fbae6178afe8096ec003f5f4ce6462) --- src/ftfont.c | 10 +++++----- src/sfntfont.c | 17 ++++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/ftfont.c b/src/ftfont.c index c89feea1d46..882d3eec256 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -174,11 +174,11 @@ get_adstyle_property (FcPattern *p) USE_SAFE_ALLOCA; tmp = SAFE_ALLOCA (end - str); for (i = 0; i < end - str; ++i) - tmp[i] = ((end[i] != '?' - && end[i] != '*' - && end[i] != '"' - && end[i] != '-') - ? end[i] : ' '); + tmp[i] = ((str[i] != '?' + && str[i] != '*' + && str[i] != '"' + && str[i] != '-') + ? str[i] : ' '); adstyle = font_intern_prop (tmp, end - str, 1); SAFE_FREE (); if (font_style_to_value (FONT_WIDTH_INDEX, adstyle, 0) >= 0) diff --git a/src/sfntfont.c b/src/sfntfont.c index d1376939a3c..8c02c05e7a6 100644 --- a/src/sfntfont.c +++ b/src/sfntfont.c @@ -1643,6 +1643,7 @@ sfntfont_list_1 (struct sfnt_font_desc *desc, Lisp_Object spec, struct sfnt_cmap_encoding_subtable subtable; int instance, num_instance; Lisp_Object item; + bool matching; /* cmap and subtable are caches for sfntfont_lookup_char. */ @@ -1788,19 +1789,21 @@ sfntfont_list_1 (struct sfnt_font_desc *desc, Lisp_Object spec, /* The vector contains characters, of which one must be present in the font. */ + matching = false; for (i = 0; i < ASIZE (tem); ++i) { if (FIXNUMP (AREF (tem, i))) { - if (!sfntfont_lookup_char (desc, AREF (tem, i), - &cmap, &subtable)) - goto fail; - - /* One character is enough to pass a font. Don't - look at too many. */ - break; + if (sfntfont_lookup_char (desc, AREF (tem, i), + &cmap, &subtable)) + { + matching = true; + break; + } } } + if (!matching) + goto fail; } else if (CONSP (tem) && CONSP (XCDR (tem))) { -- 2.39.2