From: Paul Eggert Date: Wed, 20 Apr 2011 08:38:11 +0000 (-0700) Subject: * textprop.c (set_text_properties_1): Rewrite for clarity, X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~235 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=67769ffc6f3458e6e634f4a32c1d97195e1e077b;p=emacs.git * textprop.c (set_text_properties_1): Rewrite for clarity, and to avoid GCC warning about integer overflow. --- 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);