diff options
Diffstat (limited to 'src/dired.c')
| -rw-r--r-- | src/dired.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/dired.c b/src/dired.c index be94b16cf75..d1b4d410428 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -86,7 +86,7 @@ static Lisp_Object Qfile_name_all_completions; | |||
| 86 | static Lisp_Object Qfile_attributes; | 86 | static Lisp_Object Qfile_attributes; |
| 87 | static Lisp_Object Qfile_attributes_lessp; | 87 | static Lisp_Object Qfile_attributes_lessp; |
| 88 | 88 | ||
| 89 | static int scmp (const char *, const char *, int); | 89 | static ptrdiff_t scmp (const char *, const char *, ptrdiff_t); |
| 90 | static Lisp_Object Ffile_attributes (Lisp_Object, Lisp_Object); | 90 | static Lisp_Object Ffile_attributes (Lisp_Object, Lisp_Object); |
| 91 | 91 | ||
| 92 | #ifdef WINDOWSNT | 92 | #ifdef WINDOWSNT |
| @@ -117,11 +117,11 @@ Lisp_Object | |||
| 117 | directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format) | 117 | directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format) |
| 118 | { | 118 | { |
| 119 | DIR *d; | 119 | DIR *d; |
| 120 | int directory_nbytes; | 120 | ptrdiff_t directory_nbytes; |
| 121 | Lisp_Object list, dirfilename, encoded_directory; | 121 | Lisp_Object list, dirfilename, encoded_directory; |
| 122 | struct re_pattern_buffer *bufp = NULL; | 122 | struct re_pattern_buffer *bufp = NULL; |
| 123 | int needsep = 0; | 123 | int needsep = 0; |
| 124 | int count = SPECPDL_INDEX (); | 124 | ptrdiff_t count = SPECPDL_INDEX (); |
| 125 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 125 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 126 | DIRENTRY *dp; | 126 | DIRENTRY *dp; |
| 127 | #ifdef WINDOWSNT | 127 | #ifdef WINDOWSNT |
| @@ -226,7 +226,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m | |||
| 226 | 226 | ||
| 227 | if (DIRENTRY_NONEMPTY (dp)) | 227 | if (DIRENTRY_NONEMPTY (dp)) |
| 228 | { | 228 | { |
| 229 | int len; | 229 | ptrdiff_t len; |
| 230 | int wanted = 0; | 230 | int wanted = 0; |
| 231 | Lisp_Object name, finalname; | 231 | Lisp_Object name, finalname; |
| 232 | struct gcpro inner_gcpro1, inner_gcpro2; | 232 | struct gcpro inner_gcpro1, inner_gcpro2; |
| @@ -256,8 +256,8 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m | |||
| 256 | if (!NILP (full)) | 256 | if (!NILP (full)) |
| 257 | { | 257 | { |
| 258 | Lisp_Object fullname; | 258 | Lisp_Object fullname; |
| 259 | int nbytes = len + directory_nbytes + needsep; | 259 | ptrdiff_t nbytes = len + directory_nbytes + needsep; |
| 260 | int nchars; | 260 | ptrdiff_t nchars; |
| 261 | 261 | ||
| 262 | fullname = make_uninit_multibyte_string (nbytes, nbytes); | 262 | fullname = make_uninit_multibyte_string (nbytes, nbytes); |
| 263 | memcpy (SDATA (fullname), SDATA (directory), | 263 | memcpy (SDATA (fullname), SDATA (directory), |
| @@ -447,7 +447,7 @@ static Lisp_Object | |||
| 447 | file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate) | 447 | file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate) |
| 448 | { | 448 | { |
| 449 | DIR *d; | 449 | DIR *d; |
| 450 | int bestmatchsize = 0; | 450 | ptrdiff_t bestmatchsize = 0; |
| 451 | int matchcount = 0; | 451 | int matchcount = 0; |
| 452 | /* If ALL_FLAG is 1, BESTMATCH is the list of all matches, decoded. | 452 | /* If ALL_FLAG is 1, BESTMATCH is the list of all matches, decoded. |
| 453 | If ALL_FLAG is 0, BESTMATCH is either nil | 453 | If ALL_FLAG is 0, BESTMATCH is either nil |
| @@ -461,7 +461,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 461 | well as "." and "..". Until shown otherwise, assume we can't exclude | 461 | well as "." and "..". Until shown otherwise, assume we can't exclude |
| 462 | anything. */ | 462 | anything. */ |
| 463 | int includeall = 1; | 463 | int includeall = 1; |
| 464 | int count = SPECPDL_INDEX (); | 464 | ptrdiff_t count = SPECPDL_INDEX (); |
| 465 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 465 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 466 | 466 | ||
| 467 | elt = Qnil; | 467 | elt = Qnil; |
| @@ -501,7 +501,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 501 | while (1) | 501 | while (1) |
| 502 | { | 502 | { |
| 503 | DIRENTRY *dp; | 503 | DIRENTRY *dp; |
| 504 | int len; | 504 | ptrdiff_t len; |
| 505 | int canexclude = 0; | 505 | int canexclude = 0; |
| 506 | 506 | ||
| 507 | errno = 0; | 507 | errno = 0; |
| @@ -537,7 +537,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 537 | completions when making a list of them. */ | 537 | completions when making a list of them. */ |
| 538 | if (!all_flag) | 538 | if (!all_flag) |
| 539 | { | 539 | { |
| 540 | int skip; | 540 | ptrdiff_t skip; |
| 541 | 541 | ||
| 542 | #if 0 /* FIXME: The `scmp' call compares an encoded and a decoded string. */ | 542 | #if 0 /* FIXME: The `scmp' call compares an encoded and a decoded string. */ |
| 543 | /* If this entry matches the current bestmatch, the only | 543 | /* If this entry matches the current bestmatch, the only |
| @@ -567,7 +567,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 567 | for (tem = Vcompletion_ignored_extensions; | 567 | for (tem = Vcompletion_ignored_extensions; |
| 568 | CONSP (tem); tem = XCDR (tem)) | 568 | CONSP (tem); tem = XCDR (tem)) |
| 569 | { | 569 | { |
| 570 | int elt_len; | 570 | ptrdiff_t elt_len; |
| 571 | char *p1; | 571 | char *p1; |
| 572 | 572 | ||
| 573 | elt = XCAR (tem); | 573 | elt = XCAR (tem); |
| @@ -684,7 +684,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 684 | 684 | ||
| 685 | /* Suitably record this match. */ | 685 | /* Suitably record this match. */ |
| 686 | 686 | ||
| 687 | matchcount++; | 687 | matchcount += matchcount <= 1; |
| 688 | 688 | ||
| 689 | if (all_flag) | 689 | if (all_flag) |
| 690 | bestmatch = Fcons (name, bestmatch); | 690 | bestmatch = Fcons (name, bestmatch); |
| @@ -697,14 +697,14 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 697 | { | 697 | { |
| 698 | Lisp_Object zero = make_number (0); | 698 | Lisp_Object zero = make_number (0); |
| 699 | /* FIXME: This is a copy of the code in Ftry_completion. */ | 699 | /* FIXME: This is a copy of the code in Ftry_completion. */ |
| 700 | int compare = min (bestmatchsize, SCHARS (name)); | 700 | ptrdiff_t compare = min (bestmatchsize, SCHARS (name)); |
| 701 | Lisp_Object cmp | 701 | Lisp_Object cmp |
| 702 | = Fcompare_strings (bestmatch, zero, | 702 | = Fcompare_strings (bestmatch, zero, |
| 703 | make_number (compare), | 703 | make_number (compare), |
| 704 | name, zero, | 704 | name, zero, |
| 705 | make_number (compare), | 705 | make_number (compare), |
| 706 | completion_ignore_case ? Qt : Qnil); | 706 | completion_ignore_case ? Qt : Qnil); |
| 707 | int matchsize | 707 | ptrdiff_t matchsize |
| 708 | = (EQ (cmp, Qt) ? compare | 708 | = (EQ (cmp, Qt) ? compare |
| 709 | : XINT (cmp) < 0 ? - XINT (cmp) - 1 | 709 | : XINT (cmp) < 0 ? - XINT (cmp) - 1 |
| 710 | : XINT (cmp) - 1); | 710 | : XINT (cmp) - 1); |
| @@ -783,10 +783,10 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 783 | Return -1 if strings match, | 783 | Return -1 if strings match, |
| 784 | else number of chars that match at the beginning. */ | 784 | else number of chars that match at the beginning. */ |
| 785 | 785 | ||
| 786 | static int | 786 | static ptrdiff_t |
| 787 | scmp (const char *s1, const char *s2, int len) | 787 | scmp (const char *s1, const char *s2, ptrdiff_t len) |
| 788 | { | 788 | { |
| 789 | register int l = len; | 789 | register ptrdiff_t l = len; |
| 790 | 790 | ||
| 791 | if (completion_ignore_case) | 791 | if (completion_ignore_case) |
| 792 | { | 792 | { |
| @@ -809,10 +809,12 @@ scmp (const char *s1, const char *s2, int len) | |||
| 809 | static int | 809 | static int |
| 810 | file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr) | 810 | file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr) |
| 811 | { | 811 | { |
| 812 | int len = NAMLEN (dp); | 812 | ptrdiff_t len = NAMLEN (dp); |
| 813 | int pos = SCHARS (dirname); | 813 | ptrdiff_t pos = SCHARS (dirname); |
| 814 | int value; | 814 | int value; |
| 815 | char *fullname = (char *) alloca (len + pos + 2); | 815 | char *fullname; |
| 816 | USE_SAFE_ALLOCA; | ||
| 817 | SAFE_ALLOCA (fullname, char *, len + pos + 2); | ||
| 816 | 818 | ||
| 817 | #ifdef MSDOS | 819 | #ifdef MSDOS |
| 818 | /* Some fields of struct stat are *very* expensive to compute on MS-DOS, | 820 | /* Some fields of struct stat are *very* expensive to compute on MS-DOS, |
| @@ -841,6 +843,7 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad | |||
| 841 | #ifdef MSDOS | 843 | #ifdef MSDOS |
| 842 | _djstat_flags = save_djstat_flags; | 844 | _djstat_flags = save_djstat_flags; |
| 843 | #endif /* MSDOS */ | 845 | #endif /* MSDOS */ |
| 846 | SAFE_FREE (); | ||
| 844 | return value; | 847 | return value; |
| 845 | } | 848 | } |
| 846 | 849 | ||