changeset 4406:5998e37dc35e

Use bignums if necessary for file size in #'file-attributes. 2008-01-19 Aidan Kehoe <kehoea@parhasard.net> * dired.c (Ffile_attributes): If bignums are available, use them for the file size when necessary. If they are not, be clearer about the check for whether the file size can fit in a Lisp integer.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 19 Jan 2008 14:34:19 +0100
parents 4b62544f5139
children 8bbabcab2c42
files src/ChangeLog src/dired.c
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jan 18 22:06:01 2008 -0500
+++ b/src/ChangeLog	Sat Jan 19 14:34:19 2008 +0100
@@ -1,3 +1,10 @@
+2008-01-19  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* dired.c (Ffile_attributes): If bignums are available, use them
+	for the file size when necessary. If they are not, be clearer
+	about the check for whether the file size can fit in a Lisp
+	integer. 
+
 2008-01-18  Jerry James  <james@xemacs.org>
 
 	* device-x.c (x_init_device): Don't write to path or read from
--- a/src/dired.c	Fri Jan 18 22:06:01 2008 -0500
+++ b/src/dired.c	Sat Jan 19 14:34:19 2008 +0100
@@ -824,7 +824,7 @@
   First integer has high-order 16 bits of time, second has low 16 bits.
  5. Last modification time, likewise.
  6. Last status change time, likewise.
- 7. Size in bytes. (-1, if number is out of range).
+ 7. Size in bytes. (-1, if number out of range and no bignum support.)
  8. File modes, as a string of ten letters or dashes as in ls -l.
  9. t iff file's gid would change if file were deleted and recreated.
 10. inode number.
@@ -900,11 +900,14 @@
   values[4] = make_time (s.st_atime);
   values[5] = make_time (s.st_mtime);
   values[6] = make_time (s.st_ctime);
-  values[7] = make_int ((EMACS_INT) s.st_size);
-  /* If the size is out of range, give back -1.  */
-  /* #### Fix when Emacs gets bignums! */
-  if (XINT (values[7]) != s.st_size)
-    values[7] = make_int (-1);
+
+#ifndef HAVE_BIGNUM
+  values[7] = make_integer (NUMBER_FITS_IN_AN_EMACS_INT (s.st_size) ? 
+                            (EMACS_INT)s.st_size : -1);
+#else
+  values[7] = make_integer (s.st_size);
+#endif 
+
   filemodestring (&s, modes);
   values[8] = make_string ((Ibyte *) modes, 10);
 #if defined (BSD4_2) || defined (BSD4_3)	/* file gid will be dir gid */