bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#8794: (a) straightforward prerequisite fixes


From: Paul Eggert
Subject: bug#8794: (a) straightforward prerequisite fixes
Date: Fri, 03 Jun 2011 12:29:03 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10

=== modified file 'src/ChangeLog'
--- src/ChangeLog       2011-06-02 08:40:41 +0000
+++ src/ChangeLog       2011-06-03 18:22:12 +0000
@@ -1,3 +1,37 @@
+2011-06-03  Paul Eggert  <address@hidden>
+
+       * 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.
+
+       * dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.
+
+       * lisp.h: Include <intprops.h>, as it'll useful in later changes.
+       * character.c, data.c, editfns.c, insdel.c, intervals.c:
+       Don't include <intprops.h>, since lisp.h does.
+
+       Don't assume time_t can fit into int.
+       * buffer.h (struct buffer.modtime): Now time_t, not int.
+       * fileio.c (Fvisited_file_modtime): No need for time_t cast now.
+       * undo.c (Fprimitive_undo): Use time_t, not int, for time_t value.
+
+       Minor fixes for signed vs unsigned integers.
+       * character.h (MAYBE_UNIFY_CHAR):
+       * charset.c (maybe_unify_char):
+       * keyboard.c (read_char, reorder_modifiers):
+       XINT -> XFASTINT, since the integer must be nonnegative.
+       * ftfont.c (ftfont_spec_pattern):
+       * keymap.c (access_keymap, silly_event_symbol_error):
+       XUINT -> XFASTINT, since the integer must be nonnegative.
+       (Fsingle_key_description, preferred_sequence_p): XUINT -> XINT,
+       since it makes no difference and we prefer signed.
+       * keyboard.c (record_char): Use XUINT when all the neighbors do.
+       (access_keymap): NATNUMP -> INTEGERP, since the integer must be
+       nonnegative.
+
 2011-06-02  Paul Eggert  <address@hidden>
 
        Malloc failure behavior now depends on size of allocation.

=== modified file 'src/buffer.h'
--- src/buffer.h        2011-05-12 07:07:06 +0000
+++ src/buffer.h        2011-06-02 06:15:15 +0000
@@ -545,7 +545,7 @@
      -1 means visited file was nonexistent.
      0 means visited file modtime unknown; in no case complain
      about any mismatch on next save attempt.  */
-  int modtime;
+  time_t modtime;
   /* Size of the file when modtime was set.  This is used to detect the
      case where the file grew while we were reading it, so the modtime
      is still the same (since it's rounded up to seconds) but we're actually

=== modified file 'src/character.c'
--- src/character.c     2011-05-21 04:33:23 +0000
+++ src/character.c     2011-06-02 06:17:35 +0000
@@ -35,7 +35,7 @@
 
 #include <sys/types.h>
 #include <setjmp.h>
-#include <intprops.h>
+
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"

=== modified file 'src/character.h'
--- src/character.h     2011-05-21 04:33:23 +0000
+++ src/character.h     2011-06-01 02:49:12 +0000
@@ -544,7 +544,7 @@
        Lisp_Object val;                                \
        val = CHAR_TABLE_REF (Vchar_unify_table, c);    \
        if (INTEGERP (val))                             \
-         c = XINT (val);                               \
+         c = XFASTINT (val);                           \
        else if (! NILP (val))                          \
          c = maybe_unify_char (c, val);                \
       }                                                        \

=== modified file 'src/charset.c'
--- src/charset.c       2011-05-31 06:05:00 +0000
+++ src/charset.c       2011-06-03 18:11:17 +0000
@@ -1637,7 +1637,7 @@
   struct charset *charset;
 
   if (INTEGERP (val))
-    return XINT (val);
+    return XFASTINT (val);
   if (NILP (val))
     return c;
 
@@ -1647,7 +1647,7 @@
     {
       val = CHAR_TABLE_REF (Vchar_unify_table, c);
       if (! NILP (val))
-       c = XINT (val);
+       c = XFASTINT (val);
     }
   else
     {

=== modified file 'src/data.c'
--- src/data.c  2011-05-31 14:57:53 +0000
+++ src/data.c  2011-06-02 06:17:35 +0000
@@ -23,8 +23,6 @@
 #include <stdio.h>
 #include <setjmp.h>
 
-#include <intprops.h>
-
 #include "lisp.h"
 #include "puresize.h"
 #include "character.h"

=== modified file 'src/dired.c'
--- src/dired.c 2011-04-14 19:34:42 +0000
+++ src/dired.c 2011-06-02 06:21:13 +0000
@@ -1013,12 +1013,11 @@
         The code on the next line avoids a compiler warning on
         systems where st_ino is 32 bit wide. (bug#766).  */
       EMACS_INT high_ino = s.st_ino >> 31 >> 1;
