diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dired.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/dired.c b/src/dired.c index 36324519fff..2e11259eef1 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -919,8 +919,10 @@ Elements of the attribute list are: | |||
| 919 | 8. File modes, as a string of ten letters or dashes as in ls -l. | 919 | 8. File modes, as a string of ten letters or dashes as in ls -l. |
| 920 | 9. t if file's gid would change if file were deleted and recreated. | 920 | 9. t if file's gid would change if file were deleted and recreated. |
| 921 | 10. inode number. If inode number is larger than the Emacs integer, | 921 | 10. inode number. If inode number is larger than the Emacs integer, |
| 922 | this is a cons cell containing two integers: first the high part, | 922 | but still fits into a 32-bit number, this is a cons cell containing two |
| 923 | then the low 16 bits. | 923 | integers: first the high part, then the low 16 bits. If the inode number |
| 924 | is wider than 32 bits, this is a cons cell containing three integers: | ||
| 925 | first the high 24 bits, then middle 24 bits, and finally the low 16 bits. | ||
| 924 | 11. Device number. If it is larger than the Emacs integer, this is | 926 | 11. Device number. If it is larger than the Emacs integer, this is |
| 925 | a cons cell, similar to the inode number. */) | 927 | a cons cell, similar to the inode number. */) |
| 926 | (filename, id_format) | 928 | (filename, id_format) |
| @@ -1021,25 +1023,32 @@ Elements of the attribute list are: | |||
| 1021 | values[9] = (gid != getegid ()) ? Qt : Qnil; | 1023 | values[9] = (gid != getegid ()) ? Qt : Qnil; |
| 1022 | #endif /* BSD4_2 (or BSD4_3) */ | 1024 | #endif /* BSD4_2 (or BSD4_3) */ |
| 1023 | /* Shut up GCC warnings in FIXNUM_OVERFLOW_P below. */ | 1025 | /* Shut up GCC warnings in FIXNUM_OVERFLOW_P below. */ |
| 1024 | #ifdef WINDOWSNT | 1026 | if (sizeof (s.st_ino) > sizeof (ino)) |
| 1025 | { | 1027 | ino = (EMACS_INT)(s.st_ino & 0xffffffff); |
| 1026 | /* The bit-shuffling we do in w32.c:stat can turn on the MSB, which | 1028 | else |
| 1027 | will produce negative inode numbers. People don't like that, so | 1029 | ino = s.st_ino; |
| 1028 | force a positive inode instead. */ | 1030 | if (!FIXNUM_OVERFLOW_P (ino) |
| 1029 | unsigned short tem = s.st_ino; | 1031 | && (sizeof (s.st_ino) <= sizeof (ino) || (s.st_ino & ~INTMASK) == 0)) |
| 1030 | ino = tem; | 1032 | /* Keep the most common cases as integers. */ |
| 1031 | } | 1033 | values[10] = make_number (ino); |
| 1032 | #else | 1034 | else if (sizeof (s.st_ino) <= sizeof (ino) |
| 1033 | ino = s.st_ino; | 1035 | || ((s.st_ino >> 16) & ~INTMASK) == 0) |
| 1034 | #endif | ||
| 1035 | if (FIXNUM_OVERFLOW_P (ino)) | ||
| 1036 | /* To allow inode numbers larger than VALBITS, separate the bottom | 1036 | /* To allow inode numbers larger than VALBITS, separate the bottom |
| 1037 | 16 bits. */ | 1037 | 16 bits. */ |
| 1038 | values[10] = Fcons (make_number (ino >> 16), | 1038 | values[10] = Fcons (make_number ((EMACS_INT)(s.st_ino >> 16)), |
| 1039 | make_number (ino & 0xffff)); | 1039 | make_number ((EMACS_INT)(s.st_ino & 0xffff))); |
| 1040 | else | 1040 | else |
| 1041 | /* But keep the most common cases as integers. */ | 1041 | { |
| 1042 | values[10] = make_number (ino); | 1042 | /* To allow inode numbers beyond 32 bits, separate into 2 24-bit |
| 1043 | high parts and a 16-bit bottom part. */ | ||
| 1044 | EMACS_INT high_ino = s.st_ino >> 32; | ||
| 1045 | EMACS_INT low_ino = s.st_ino & 0xffffffff; | ||
| 1046 | |||
| 1047 | values[10] = Fcons (make_number (high_ino >> 8), | ||
| 1048 | Fcons (make_number (((high_ino & 0xff) << 16) | ||
| 1049 | + (low_ino >> 16)), | ||
| 1050 | make_number (low_ino & 0xffff))); | ||
| 1051 | } | ||
| 1043 | 1052 | ||
| 1044 | /* Likewise for device. */ | 1053 | /* Likewise for device. */ |
| 1045 | if (FIXNUM_OVERFLOW_P (s.st_dev)) | 1054 | if (FIXNUM_OVERFLOW_P (s.st_dev)) |