@@ -39,6 +39,7 @@ await Parallel.ForEachAsync(
3939 unsafe void ComputeSizeRecursively ( string path , CancellationToken token )
4040 {
4141 var queue = new Queue < string > ( ) ;
42+
4243 if ( ! Win32Helper . HasFileAttribute ( path , FileAttributes . Directory ) )
4344 {
4445 ComputeFileSize ( path ) ;
@@ -49,14 +50,14 @@ unsafe void ComputeSizeRecursively(string path, CancellationToken token)
4950
5051 while ( queue . TryDequeue ( out var directory ) )
5152 {
52- WIN32_FIND_DATAW * findData = default ;
53+ WIN32_FIND_DATAW findData = default ;
5354
5455 fixed ( char * pszFilePath = directory + "\\ *.*" )
5556 {
5657 var hFile = PInvoke . FindFirstFileEx (
5758 pszFilePath ,
5859 FINDEX_INFO_LEVELS . FindExInfoBasic ,
59- findData ,
60+ & findData ,
6061 FINDEX_SEARCH_OPS . FindExSearchNameMatch ,
6162 null ,
6263 FIND_FIRST_EX_FLAGS . FIND_FIRST_EX_LARGE_FETCH ) ;
@@ -65,19 +66,20 @@ unsafe void ComputeSizeRecursively(string path, CancellationToken token)
6566 {
6667 do
6768 {
68- FILE_FLAGS_AND_ATTRIBUTES attributes = ( FILE_FLAGS_AND_ATTRIBUTES ) findData -> dwFileAttributes ;
69+ FILE_FLAGS_AND_ATTRIBUTES attributes = ( FILE_FLAGS_AND_ATTRIBUTES ) findData . dwFileAttributes ;
6970
7071 if ( attributes . HasFlag ( FILE_FLAGS_AND_ATTRIBUTES . FILE_ATTRIBUTE_REPARSE_POINT ) )
7172 // Skip symbolic links and junctions
7273 continue ;
7374
74- var itemPath = Path . Combine ( directory , findData -> cFileName . ToString ( ) ) ;
75+ var itemPath = Path . Combine ( directory , findData . cFileName . ToString ( ) ) ;
7576
7677 if ( attributes . HasFlag ( FILE_FLAGS_AND_ATTRIBUTES . FILE_ATTRIBUTE_DIRECTORY ) )
7778 {
79+ // Recurse
7880 ComputeFileSize ( itemPath ) ;
7981 }
80- else if ( findData -> cFileName . ToString ( ) is string fileName &&
82+ else if ( findData . cFileName . ToString ( ) is string fileName &&
8183 fileName . Equals ( "." , StringComparison . OrdinalIgnoreCase ) &&
8284 fileName . Equals ( ".." , StringComparison . OrdinalIgnoreCase ) )
8385 {
@@ -87,7 +89,7 @@ unsafe void ComputeSizeRecursively(string path, CancellationToken token)
8789 if ( token . IsCancellationRequested )
8890 break ;
8991 }
90- while ( PInvoke . FindNextFile ( hFile , findData ) ) ;
92+ while ( PInvoke . FindNextFile ( hFile , & findData ) ) ;
9193 }
9294
9395 PInvoke . CloseHandle ( hFile ) ;
0 commit comments