From 67769ffc6f3458e6e634f4a32c1d97195e1e077b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 20 Apr 2011 01:38:11 -0700 Subject: [PATCH] * textprop.c (set_text_properties_1): Rewrite for clarity, and to avoid GCC warning about integer overflow. --- src/ChangeLog | 3 +++ src/textprop.c | 17 ++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d01d8fbd727..7eaa153f79a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-04-20 Paul Eggert + * textprop.c (set_text_properties_1): Rewrite for clarity, + and to avoid GCC warning about integer overflow. + * intervals.h (struct interval): Use EMACS_INT for members where EMACS_UINT might cause problems. See . diff --git a/src/textprop.c b/src/textprop.c index d9da36bf36b..64265fd679c 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1348,15 +1348,18 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie register EMACS_INT s, len; INTERVAL unchanged; - s = XINT (start); - len = XINT (end) - s; - if (len == 0) - return; - if (len < 0) + if (XINT (start) < XINT (end)) { - s = s + len; - len = - len; + s = XINT (start); + len = XINT (end) - s; } + else if (XINT (end) < XINT (start)) + { + s = XINT (end); + len = XINT (start) - s; + } + else + return; if (i == 0) i = find_interval (BUF_INTERVALS (XBUFFER (buffer)), s); -- 2.39.2