From 9ca05932715b387d963f7dd490a2b78a67ad200a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 3 Jun 2011 11:22:12 -0700 Subject: [PATCH] * 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. --- src/ChangeLog | 4 ++++ src/xselect.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ff36dd33102..2b81f66d8b6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-06-03 Paul Eggert + * 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. diff --git a/src/xselect.c b/src/xselect.c index 73ef4abc0a4..ca2b1812a61 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -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; } -- 2.39.5