From 46f905e18a25390eda6db7705e2ddcf5e73305d2 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 17 Sep 2008 21:25:29 +0000 Subject: [PATCH] (Fcomposition_get_gstring): Yet another int/Lisp_Oject mixup (YAILOM). --- src/ChangeLog | 5 +++++ src/composite.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5a1f6d0602c..ece8e4829f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-09-17 Stefan Monnier + + * composite.c (Fcomposition_get_gstring): Yet another int/Lisp_Oject + mixup (YAILOM). + 2008-09-17 Chong Yidong * indent.c (Fvertical_motion): Use position reported by iterator diff --git a/src/composite.c b/src/composite.c index 95f700c7116..5773744c083 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1489,6 +1489,7 @@ must be ignore. */) Lisp_Object font_object, from, to, string; { Lisp_Object gstring, header; + EMACS_INT frompos, topos; if (! NILP (font_object)) CHECK_FONT_OBJECT (font_object); @@ -1496,8 +1497,13 @@ must be ignore. */) gstring = gstring_lookup_cache (header); if (! NILP (gstring)) return gstring; - if (LGSTRING_GLYPH_LEN (gstring_work) < to - from) - gstring_work = Fmake_vector (make_number (to - from + 2), Qnil); + + /* Maybe we should check this at the function's entry. --Stef */ + CHECK_NATNUM (from); frompos = XINT (from); + CHECK_NATNUM (to); topos = XINT (to); + + if (LGSTRING_GLYPH_LEN (gstring_work) < topos - frompos) + gstring_work = Fmake_vector (make_number (topos - frompos + 2), Qnil); LGSTRING_SET_HEADER (gstring_work, header); LGSTRING_SET_ID (gstring_work, Qnil); fill_gstring_body (gstring_work); -- 2.39.5