svn path=/trunk/mono/; revision=146705
authorMiguel de Icaza <miguel@gnome.org>
Mon, 23 Nov 2009 06:50:57 +0000 (06:50 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Mon, 23 Nov 2009 06:50:57 +0000 (06:50 -0000)
mono/metadata/ChangeLog
mono/metadata/file-io.c
mono/metadata/file-io.h

index 55d1b619c8708b954c3d935e6d59d55e9c963589..52e32b4dab7f30baeed2c4e99b80b4e4a6fa5c21 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-23  Miguel de Icaza  <miguel@novell.com>
+
+       * file-io.c: Change FindFirst/FindNext/FindClose API to return the
+       file attribute to managed code and avoid doing the mask/attribute
+       checks here. 
+
 2009-11-22  Miguel de Icaza  <miguel@novell.com>
 
        * file-io.c: Surface a smart FindFirst/FindNext/FindClose API to
index e6ea9e55aa2f541ff812ac273f8b61c9c72e56a3..ff67e997f05b4b633775601e9450477a4091854f 100644 (file)
@@ -387,7 +387,6 @@ ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
 
 typedef struct {
        MonoDomain *domain;
-       gint attrs, mask;
        gchar *utf8_path;
        HANDLE find_handle;
 } IncrementalFind;
@@ -401,9 +400,6 @@ incremental_find_check_match (IncrementalFind *handle, WIN32_FIND_DATA *data, Mo
        if ((data->cFileName[0] == '.' && data->cFileName[1] == 0) || (data->cFileName[0] == '.' && data->cFileName[1] == '.' && data->cFileName[2] == 0))
                return FALSE;
 
-       if ((data->dwFileAttributes & handle->mask) != handle->attrs)
-               return FALSE;
-       
        utf8_result = g_utf16_to_utf8 (data->cFileName, -1, NULL, NULL, NULL);
        if (utf8_result == NULL) 
                return FALSE;
@@ -419,8 +415,7 @@ incremental_find_check_match (IncrementalFind *handle, WIN32_FIND_DATA *data, Mo
 MonoString *
 ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
                                      MonoString *path_with_pattern,
-                                     gint attrs, gint mask,
-                                     gint32 *error,
+                                     gint32 *result_attr, gint32 *error,
                                      gpointer *handle)
 {
        WIN32_FIND_DATA data;
@@ -429,7 +424,6 @@ ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
        MonoString *result;
        
        *error = ERROR_SUCCESS;
-       mask = convert_attrs (mask);
        
        find_handle = FindFirstFile (mono_string_chars (path_with_pattern), &data);
        
@@ -446,8 +440,6 @@ ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
 
        ifh = g_new (IncrementalFind, 1);
        ifh->find_handle = find_handle;
-       ifh->mask = mask;
-       ifh->attrs = attrs;
        ifh->utf8_path = mono_string_to_utf8 (path);
        ifh->domain = mono_domain_get ();
        *handle = ifh;
@@ -460,12 +452,13 @@ ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
                        return NULL;
                }
        }
-
+       *result_attr = data.dwFileAttributes;
+       
        return result;
 }
 
 MonoString *
-ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *error)
+ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_attr, gint32 *error)
 {
        IncrementalFind *ifh = handle;
        WIN32_FIND_DATA data;
@@ -481,6 +474,7 @@ ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *error)
                }
        } while (incremental_find_check_match (ifh, &data, &result) == 0);
 
+       *result_attr = data.dwFileAttributes;
        return result;
 }
 
index e483e69b17fa441450dcaa90f5daed3f0f573786..1ad78f60c363fc97d0ccda24312011b20abcf2ab 100644 (file)
@@ -128,11 +128,11 @@ ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
 extern MonoString *
 ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
                                      MonoString *path_with_pattern,
-                                     gint attrs, gint mask,
+                                     gint32 *result_mask,
                                      gint32 *error,
                                      gpointer *handle) MONO_INTERNAL;
 extern MonoString *
-ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error) MONO_INTERNAL;
 
 extern int
 ves_icall_System_IO_MonoIO_FindClose (gpointer handle) MONO_INTERNAL;