aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2007-01-10 03:50:19 +0000
committerStefan Monnier2007-01-10 03:50:19 +0000
commitc5c6b2cc681fec1d9a1596d9378deea9a2b69656 (patch)
tree154508f70117699804a436003bab42f1a4ee68f7 /src
parent8b9ae6b046cff3c30a469e06c07085a603560e2c (diff)
downloademacs-c5c6b2cc681fec1d9a1596d9378deea9a2b69656.tar.gz
emacs-c5c6b2cc681fec1d9a1596d9378deea9a2b69656.zip
(Fformat): Allow integer-format to work with floats of size
larger than most-positive-fixnum (but still smaller than MAXINT).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/editfns.c18
2 files changed, 18 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5c4a9aeae1f..1974d45dd2c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12007-01-10 Stefan Monnier <monnier@iro.umontreal.ca> 12007-01-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * editfns.c (Fformat): Allow integer-format to work with floats of size
4 larger than most-positive-fixnum (but still smaller than MAXINT).
5
3 * dired.c (Ffile_attributes): Use floats for large uids/gids. 6 * dired.c (Ffile_attributes): Use floats for large uids/gids.
4 7
52007-01-09 Eli Zaretskii <eliz@gnu.org> 82007-01-09 Eli Zaretskii <eliz@gnu.org>
diff --git a/src/editfns.c b/src/editfns.c
index 6089ee9a2e2..ab29a07b693 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1,7 +1,7 @@
1/* Lisp functions pertaining to editing. 1/* Lisp functions pertaining to editing.
2 Copyright (C) 1985, 1986, 1987, 1989, 1993, 1994, 1995, 1996, 2 Copyright (C) 1985, 1986, 1987, 1989, 1993, 1994, 1995, 1996,
3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006 Free Software Foundation, Inc. 4 2005, 2006, 2007 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -3631,7 +3631,12 @@ usage: (format STRING &rest OBJECTS) */)
3631 if (*format != 'd' && *format != 'o' && *format != 'x' 3631 if (*format != 'd' && *format != 'o' && *format != 'x'
3632 && *format != 'i' && *format != 'X' && *format != 'c') 3632 && *format != 'i' && *format != 'X' && *format != 'c')
3633 error ("Invalid format operation %%%c", *format); 3633 error ("Invalid format operation %%%c", *format);
3634 args[n] = Ftruncate (args[n], Qnil); 3634 /* This fails unnecessarily if args[n] is bigger than
3635 most-positive-fixnum but smaller than MAXINT.
3636 These cases are important because we sometimes use floats
3637 to represent such integer values (typically such values
3638 come from UIDs or PIDs). */
3639 /* args[n] = Ftruncate (args[n], Qnil); */
3635 } 3640 }
3636 3641
3637 /* Note that we're using sprintf to print floats, 3642 /* Note that we're using sprintf to print floats,
@@ -3799,8 +3804,15 @@ usage: (format STRING &rest OBJECTS) */)
3799 else 3804 else
3800 sprintf (p, this_format, XUINT (args[n])); 3805 sprintf (p, this_format, XUINT (args[n]));
3801 } 3806 }
3802 else 3807 else if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g')
3803 sprintf (p, this_format, XFLOAT_DATA (args[n])); 3808 sprintf (p, this_format, XFLOAT_DATA (args[n]));
3809 else if (format[-1] == 'd')
3810 /* Maybe we should use "%1.0f" instead so it also works
3811 for values larger than MAXINT. */
3812 sprintf (p, this_format, (EMACS_INT) XFLOAT_DATA (args[n]));
3813 else
3814 /* Don't sign-extend for octal or hex printing. */
3815 sprintf (p, this_format, (EMACS_UINT) XFLOAT_DATA (args[n]));
3804 3816
3805 if (p > buf 3817 if (p > buf
3806 && multibyte 3818 && multibyte