Patch 8.2.0888
Problem:    Readdirex() returns size -2 for a directory.
Solution:   Add missing "else". (Ken Takata, closes #6185)
Files:      src/fileio.c, src/testdir/test_functions.vim


*** ../vim-8.2.0887/src/fileio.c        2020-06-01 16:09:30.266292734 +0200
--- src/fileio.c        2020-06-02 22:17:31.702987181 +0200
***************
*** 4575,4581 ****
        if (S_ISDIR(st.st_mode))
            size = 0;
        // non-perfect check for overflow
!       if ((off_T)size != (off_T)st.st_size)
            size = -2;
        if (dict_add_number(item, "size", size) == FAIL)
            goto theend;
--- 4575,4581 ----
        if (S_ISDIR(st.st_mode))
            size = 0;
        // non-perfect check for overflow
!       else if ((off_T)size != (off_T)st.st_size)
            size = -2;
        if (dict_add_number(item, "size", size) == FAIL)
            goto theend;
*** ../vim-8.2.0887/src/testdir/test_functions.vim      2020-06-02 
21:38:18.719856309 +0200
--- src/testdir/test_functions.vim      2020-06-02 22:17:19.743031950 +0200
***************
*** 1864,1876 ****
  
  func Test_readdirex()
    call mkdir('Xdir')
!   call writefile([], 'Xdir/foo.txt')
!   call writefile([], 'Xdir/bar.txt')
    call mkdir('Xdir/dir')
  
    " All results
    let files = readdirex('Xdir')->map({-> v:val.name})
    call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files))
  
    " Only results containing "f"
    let files = 'Xdir'->readdirex({ e -> stridx(e.name, 'f') != -1 })
--- 1864,1878 ----
  
  func Test_readdirex()
    call mkdir('Xdir')
!   call writefile(['foo'], 'Xdir/foo.txt')
!   call writefile(['barbar'], 'Xdir/bar.txt')
    call mkdir('Xdir/dir')
  
    " All results
    let files = readdirex('Xdir')->map({-> v:val.name})
    call assert_equal(['bar.txt', 'dir', 'foo.txt'], sort(files))
+   let sizes = readdirex('Xdir')->map({-> v:val.size})
+   call assert_equal([0, 4, 7], sort(sizes))
  
    " Only results containing "f"
    let files = 'Xdir'->readdirex({ e -> stridx(e.name, 'f') != -1 })
*** ../vim-8.2.0887/src/version.c       2020-06-02 22:06:16.785668534 +0200
--- src/version.c       2020-06-02 22:18:56.126672727 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     888,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
260. Co-workers have to E-mail you about the fire alarm to get
     you out of the building.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202006022020.052KK9cu320521%40masaka.moolenaar.net.

Raspunde prin e-mail lui