emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117836: Adjust drag-and-drop fix when window is abo


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117836: Adjust drag-and-drop fix when window is above top.
Date: Sun, 07 Sep 2014 19:47:33 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117836
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18383
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2014-09-07 12:47:28 -0700
message:
  Adjust drag-and-drop fix when window is above top.
  
  * xselect.c (x_fill_property_data): Don't let sign bit of negative
  XCDR bleed into XCAR's encoded value.  Improve checks for
  out-of-range data while we're at it.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/xselect.c                  xselect.c-20091113204419-o5vbwnq5f7feedwu-543
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-07 17:31:39 +0000
+++ b/src/ChangeLog     2014-09-07 19:47:28 +0000
@@ -1,3 +1,10 @@
+2014-09-07  Paul Eggert  <address@hidden>
+
+       Adjust drag-and-drop fix when window is above top (Bug#18303).
+       * xselect.c (x_fill_property_data): Don't let sign bit of negative
+       XCDR bleed into XCAR's encoded value.  Improve checks for
+       out-of-range data while we're at it.
+
 2014-09-07  Jan Djärv  <address@hidden>
 
        * xselect.c (x_fill_property_data): Handle negative XCDR when data

=== modified file 'src/xselect.c'
--- a/src/xselect.c     2014-09-07 17:31:39 +0000
+++ b/src/xselect.c     2014-09-07 19:47:28 +0000
@@ -2300,22 +2300,20 @@
 
       if (INTEGERP (o) || FLOATP (o) || CONSP (o))
         {
-          if (CONSP (o) && INTEGERP (XCAR (o)) && INTEGERP (XCDR (o)))
+          if (CONSP (o)
+             && RANGED_INTEGERP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16)
+             && RANGED_INTEGERP (- (1 << 15), XCDR (o), -1))
             {
-              intmax_t v1 = XINT (XCAR (o));
-              intmax_t v2 = XINT (XCDR (o));
+              long v1 = XINT (XCAR (o));
+              long v2 = XINT (XCDR (o));
               /* cons_to_signed does not handle negative values for v2.
                  For XDnd, v2 might be y of a window, and can be negative.
                  The XDnd spec. is not explicit about negative values,
-                 but lets do what it says.
-              */
-              if (v1 < 0 || v2 < 0)
-                val = (v1 << 16) | v2;
-              else
-                val = cons_to_signed (o, LONG_MIN, LONG_MAX);
+                 but let's assume negative v2 is sent modulo 2**16.  */
+             val = (v1 << 16) | (v2 & 0xffff);
             }
           else
-            val = cons_to_signed (o, LONG_MIN, LONG_MAX);
+            val = cons_to_signed (o, X_LONG_MIN, X_LONG_MAX);
         }
       else if (STRINGP (o))
         {
@@ -2335,7 +2333,7 @@
        }
       else if (format == 16)
        {
-         if (SHRT_MIN <= val && val <= SHRT_MAX)
+         if (X_SHRT_MIN <= val && val <= X_SHRT_MAX)
            *d16++ = val;
          else
            error ("Out of 'short' range");


reply via email to

[Prev in Thread] Current Thread [Next in Thread]