* textprop.c (set_text_properties_1): Rewrite for clarity,

and to avoid GCC warning about integer overflow.
This commit is contained in:
Paul Eggert 2011-04-20 01:38:11 -07:00
parent 37aa2f8525
commit 67769ffc6f
2 changed files with 13 additions and 7 deletions

View file

@ -1,5 +1,8 @@
2011-04-20 Paul Eggert <eggert@cs.ucla.edu>
* 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
<http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html>.

View file

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