-      EMACS_INT low_ino  = s.st_ino & 0xffffffff;
 
       values[10] = Fcons (make_number (high_ino >> 8),
                          Fcons (make_number (((high_ino & 0xff) << 16)
-                                             + (low_ino >> 16)),
-                                make_number (low_ino & 0xffff)));
+                                             + (s.st_ino >> 16 & 0xffff)),
+                                make_number (s.st_ino & 0xffff)));
     }
 
   /* Likewise for device.  */

=== modified file 'src/editfns.c'
--- src/editfns.c       2011-05-30 16:47:35 +0000
+++ src/editfns.c       2011-06-03 18:14:49 +0000
@@ -47,7 +47,6 @@
 #include <ctype.h>
 #include <float.h>
 #include <limits.h>
-#include <intprops.h>
 #include <strftime.h>
 #include <verify.h>
 

=== modified file 'src/fileio.c'
--- src/fileio.c        2011-04-29 19:47:29 +0000
+++ src/fileio.c        2011-06-02 06:23:20 +0000
@@ -4960,7 +4960,7 @@
   if ((st.st_mtime == b->modtime
        /* If both are positive, accept them if they are off by one second.  */
        || (st.st_mtime > 0 && b->modtime > 0
-          && (st.st_mtime == b->modtime + 1
+          && (st.st_mtime - 1 == b->modtime
               || st.st_mtime == b->modtime - 1)))
       && (st.st_size == b->modtime_size
           || b->modtime_size < 0))
@@ -4990,7 +4990,7 @@
 {
   if (! current_buffer->modtime)
     return make_number (0);
-  return make_time ((time_t) current_buffer->modtime);
+  return make_time (current_buffer->modtime);
 }
 
 DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime,

=== modified file 'src/ftfont.c'
--- src/ftfont.c        2011-04-11 03:39:45 +0000
+++ src/ftfont.c        2011-06-01 02:49:12 +0000
@@ -815,7 +815,7 @@
            goto err;
          for (chars = XCDR (chars); CONSP (chars); chars = XCDR (chars))
            if (CHARACTERP (XCAR (chars))
-               && ! FcCharSetAddChar (charset, XUINT (XCAR (chars))))
+               && ! FcCharSetAddChar (charset, XFASTINT (XCAR (chars))))
              goto err;
        }
     }

=== modified file 'src/insdel.c'
--- src/insdel.c        2011-05-21 04:33:23 +0000
+++ src/insdel.c        2011-06-02 06:17:35 +0000
@@ -21,8 +21,6 @@
 #include <config.h>
 #include <setjmp.h>
 
-#include <intprops.h>
-
 #include "lisp.h"
 #include "intervals.h"
 #include "buffer.h"

=== modified file 'src/intervals.c'
--- src/intervals.c     2011-05-28 22:39:39 +0000
+++ src/intervals.c     2011-06-02 06:17:35 +0000
@@ -39,7 +39,7 @@
 
 #include <config.h>
 #include <setjmp.h>
-#include <intprops.h>
+
 #include "lisp.h"
 #include "intervals.h"
 #include "buffer.h"

=== modified file 'src/keyboard.c'
--- src/keyboard.c      2011-05-28 22:39:39 +0000
+++ src/keyboard.c      2011-06-01 02:49:12 +0000
@@ -2395,8 +2395,8 @@
 
       c = Faref (Vexecuting_kbd_macro, make_number 
(executing_kbd_macro_index));
       if (STRINGP (Vexecuting_kbd_macro)
-         && (XINT (c) & 0x80) && (XUINT (c) <= 0xff))
-       XSETFASTINT (c, CHAR_META | (XINT (c) & ~0x80));
+         && (XFASTINT (c) & 0x80) && (XFASTINT (c) <= 0xff))
+       XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80));
 
       executing_kbd_macro_index++;
 
@@ -3321,7 +3321,7 @@
       if (INTEGERP (c))
        {
          if (XUINT (c) < 0x100)
-           putc (XINT (c), dribble);
+           putc (XUINT (c), dribble);
          else
            fprintf (dribble, " 0x%"pI"x", XUINT (c));
        }
