aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2007-01-12 15:55:49 +0000
committerEli Zaretskii2007-01-12 15:55:49 +0000
commitb55445d6ba80868770aa494773e5bb4df6a2564b (patch)
tree902b936f7ec8f98cccc9aa5fe6aa2eb20098442f /src
parent88f698d97c579308b5d247766e9344bcb0d2edea (diff)
downloademacs-b55445d6ba80868770aa494773e5bb4df6a2564b.tar.gz
emacs-b55445d6ba80868770aa494773e5bb4df6a2564b.zip
(Ffile_attributes): Copy some members of `struct stat' into int's to avoid
GCC warnings about limited range of short in arguments to FIXNUM_OVERFLOW_P.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/dired.c33
2 files changed, 27 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 77cf5b9cecd..0f511e9dbff 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12007-01-12 Eli Zaretskii <eliz@gnu.org>
2
3 * dired.c (Ffile_attributes): Copy some members of `struct stat'
4 into int's to avoid GCC warnings about limited range of short in
5 arguments to FIXNUM_OVERFLOW_P.
6
12007-01-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 72007-01-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 8
3 * macmenu.c (HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON. 9 * macmenu.c (HAVE_DIALOGS): Define if TARGET_API_MAC_CARBON.
diff --git a/src/dired.c b/src/dired.c
index 7b8f978b20c..adb452d12d5 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -930,6 +930,7 @@ Elements of the attribute list are:
930 char modes[10]; 930 char modes[10];
931 Lisp_Object handler; 931 Lisp_Object handler;
932 struct gcpro gcpro1; 932 struct gcpro gcpro1;
933 int uid, gid, ino;
933 934
934 filename = Fexpand_file_name (filename, Qnil); 935 filename = Fexpand_file_name (filename, Qnil);
935 936
@@ -964,20 +965,26 @@ Elements of the attribute list are:
964#endif 965#endif
965 } 966 }
966 values[1] = make_number (s.st_nlink); 967 values[1] = make_number (s.st_nlink);
968 /* When make_fixnum_or_float is called below with types that are
969 shorter than an int (e.g., `short'), GCC whines about comparison
970 being always false due to limited range of data type. Fix by
971 copying s.st_uid and s.st_gid into int variables. */
972 uid = s.st_uid;
973 gid = s.st_gid;
967 if (NILP (id_format) || EQ (id_format, Qinteger)) 974 if (NILP (id_format) || EQ (id_format, Qinteger))
968 { 975 {
969 values[2] = make_fixnum_or_float (s.st_uid); 976 values[2] = make_fixnum_or_float (uid);
970 values[3] = make_fixnum_or_float (s.st_gid); 977 values[3] = make_fixnum_or_float (gid);
971 } 978 }
972 else 979 else
973 { 980 {
974 BLOCK_INPUT; 981 BLOCK_INPUT;
975 pw = (struct passwd *) getpwuid (s.st_uid); 982 pw = (struct passwd *) getpwuid (uid);
976 values[2] = (pw ? build_string (pw->pw_name) 983 values[2] = (pw ? build_string (pw->pw_name)
977 : make_fixnum_or_float (s.st_uid)); 984 : make_fixnum_or_float (uid));
978 gr = (struct group *) getgrgid (s.st_gid); 985 gr = (struct group *) getgrgid (gid);
979 values[3] = (gr ? build_string (gr->gr_name) 986 values[3] = (gr ? build_string (gr->gr_name)
980 : make_fixnum_or_float (s.st_gid)); 987 : make_fixnum_or_float (gid));
981 UNBLOCK_INPUT; 988 UNBLOCK_INPUT;
982 } 989 }
983 values[4] = make_time (s.st_atime); 990 values[4] = make_time (s.st_atime);
@@ -999,20 +1006,22 @@ Elements of the attribute list are:
999 if (! NILP (dirname)) 1006 if (! NILP (dirname))
1000 encoded = ENCODE_FILE (dirname); 1007 encoded = ENCODE_FILE (dirname);
1001 if (! NILP (dirname) && stat (SDATA (encoded), &sdir) == 0) 1008 if (! NILP (dirname) && stat (SDATA (encoded), &sdir) == 0)
1002 values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil; 1009 values[9] = (sdir.st_gid != gid) ? Qt : Qnil;
1003 else /* if we can't tell, assume worst */ 1010 else /* if we can't tell, assume worst */
1004 values[9] = Qt; 1011 values[9] = Qt;
1005#else /* file gid will be egid */ 1012#else /* file gid will be egid */
1006 values[9] = (s.st_gid != getegid ()) ? Qt : Qnil; 1013 values[9] = (gid != getegid ()) ? Qt : Qnil;
1007#endif /* BSD4_2 (or BSD4_3) */ 1014#endif /* BSD4_2 (or BSD4_3) */
1008 if (FIXNUM_OVERFLOW_P (s.st_ino)) 1015 /* Shut up GCC warnings in FIXNUM_OVERFLOW_P below. */
1016 ino = s.st_ino;
1017 if (FIXNUM_OVERFLOW_P (ino))
1009 /* To allow inode numbers larger than VALBITS, separate the bottom 1018 /* To allow inode numbers larger than VALBITS, separate the bottom
1010 16 bits. */ 1019 16 bits. */
1011 values[10] = Fcons (make_number (s.st_ino >> 16), 1020 values[10] = Fcons (make_number (ino >> 16),
1012 make_number (s.st_ino & 0xffff)); 1021 make_number (ino & 0xffff));
1013 else 1022 else
1014 /* But keep the most common cases as integers. */ 1023 /* But keep the most common cases as integers. */
1015 values[10] = make_number (s.st_ino); 1024 values[10] = make_number (ino);
1016 1025
1017 /* Likewise for device. */ 1026 /* Likewise for device. */
1018 if (FIXNUM_OVERFLOW_P (s.st_dev)) 1027 if (FIXNUM_OVERFLOW_P (s.st_dev))