emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117835: * xselect.c (x_fill_property_data): Handle


From: Jan D.
Subject: [Emacs-diffs] trunk r117835: * xselect.c (x_fill_property_data): Handle negative XCDR when data
Date: Sun, 07 Sep 2014 17:31:43 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117835
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18303
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sun 2014-09-07 19:31:39 +0200
message:
  * xselect.c (x_fill_property_data): Handle negative XCDR when data
  is CONSP.
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:04:19 +0000
+++ b/src/ChangeLog     2014-09-07 17:31:39 +0000
@@ -1,3 +1,8 @@
+2014-09-07  Jan Djärv  <address@hidden>
+
+       * xselect.c (x_fill_property_data): Handle negative XCDR when data
+       is CONSP (Bug#18303).
+
 2014-09-07  Eli Zaretskii  <address@hidden>
 
        * callproc.c (child_setup) [WINDOWSNT]: Don't call exec_failed if

=== modified file 'src/xselect.c'
--- a/src/xselect.c     2014-07-18 11:04:37 +0000
+++ b/src/xselect.c     2014-09-07 17:31:39 +0000
@@ -2299,7 +2299,24 @@
       Lisp_Object o = XCAR (iter);
 
       if (INTEGERP (o) || FLOATP (o) || CONSP (o))
-       val = cons_to_signed (o, LONG_MIN, LONG_MAX);
+        {
+          if (CONSP (o) && INTEGERP (XCAR (o)) && INTEGERP (XCDR (o)))
+            {
+              intmax_t v1 = XINT (XCAR (o));
+              intmax_t 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);
+            }
+          else
+            val = cons_to_signed (o, LONG_MIN, LONG_MAX);
+        }
       else if (STRINGP (o))
         {
           block_input ();


reply via email to

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