@@ -6370,7 +6370,7 @@
   Lisp_Object parsed;
 
   parsed = parse_modifiers (symbol);
-  return apply_modifiers ((int) XINT (XCAR (XCDR (parsed))),
+  return apply_modifiers (XFASTINT (XCAR (XCDR (parsed))),
                          XCAR (parsed));
 }
 

=== modified file 'src/keymap.c'
--- src/keymap.c        2011-05-12 07:07:06 +0000
+++ src/keymap.c        2011-06-01 02:49:12 +0000
@@ -462,7 +462,7 @@
     XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1)));
 
   /* Handle the special meta -> esc mapping. */
-  if (INTEGERP (idx) && XUINT (idx) & meta_modifier)
+  if (INTEGERP (idx) && XFASTINT (idx) & meta_modifier)
     {
       /* See if there is a meta-map.  If there's none, there is
          no binding for IDX, unless a default binding exists in MAP.  */
@@ -480,7 +480,7 @@
       if (CONSP (event_meta_map))
        {
          map = event_meta_map;
-         idx = make_number (XUINT (idx) & ~meta_modifier);
+         idx = make_number (XFASTINT (idx) & ~meta_modifier);
        }
       else if (t_ok)
        /* Set IDX to t, so that we only find a default binding.  */
@@ -529,7 +529,7 @@
          }
        else if (VECTORP (binding))
          {
-           if (NATNUMP (idx) && XFASTINT (idx) < ASIZE (binding))
+           if (INTEGERP (idx) && XFASTINT (idx) < ASIZE (binding))
              val = AREF (binding, XFASTINT (idx));
          }
        else if (CHAR_TABLE_P (binding))
@@ -537,7 +537,7 @@
            /* Character codes with modifiers
               are not included in a char-table.
               All character codes without modifiers are included.  */
-           if (NATNUMP (idx) && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0)
+           if (INTEGERP (idx) && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0)
              {
                val = Faref (binding, idx);
                /* `nil' has a special meaning for char-tables, so
@@ -1357,7 +1357,7 @@
   int modifiers;
 
   parsed = parse_modifiers (c);
-  modifiers = (int) XUINT (XCAR (XCDR (parsed)));
+  modifiers = XFASTINT (XCAR (XCDR (parsed)));
   base = XCAR (parsed);
   name = Fsymbol_name (base);
   /* This alist includes elements such as ("RET" . "\\r").  */
@@ -2416,7 +2416,7 @@
     {
       char tem[KEY_DESCRIPTION_SIZE];
 
-      *push_key_description (XUINT (key), tem, 1) = 0;
+      *push_key_description (XINT (key), tem, 1) = 0;
       return build_string (tem);
     }
   else if (SYMBOLP (key))      /* Function key or event-symbol */
@@ -2515,7 +2515,7 @@
        return 0;
       else
        {
-         int modifiers = XUINT (elt) & (CHAR_MODIFIER_MASK & ~CHAR_META);
+         int modifiers = XINT (elt) & (CHAR_MODIFIER_MASK & ~CHAR_META);
          if (modifiers == where_is_preferred_modifier)
            result = 2;
          else if (modifiers)

=== modified file 'src/lisp.h'
--- src/lisp.h  2011-06-02 08:25:28 +0000
+++ src/lisp.h  2011-06-03 18:14:49 +0000
@@ -24,6 +24,8 @@
 #include <stddef.h>
 #include <inttypes.h>
 
+#include <intprops.h>
+
 /* Use the configure flag --enable-checking[=LIST] to enable various
    types of run time checks for Lisp objects.  */
 

=== modified file 'src/undo.c'
--- src/undo.c  2011-04-14 05:04:02 +0000
+++ src/undo.c  2011-06-02 06:15:15 +0000
@@ -500,7 +500,7 @@
                {
                  /* Element (t high . low) records previous modtime.  */
                  Lisp_Object high, low;
-                 int mod_time;
+                 time_t mod_time;
                  struct buffer *base_buffer = current_buffer;
 
                  high = Fcar (cdr);

=== modified file 'src/xselect.c'
--- src/xselect.c       2011-05-29 05:23:24 +0000
+++ src/xselect.c       2011-06-03 18:22:12 +0000
@@ -1651,9 +1651,9 @@
      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 @@
     {
       *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;
     }






reply via email to

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