* xselect.c: Use 'unsigned' more consistently.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 3 Jun 2011 18:22:12 +0000 (11:22 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 3 Jun 2011 18:22:12 +0000 (11:22 -0700)
(selection_data_to_lisp_data, lisp_data_to_selection_data):
Use 'unsigned' consistently when computing sizes of unsigned objects.

src/ChangeLog
src/xselect.c

index ff36dd331027690e9c0d78346e3c2baaa3ce0aba..2b81f66d8b6c213116609407b95e3861e952621c 100644 (file)
@@ -1,5 +1,9 @@
 2011-06-03  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * xselect.c: Use 'unsigned' more consistently.
+       (selection_data_to_lisp_data, lisp_data_to_selection_data):
+       Use 'unsigned' consistently when computing sizes of unsigned objects.
+
        * fileio.c (Fverify_visited_file_modtime): Avoid time overflow
        if b->modtime has its maximal value.
 
index 73ef4abc0a4d601c0b12afe1994c4b3ec2660aa0..ca2b1812a61d5a06440cda74747815773d361342 100644 (file)
@@ -1651,9 +1651,9 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
      If the number is 32 bits and won't fit in a Lisp_Int,
      convert it to a cons of integers, 16 bits in each half.
    */
-  else if (format == 32 && size == sizeof (int))
+  else if (format == 32 && size == sizeof (unsigned int))
     return long_to_cons (((unsigned int *) data) [0]);
-  else if (format == 16 && size == sizeof (short))
+  else if (format == 16 && size == sizeof (unsigned short))
     return make_number ((int) (((unsigned short *) data) [0]));
 
   /* Convert any other kind of data to a vector of numbers, represented
@@ -1753,8 +1753,8 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
     {
       *format_ret = 32;
       *size_ret = 1;
-      *data_ret = (unsigned char *) xmalloc (sizeof (long) + 1);
-      (*data_ret) [sizeof (long)] = 0;
+      *data_ret = (unsigned char *) xmalloc (sizeof (unsigned long) + 1);
+      (*data_ret) [sizeof (unsigned long)] = 0;
       (*(unsigned long **) data_ret) [0] = cons_to_long (obj);
       if (NILP (type)) type = QINTEGER;
     }