[w32file] Remove dead code
authorLudovic Henry <ludovic@xamarin.com>
Wed, 27 Sep 2017 15:35:36 +0000 (11:35 -0400)
committerMarek Safar <marek.safar@gmail.com>
Fri, 29 Sep 2017 09:24:22 +0000 (11:24 +0200)
mcs/class/corlib/System.IO/MonoIO.cs
mono/metadata/icall-def.h
mono/metadata/w32file.c
mono/metadata/w32file.h

index 0dac31494ba7938f586301104382f31e55e721d8..7542dabe9cb20830a63f83c24d4edaad93bd73b8 100644 (file)
@@ -174,9 +174,6 @@ namespace System.IO
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                public extern static bool RemoveDirectory (string path, out MonoIOError error);
 
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static string [] GetFileSystemEntries (string path, string path_with_pattern, int attrs, int mask, out MonoIOError error);
-
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                public extern static string GetCurrentDirectory (out MonoIOError error);
 
index 47fbefe2cda02b7ebb2a3794a02be0e393c5e3ae..68913ad8ec5bdea2e460c98a827379637eaec9bf 100644 (file)
@@ -375,7 +375,6 @@ ICALL(MONOIO_6, "Flush(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_Mono
 ICALL(MONOIO_7, "GetCurrentDirectory(System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetCurrentDirectory)
 ICALL(MONOIO_8, "GetFileAttributes(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileAttributes)
 ICALL(MONOIO_9, "GetFileStat(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileStat)
-ICALL(MONOIO_10, "GetFileSystemEntries", ves_icall_System_IO_MonoIO_GetFileSystemEntries)
 ICALL(MONOIO_11, "GetFileType(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType)
 ICALL(MONOIO_12, "GetLength(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength)
 #ifndef PLATFORM_RO_FS
index 325767f52434e9fbcb91aa60963c18d518354651..630278f1b26841232678a578f038006f8d96ff96 100644 (file)
@@ -285,137 +285,6 @@ ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error)
        return(ret);
 }
 
-static gchar *
-get_search_dir (const gunichar2 *pattern)
-{
-       gchar *p;
-       gchar *result;
-
-       p = g_utf16_to_utf8 (pattern, -1, NULL, NULL, NULL);
-       result = g_path_get_dirname (p);
-       g_free (p);
-       return result;
-}
-
-static GPtrArray *
-get_filesystem_entries (const gunichar2 *path,
-                                                const gunichar2 *path_with_pattern,
-                                                gint attrs, gint mask,
-                                                gint32 *error)
-{
-       int i;
-       WIN32_FIND_DATA data;
-       HANDLE find_handle;
-       GPtrArray *names = NULL;
-       gchar *utf8_path = NULL, *utf8_result, *full_name;
-       gint32 attributes;
-
-       mask = convert_attrs ((MonoFileAttributes)mask);
-       attributes = get_file_attributes (path);
-       if (attributes != -1) {
-               if ((attributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
-                       *error = ERROR_INVALID_NAME;
-                       goto fail;
-               }
-       } else {
-               *error = mono_w32error_get_last ();
-               goto fail;
-       }
-       
-       find_handle = mono_w32file_find_first (path_with_pattern, &data);
-       if (find_handle == INVALID_HANDLE_VALUE) {
-               gint32 find_error = mono_w32error_get_last ();
-               
-               if (find_error == ERROR_FILE_NOT_FOUND || find_error == ERROR_NO_MORE_FILES) {
-                       /* No files, so just return an empty array */
-                       goto fail;
-               }
-               
-               *error = find_error;
-               goto fail;
-       }
-
-       utf8_path = get_search_dir (path_with_pattern);
-       names = g_ptr_array_new ();
-
-       do {
-               if ((data.cFileName[0] == '.' && data.cFileName[1] == 0) ||
-                   (data.cFileName[0] == '.' && data.cFileName[1] == '.' && data.cFileName[2] == 0)) {
-                       continue;
-               }
-               
-               if ((data.dwFileAttributes & mask) == attrs) {
-                       utf8_result = g_utf16_to_utf8 (data.cFileName, -1, NULL, NULL, NULL);
-                       if (utf8_result == NULL) {
-                               continue;
-                       }
-                       
-                       full_name = g_build_filename (utf8_path, utf8_result, NULL);
-                       g_ptr_array_add (names, full_name);
-
-                       g_free (utf8_result);
-               }
-       } while(mono_w32file_find_next (find_handle, &data));
-
-       if (mono_w32file_find_close (find_handle) == FALSE) {
-               *error = mono_w32error_get_last ();
-               goto fail;
-       }
-
-       g_free (utf8_path);
-       return names;
-fail:
-       if (names) {
-               for (i = 0; i < names->len; i++)
-                       g_free (g_ptr_array_index (names, i));
-               g_ptr_array_free (names, TRUE);
-       }
-       g_free (utf8_path);
-       return FALSE;
-}
-
-
-MonoArray *
-ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
-                                                MonoString *path_with_pattern,
-                                                gint attrs, gint mask,
-                                                gint32 *ioerror)
-{
-       MonoError error;
-       MonoDomain *domain = mono_domain_get ();
-       MonoArray *result;
-       int i;
-       GPtrArray *names;
-       
-       *ioerror = ERROR_SUCCESS;
-
-       names = get_filesystem_entries (mono_string_chars (path), mono_string_chars (path_with_pattern), attrs, mask, ioerror);
-
-       if (!names) {
-               // If there's no array and no error, then return an empty array.
-               if (*ioerror == ERROR_SUCCESS) {
-                       MonoArray *arr = mono_array_new_checked (domain, mono_defaults.string_class, 0, &error);
-                       mono_error_set_pending_exception (&error);
-                       return arr;
-               }
-               return NULL;
-       }
-
-       result = mono_array_new_checked (domain, mono_defaults.string_class, names->len, &error);
-       if (mono_error_set_pending_exception (&error))
-               goto leave;
-       for (i = 0; i < names->len; i++) {
-               MonoString *name = mono_string_new_checked (domain, (const char *)g_ptr_array_index (names, i), &error);
-               if (mono_error_set_pending_exception (&error))
-                       goto leave;
-               mono_array_setref (result, i, name);
-               g_free (g_ptr_array_index (names, i));
-       }
-leave:
-       g_ptr_array_free (names, TRUE);
-       return result;
-}
-
 typedef struct {
        MonoDomain *domain;
        gchar *utf8_path;
index 65afdb31d786f01475530e1d15ed21ff2c069feb..3604e684917905ebb919f6471ebef298471c4cb2 100644 (file)
@@ -120,12 +120,6 @@ ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error);
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error);
 
-MonoArray *
-ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
-                                                MonoString *path_with_pattern,
-                                                gint mask, gint attrs,
-                                                gint32 *error);
-
 extern gpointer
 ves_icall_System_IO_MonoIO_FindFirstFile (MonoString *path_with_pattern,
                                                MonoString **file_name,