From: Paul Eggert Date: Mon, 13 Jun 2011 06:34:04 +0000 (-0700) Subject: * dired.c (Ffile_attributes): Don't use 32-bit hack on 64-bit hosts. X-Git-Tag: emacs-pretest-24.0.90~104^2~548^2~25 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=83c77d31ace0a54f6e0c0c384648f172f837c27b;p=emacs.git * dired.c (Ffile_attributes): Don't use 32-bit hack on 64-bit hosts. --- diff --git a/src/ChangeLog b/src/ChangeLog index 9c7cf3cba9a..6562df06471 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-06-13 Paul Eggert + * dired.c (Ffile_attributes): Don't use 32-bit hack on 64-bit hosts. + * unexelf.c (unexec): Don't assume BSS addr fits in unsigned. * xterm.c (handle_one_xevent): Omit unnecessary casts to unsigned. diff --git a/src/dired.c b/src/dired.c index a95882060fb..3ab1ba8a900 100644 --- a/src/dired.c +++ b/src/dired.c @@ -978,11 +978,14 @@ so last access time will always be midnight of that day. */) values[4] = make_time (s.st_atime); values[5] = make_time (s.st_mtime); values[6] = make_time (s.st_ctime); - values[7] = make_fixnum_or_float (s.st_size); - /* If the size is negative, and its type is long, convert it back to - positive. */ - if (s.st_size < 0 && sizeof (s.st_size) == sizeof (long)) - values[7] = make_float ((double) ((unsigned long) s.st_size)); + + /* If the file size is a 4-byte type, assume that files of sizes in + the 2-4 GiB range wrap around to negative values, as this is a + common bug on older 32-bit platforms. */ + if (sizeof (s.st_size) == 4) + values[7] = make_fixnum_or_float (s.st_size & 0xffffffffu); + else + values[7] = make_fixnum_or_float (s.st_size); filemodestring (&s, modes); values[8] = make_string (modes, 10);