(Fdump_emacs): Don't take address of array.
[bpt/emacs.git] / src / data.c
index 75e9b55..9c7b4a6 100644 (file)
@@ -26,6 +26,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #ifndef standalone
 #include "buffer.h"
+#include "keyboard.h"
 #endif
 
 #include "syssignal.h"
@@ -736,6 +737,9 @@ store_symval_forwarding (sym, valcontents, newval)
        case Lisp_Misc_Intfwd:
          CHECK_NUMBER (newval, 1);
          *XINTFWD (valcontents)->intvar = XINT (newval);
+         if (*XINTFWD (valcontents)->intvar != XINT (newval))
+           error ("Value out of range for variable `%s'",
+                  XSYMBOL (sym)->name->data);
          break;
 
        case Lisp_Misc_Boolfwd:
@@ -1663,7 +1667,12 @@ NUM may be an integer or a floating point number.")
     }
 #endif /* LISP_FLOAT_TYPE */
 
-  sprintf (buffer, "%d", XINT (num));
+  if (sizeof (int) == sizeof (EMACS_INT))
+    sprintf (buffer, "%d", XINT (num));
+  else if (sizeof (long) == sizeof (EMACS_INT))
+    sprintf (buffer, "%ld", XINT (num));
+  else
+    abort ();
   return build_string (buffer);
 }
 
@@ -1674,6 +1683,7 @@ It ignores leading spaces and tabs.")
   (str)
      register Lisp_Object str;
 {
+  Lisp_Object value;
   unsigned char *p;
 
   CHECK_STRING (str, 0);
@@ -1690,7 +1700,13 @@ It ignores leading spaces and tabs.")
     return make_float (atof (p));
 #endif /* LISP_FLOAT_TYPE */
 
-  return make_number (atoi (p));
+  if (sizeof (int) == sizeof (EMACS_INT))
+    XSETINT (value, atoi (p));
+  else if (sizeof (long) == sizeof (EMACS_INT))
+    XSETINT (value, atol (p));
+  else
+    abort ();
+  return value;
 }
 \f
 enum arithop
@@ -1706,8 +1722,8 @@ arith_driver (code, nargs, args)
 {
   register Lisp_Object val;
   register int argnum;
-  register int accum;
-  register int next;
+  register EMACS_INT accum;
+  register EMACS_INT next;
 
   switch (SWITCH_ENUM_CAST (code))
     {
@@ -1916,7 +1932,7 @@ Both X and Y must be numbers or markers.")
      register Lisp_Object num1, num2;
 {
   Lisp_Object val;
-  int i1, i2;
+  EMACS_INT i1, i2;
 
 #ifdef LISP_FLOAT_TYPE
   CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0);
@@ -1933,7 +1949,7 @@ Both X and Y must be numbers or markers.")
 
       f1 = fmod (f1, f2);
       /* If the "remainder" comes out with the wrong sign, fix it.  */
-      if ((f1 < 0) != (f2 < 0))
+      if (f2 < 0 ? f1 > 0 : f1 < 0)
        f1 += f2;
       return (make_float (f1));
     }