Author: dick
Date: 2007-04-16 13:02:21 -0400 (Mon, 16 Apr 2007)
New Revision: 75778
Modified:
trunk/mono/mono/io-layer/ChangeLog
trunk/mono/mono/io-layer/Makefile.am
trunk/mono/mono/io-layer/io-portability.c
trunk/mono/mono/io-layer/io-portability.h
trunk/mono/mono/io-layer/io.c
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/file-io.c
trunk/mono/mono/metadata/file-io.h
Log:
Revert this while I figure out why monodevelop breaks
Modified: trunk/mono/mono/io-layer/ChangeLog
===================================================================
--- trunk/mono/mono/io-layer/ChangeLog 2007-04-16 17:02:22 UTC (rev 75777)
+++ trunk/mono/mono/io-layer/ChangeLog 2007-04-16 17:02:21 UTC (rev 75778)
@@ -14,17 +14,6 @@
* wapi_glob.c: remove reference to sys/cdefs.h, use glib instead.
Fixes: 81326
-2007-04-05 Dick Porter <[EMAIL PROTECTED]>
-
- * io.c:
- * io-portability.c (_wapi_io_scandir): Moved from io.c, and
- changed to use a cut-down version of glob(3) that has been
- extended to match with case-insensitivity if needed.
-
- * wapi_glob.h:
- * wapi_glob.c: Cut down implementation of glob(3), based on
- OpenBSD.
-
2007-03-22 Dick Porter <[EMAIL PROTECTED]>
* sockets.c (_wapi_connect): Do additional checks when connect(2)
Modified: trunk/mono/mono/io-layer/Makefile.am
===================================================================
--- trunk/mono/mono/io-layer/Makefile.am 2007-04-16 17:02:22 UTC (rev
75777)
+++ trunk/mono/mono/io-layer/Makefile.am 2007-04-16 17:02:21 UTC (rev
75778)
@@ -98,8 +98,6 @@
versioninfo.h \
wait.c \
wait.h \
- wapi_glob.h \
- wapi_glob.c \
wapi.h \
wapi-private.h
Modified: trunk/mono/mono/io-layer/io-portability.c
===================================================================
--- trunk/mono/mono/io-layer/io-portability.c 2007-04-16 17:02:22 UTC (rev
75777)
+++ trunk/mono/mono/io-layer/io-portability.c 2007-04-16 17:02:21 UTC (rev
75778)
@@ -23,8 +23,6 @@
#include <sys/stat.h>
#include <mono/io-layer/mono-mutex.h>
-#include <mono/io-layer/error.h>
-#include <mono/io-layer/wapi_glob.h>
#include <mono/io-layer/io-portability.h>
#undef DEBUG
@@ -684,187 +682,3 @@
return(ret);
}
-
-
-static gint
-file_compare (gconstpointer a, gconstpointer b)
-{
- gchar *astr = *(gchar **) a;
- gchar *bstr = *(gchar **) b;
-
- return strcmp (astr, bstr);
-}
-
-static gint
-get_errno_from_g_file_error (gint error)
-{
- switch (error) {
-#ifdef EACCESS
- case G_FILE_ERROR_ACCES:
- error = EACCES;
- break;
-#endif
-#ifdef ENAMETOOLONG
- case G_FILE_ERROR_NAMETOOLONG:
- error = ENAMETOOLONG;
- break;
-#endif
-#ifdef ENOENT
- case G_FILE_ERROR_NOENT:
- error = ENOENT;
- break;
-#endif
-#ifdef ENOTDIR
- case G_FILE_ERROR_NOTDIR:
- error = ENOTDIR;
- break;
-#endif
-#ifdef ENXIO
- case G_FILE_ERROR_NXIO:
- error = ENXIO;
- break;
-#endif
-#ifdef ENODEV
- case G_FILE_ERROR_NODEV:
- error = ENODEV;
- break;
-#endif
-#ifdef EROFS
- case G_FILE_ERROR_ROFS:
- error = EROFS;
- break;
-#endif
-#ifdef ETXTBSY
- case G_FILE_ERROR_TXTBSY:
- error = ETXTBSY;
- break;
-#endif
-#ifdef EFAULT
- case G_FILE_ERROR_FAULT:
- error = EFAULT;
- break;
-#endif
-#ifdef ELOOP
- case G_FILE_ERROR_LOOP:
- error = ELOOP;
- break;
-#endif
-#ifdef ENOSPC
- case G_FILE_ERROR_NOSPC:
- error = ENOSPC;
- break;
-#endif
-#ifdef ENOMEM
- case G_FILE_ERROR_NOMEM:
- error = ENOMEM;
- break;
-#endif
-#ifdef EMFILE
- case G_FILE_ERROR_MFILE:
- error = EMFILE;
- break;
-#endif
-#ifdef ENFILE
- case G_FILE_ERROR_NFILE:
- error = ENFILE;
- break;
-#endif
-#ifdef EBADF
- case G_FILE_ERROR_BADF:
- error = EBADF;
- break;
-#endif
-#ifdef EINVAL
- case G_FILE_ERROR_INVAL:
- error = EINVAL;
- break;
-#endif
-#ifdef EPIPE
- case G_FILE_ERROR_PIPE:
- error = EPIPE;
- break;
-#endif
-#ifdef EAGAIN
- case G_FILE_ERROR_AGAIN:
- error = EAGAIN;
- break;
-#endif
-#ifdef EINTR
- case G_FILE_ERROR_INTR:
- error = EINTR;
- break;
-#endif
-#ifdef EWIO
- case G_FILE_ERROR_IO:
- error = EIO;
- break;
-#endif
-#ifdef EPERM
- case G_FILE_ERROR_PERM:
- error = EPERM;
- break;
-#endif
- case G_FILE_ERROR_FAILED:
- error = ERROR_INVALID_PARAMETER;
- break;
- }
-
- return error;
-}
-
-/* scandir using glib */
-gint _wapi_io_scandir (const gchar *dirname, const gchar *pattern,
- gchar ***namelist)
-{
- GError *error = NULL;
- GDir *dir;
- GPtrArray *names;
- gint result;
- wapi_glob_t glob_buf;
- int flags = 0, i;
-
- dir = _wapi_g_dir_open (dirname, 0, &error);
- if (dir == NULL) {
- /* g_dir_open returns ENOENT on directories on which we don't
- * have read/x permission */
- gint errnum = get_errno_from_g_file_error (error->code);
- g_error_free (error);
- if (errnum == ENOENT &&
- !_wapi_access (dirname, F_OK) &&
- _wapi_access (dirname, R_OK|X_OK)) {
- errnum = EACCES;
- }
-
- errno = errnum;
- return -1;
- }
-
- if (portability_helpers & PORTABILITY_CASE) {
- flags = WAPI_GLOB_IGNORECASE;
- }
-
- result = _wapi_glob (dir, pattern, flags, &glob_buf);
- g_dir_close (dir);
- if (result == WAPI_GLOB_NOMATCH) {
- return(0);
- } else if (result != 0) {
- return(-1);
- }
-
- names = g_ptr_array_new ();
- for (i = 0; i < glob_buf.gl_pathc; i++) {
- g_ptr_array_add (names, g_strdup (glob_buf.gl_pathv[i]));
- }
-
- result = names->len;
- if (result > 0) {
- g_ptr_array_sort (names, file_compare);
- g_ptr_array_set_size (names, result + 1);
-
- *namelist = (gchar **) g_ptr_array_free (names, FALSE);
- } else {
- g_ptr_array_free (names, TRUE);
- }
-
- return result;
-}
Modified: trunk/mono/mono/io-layer/io-portability.h
===================================================================
--- trunk/mono/mono/io-layer/io-portability.h 2007-04-16 17:02:22 UTC (rev
75777)
+++ trunk/mono/mono/io-layer/io-portability.h 2007-04-16 17:02:21 UTC (rev
75778)
@@ -33,8 +33,6 @@
extern gchar *_wapi_basename (const gchar *filename);
extern gchar *_wapi_dirname (const gchar *filename);
extern GDir *_wapi_g_dir_open (const gchar *path, guint flags, GError **error);
-extern gint _wapi_io_scandir (const gchar *dirname, const gchar *pattern,
- gchar ***namelist);
G_END_DECLS
Modified: trunk/mono/mono/io-layer/io.c
===================================================================
--- trunk/mono/mono/io-layer/io.c 2007-04-16 17:02:22 UTC (rev 75777)
+++ trunk/mono/mono/io-layer/io.c 2007-04-16 17:02:21 UTC (rev 75778)
@@ -2610,6 +2610,181 @@
return(TRUE);
}
+static gint
+file_compare (gconstpointer a, gconstpointer b)
+{
+ gchar *astr = *(gchar **) a;
+ gchar *bstr = *(gchar **) b;
+
+ return strcmp (astr, bstr);
+}
+
+static gint
+get_errno_from_g_file_error (gint error)
+{
+ switch (error) {
+#ifdef EACCESS
+ case G_FILE_ERROR_ACCES:
+ error = EACCES;
+ break;
+#endif
+#ifdef ENAMETOOLONG
+ case G_FILE_ERROR_NAMETOOLONG:
+ error = ENAMETOOLONG;
+ break;
+#endif
+#ifdef ENOENT
+ case G_FILE_ERROR_NOENT:
+ error = ENOENT;
+ break;
+#endif
+#ifdef ENOTDIR
+ case G_FILE_ERROR_NOTDIR:
+ error = ENOTDIR;
+ break;
+#endif
+#ifdef ENXIO
+ case G_FILE_ERROR_NXIO:
+ error = ENXIO;
+ break;
+#endif
+#ifdef ENODEV
+ case G_FILE_ERROR_NODEV:
+ error = ENODEV;
+ break;
+#endif
+#ifdef EROFS
+ case G_FILE_ERROR_ROFS:
+ error = EROFS;
+ break;
+#endif
+#ifdef ETXTBSY
+ case G_FILE_ERROR_TXTBSY:
+ error = ETXTBSY;
+ break;
+#endif
+#ifdef EFAULT
+ case G_FILE_ERROR_FAULT:
+ error = EFAULT;
+ break;
+#endif
+#ifdef ELOOP
+ case G_FILE_ERROR_LOOP:
+ error = ELOOP;
+ break;
+#endif
+#ifdef ENOSPC
+ case G_FILE_ERROR_NOSPC:
+ error = ENOSPC;
+ break;
+#endif
+#ifdef ENOMEM
+ case G_FILE_ERROR_NOMEM:
+ error = ENOMEM;
+ break;
+#endif
+#ifdef EMFILE
+ case G_FILE_ERROR_MFILE:
+ error = EMFILE;
+ break;
+#endif
+#ifdef ENFILE
+ case G_FILE_ERROR_NFILE:
+ error = ENFILE;
+ break;
+#endif
+#ifdef EBADF
+ case G_FILE_ERROR_BADF:
+ error = EBADF;
+ break;
+#endif
+#ifdef EINVAL
+ case G_FILE_ERROR_INVAL:
+ error = EINVAL;
+ break;
+#endif
+#ifdef EPIPE
+ case G_FILE_ERROR_PIPE:
+ error = EPIPE;
+ break;
+#endif
+#ifdef EAGAIN
+ case G_FILE_ERROR_AGAIN:
+ error = EAGAIN;
+ break;
+#endif
+#ifdef EINTR
+ case G_FILE_ERROR_INTR:
+ error = EINTR;
+ break;
+#endif
+#ifdef EWIO
+ case G_FILE_ERROR_IO:
+ error = EIO;
+ break;
+#endif
+#ifdef EPERM
+ case G_FILE_ERROR_PERM:
+ error = EPERM;
+ break;
+#endif
+ case G_FILE_ERROR_FAILED:
+ error = ERROR_INVALID_PARAMETER;
+ break;
+ }
+
+ return error;
+}
+
+/* scandir using glib */
+static gint
+mono_io_scandir (const gchar *dirname, const gchar *pattern, gchar ***namelist)
+{
+ GError *error = NULL;
+ GDir *dir;
+ GPtrArray *names;
+ const gchar *name;
+ gint result;
+ GPatternSpec *patspec;
+
+ dir = _wapi_g_dir_open (dirname, 0, &error);
+ if (dir == NULL) {
+ /* g_dir_open returns ENOENT on directories on which we don't
+ * have read/x permission */
+ gint errnum = get_errno_from_g_file_error (error->code);
+ g_error_free (error);
+ if (errnum == ENOENT &&
+ !_wapi_access (dirname, F_OK) &&
+ _wapi_access (dirname, R_OK|X_OK)) {
+ errnum = EACCES;
+ }
+
+ errno = errnum;
+ return -1;
+ }
+
+ patspec = g_pattern_spec_new (pattern);
+ names = g_ptr_array_new ();
+ while ((name = g_dir_read_name (dir)) != NULL) {
+ if (g_pattern_match_string (patspec, name))
+ g_ptr_array_add (names, g_strdup (name));
+ }
+
+ g_pattern_spec_free (patspec);
+ g_dir_close (dir);
+ result = names->len;
+ if (result > 0) {
+ g_ptr_array_sort (names, file_compare);
+ g_ptr_array_set_size (names, result + 1);
+
+ *namelist = (gchar **) g_ptr_array_free (names, FALSE);
+ } else {
+ g_ptr_array_free (names, TRUE);
+ }
+
+ return result;
+}
+
gpointer FindFirstFile (const gunichar2 *pattern, WapiFindData *find_data)
{
struct _WapiHandle_find find_handle = {0};
@@ -2679,8 +2854,7 @@
*/
find_handle.namelist = NULL;
- result = _wapi_io_scandir (dir_part, entry_part,
- &find_handle.namelist);
+ result = mono_io_scandir (dir_part, entry_part, &find_handle.namelist);
if (result == 0) {
/* No files, which windows seems to call
@@ -2791,8 +2965,6 @@
* encoding of the name wasn't convertible), so just
* ignore it.
*/
- g_warning ("%s: Bad encoding for '%s'\nConsider using
MONO_EXTERNAL_ENCODINGS\n", __func__, filename);
-
g_free (filename);
goto retry;
}
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-04-16 17:02:22 UTC (rev 75777)
+++ trunk/mono/mono/metadata/ChangeLog 2007-04-16 17:02:21 UTC (rev 75778)
@@ -3,17 +3,6 @@
* threads.c (start_wrapper): Call push_appdomain_ref () earlier to fix
races where
the thread is aborted early.
-2007-04-05 Dick Porter <[EMAIL PROTECTED]>
-
- * file-io.c (ves_icall_System_IO_MonoIO_GetFileSystemEntries): use
- FindFirstFile()/FindNextFile() to find entries. This lets the
- io-layer versions use MONO_IOMAP compatibility helpers. Fixes bug
- 81038.
-
- * appdomain.c (MONO_CORLIB_VERSION): Increment, as the usage of
- the parameters of
- ves_icall_System_IO_MonoIO_GetFileSystemEntries() has changed.
-
2007-04-04 Martin Baulig <[EMAIL PROTECTED]>
* debug-helpers.c
Modified: trunk/mono/mono/metadata/file-io.c
===================================================================
--- trunk/mono/mono/metadata/file-io.c 2007-04-16 17:02:22 UTC (rev 75777)
+++ trunk/mono/mono/metadata/file-io.c 2007-04-16 17:02:21 UTC (rev 75778)
@@ -239,81 +239,272 @@
return(ret);
}
-MonoArray *
-ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
- MonoString *path_with_pattern,
- gint attrs, gint mask,
- gint32 *error)
+static gint
+get_error_from_g_file_error (gint error)
{
- MonoDomain *domain;
- MonoArray *result;
- int i;
- WIN32_FIND_DATA data;
- HANDLE find_handle;
- GPtrArray *names;
- gchar *utf8_path, *utf8_result, *full_name;
-
- MONO_ARCH_SAVE_REGS;
+ switch (error) {
+ case G_FILE_ERROR_ACCES:
+ error = ERROR_ACCESS_DENIED;
+ break;
+ case G_FILE_ERROR_NAMETOOLONG:
+ error = ERROR_FILENAME_EXCED_RANGE;
+ break;
+ case G_FILE_ERROR_NOENT:
+ error = ERROR_FILE_NOT_FOUND;
+ break;
+ case G_FILE_ERROR_NOTDIR:
+ error = ERROR_FILE_NOT_FOUND;
+ break;
+ case G_FILE_ERROR_ROFS:
+ error = ERROR_ACCESS_DENIED;
+ break;
+ case G_FILE_ERROR_TXTBSY:
+ error = ERROR_SHARING_VIOLATION;
+ break;
+ case G_FILE_ERROR_NOSPC:
+ error = ERROR_HANDLE_DISK_FULL;
+ break;
+ case G_FILE_ERROR_NFILE:
+ case G_FILE_ERROR_MFILE:
+ error = ERROR_TOO_MANY_OPEN_FILES;
+ break;
+ case G_FILE_ERROR_BADF:
+ error = ERROR_INVALID_HANDLE;
+ break;
+ case G_FILE_ERROR_INVAL:
+ error = ERROR_INVALID_PARAMETER;
+ break;
+ case G_FILE_ERROR_AGAIN:
+ error = ERROR_SHARING_VIOLATION;
+ break;
+ case G_FILE_ERROR_INTR:
+ error = ERROR_IO_PENDING;
+ break;
+ case G_FILE_ERROR_PERM:
+ error = ERROR_ACCESS_DENIED;
+ break;
+ case G_FILE_ERROR_FAILED:
+ error = ERROR_INVALID_PARAMETER;
+ break;
+ case G_FILE_ERROR_NXIO:
+ case G_FILE_ERROR_NOMEM:
+ case G_FILE_ERROR_NODEV:
+ case G_FILE_ERROR_FAULT:
+ case G_FILE_ERROR_LOOP:
+ case G_FILE_ERROR_PIPE:
+ case G_FILE_ERROR_IO:
+ default:
+ error = ERROR_GEN_FAILURE;
+ break;
- *error = ERROR_SUCCESS;
+ }
- domain = mono_domain_get ();
- mask = convert_attrs (mask);
+ return error;
+}
+
+static gint
+file_compare (gconstpointer a, gconstpointer b)
+{
+ gchar *astr = *(gchar **) a;
+ gchar *bstr = *(gchar **) b;
+
+ return strcmp (astr, bstr);
+}
+
+static gint
+get_file_attributes (const char *filename)
+{
+#ifdef PLATFORM_WIN32
+ gunichar2 *full16;
+ gint result;
+
+ full16 = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
+ if (full16 == NULL) {
+ g_message ("Bad encoding for '%s'\n", filename);
+ return FALSE;
+ }
+
+ result = GetFileAttributes (full16);
+ g_free (full16);
+ return result;
+#else
+ struct stat buf;
+ struct stat linkbuf;
+ int result;
+ int file_attrs;
+ gboolean issymlink = FALSE;
- find_handle = FindFirstFile (mono_string_chars (path_with_pattern),
- &data);
- if (find_handle == INVALID_HANDLE_VALUE) {
- gint32 find_error = GetLastError ();
-
- if (find_error == ERROR_FILE_NOT_FOUND) {
- /* No files, so just return an empty array */
- result = mono_array_new (domain,
- mono_defaults.string_class,
- 0);
+ result = lstat (filename, &buf);
+ if (result == -1)
+ return FALSE;
- return(result);
+ if (S_ISLNK (buf.st_mode)) {
+ issymlink = TRUE;
+ result = stat (filename, &linkbuf);
+ if (result != -1) {
+ buf = linkbuf;
}
-
- *error = find_error;
- return(NULL);
}
+ /* Sockets (0140000) != Directory (040000) + Regular file (0100000) */
+ if (S_ISSOCK (buf.st_mode))
+ buf.st_mode &= ~S_IFSOCK; /* don't consider socket protection */
+
+ file_attrs = 0;
+ if (S_ISDIR (buf.st_mode))
+ file_attrs |= FILE_ATTRIBUTE_DIRECTORY;
+ else
+ file_attrs |= FILE_ATTRIBUTE_ARCHIVE;
+
+ if ((buf.st_mode & S_IWUSR) == 0)
+ file_attrs |= FILE_ATTRIBUTE_READONLY;
+
+ if (*filename == '.')
+ file_attrs |= FILE_ATTRIBUTE_HIDDEN;
+
+ if (issymlink) {
+ file_attrs |= FILE_ATTRIBUTE_REPARSE_POINT;
+ }
+
+ return file_attrs;
+#endif
+}
+
+static gboolean
+test_file (const char *filename, int attrs, int mask)
+{
+ int file_attr;
+
+ file_attr = get_file_attributes (filename);
+ if (file_attr == FALSE)
+ return FALSE;
+
+ return ((file_attr & mask) == attrs);
+}
+
+/* scandir using glib */
+static gint
+mono_io_scandir (const gchar *dirname, const gchar *pattern, int attrs,
+ int mask, gchar ***namelist)
+{
+ GError *error = NULL;
+ GDir *dir;
+ GPtrArray *names;
+ const gchar *name;
+ gint result;
+ GPatternSpec *patspec;
+ gchar *full_name;
+
+ mask = convert_attrs (mask);
+ *namelist = NULL;
+ dir = g_dir_open (dirname, 0, &error);
+ if (dir == NULL) {
+ /* g_dir_open returns ENOENT on directories on which we don't
+ * have read/x permission */
+ gint errnum = get_error_from_g_file_error (error->code);
+ g_error_free (error);
+ if (errnum == ERROR_FILE_NOT_FOUND && g_file_test (dirname,
G_FILE_TEST_IS_DIR))
+ errnum = ERROR_ACCESS_DENIED;
+
+ SetLastError (errnum);
+ return -1;
+ }
+
+ patspec = g_pattern_spec_new (pattern);
names = g_ptr_array_new ();
- utf8_path = mono_string_to_utf8 (path);
+ while ((name = g_dir_read_name (dir)) != NULL) {
+ if (!g_pattern_match_string (patspec, name))
+ continue;
- do {
- if ((data.cFileName[0] == '.' && data.cFileName[1] == 0) ||
- (data.cFileName[0] == '.' && data.cFileName[1] == '.' &&
data.cFileName[2] == 0)) {
+ full_name = g_build_filename (dirname, name, NULL);
+ if (FALSE == test_file (full_name, attrs, mask)) {
+ g_free (full_name);
continue;
}
-
- if ((data.dwFileAttributes & mask) == attrs) {
- utf8_result = g_utf16_to_utf8 (data.cFileName, -1,
NULL, NULL, NULL);
- full_name = g_build_filename (utf8_path, utf8_result,
NULL);
-
- g_ptr_array_add (names, mono_string_new (domain,
- full_name));
- g_free (full_name);
- g_free (utf8_result);
- }
- } while(FindNextFile (find_handle, &data));
- if (FindClose (find_handle) == FALSE) {
- *error = GetLastError ();
+ g_ptr_array_add (names, full_name);
+ }
+
+ g_pattern_spec_free (patspec);
+ g_dir_close (dir);
+ result = names->len;
+ if (result > 0) {
+ g_ptr_array_sort (names, file_compare);
+ g_ptr_array_set_size (names, result + 1);
+
+ *namelist = (gchar **) g_ptr_array_free (names, FALSE);
+ } else {
g_ptr_array_free (names, TRUE);
- g_free (utf8_path);
- return(NULL);
}
- result = mono_array_new (domain, mono_defaults.string_class,
- names->len);
- for (i = 0; i < names->len; i++) {
- mono_array_setref (result, i, g_ptr_array_index (names, i));
+ return result;
+}
+
+MonoArray *
+ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *_path, MonoString
*_pattern,
+ gint attrs, gint mask, gint32 *error)
+{
+ MonoDomain *domain;
+ MonoArray *result;
+ gchar **namelist;
+ gchar *path;
+ gchar *pattern;
+ int i, nnames;
+ int removed;
+ MonoString *str_name;
+#ifndef PLATFORM_WIN32
+ gunichar2 *utf16;
+ gsize nbytes;
+#endif
+
+ MONO_ARCH_SAVE_REGS;
+
+ *error = ERROR_SUCCESS;
+
+ path = mono_string_to_utf8 (_path);
+ pattern = mono_string_to_utf8 (_pattern);
+ nnames = mono_io_scandir (path, pattern, attrs, mask, &namelist);
+ if (nnames < 0) {
+ *error = GetLastError ();
+ g_free (pattern);
+ g_free (path);
+ return NULL;
}
- g_ptr_array_free (names, TRUE);
- g_free (utf8_path);
-
+ domain = mono_domain_get ();
+ result = mono_array_new (domain, mono_defaults.string_class, nnames);
+ removed = 0;
+ for (i = 0; i < nnames; i++) {
+#if PLATFORM_WIN32
+ str_name = mono_string_new (domain, namelist [i]);
+#else
+ utf16 = mono_unicode_from_external (namelist [i], &nbytes);
+ if (utf16 == NULL) {
+ g_message ("Bad encoding for '%s'\nConsider using
MONO_EXTERNAL_ENCODINGS\n",
+ namelist [i]);
+ removed++;
+ continue;
+ }
+ str_name = mono_string_from_utf16 (utf16);
+ g_free (utf16);
+#endif
+ mono_array_setref (result, i - removed, str_name);
+ }
+
+ if (removed > 0) {
+ MonoArray *shrinked;
+ shrinked = mono_array_new (domain, mono_defaults.string_class,
nnames - removed);
+ for (i = 0; i < (nnames - removed); i++) {
+ MonoString *str;
+ str = mono_array_get (result, MonoString *, i);
+ mono_array_setref (shrinked, i, str);
+ }
+ result = shrinked;
+ }
+
+ g_strfreev (namelist);
+ g_free (pattern);
+ g_free (path);
return result;
}
Modified: trunk/mono/mono/metadata/file-io.h
===================================================================
--- trunk/mono/mono/metadata/file-io.h 2007-04-16 17:02:22 UTC (rev 75777)
+++ trunk/mono/mono/metadata/file-io.h 2007-04-16 17:02:21 UTC (rev 75778)
@@ -119,10 +119,8 @@
ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error)
MONO_INTERNAL;
MonoArray *
-ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
- MonoString *path_with_pattern,
- gint mask, gint attrs,
- gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *_path, MonoString
*_pattern,
+ gint mask, gint attrs, gint32 *error)
MONO_INTERNAL;
extern MonoString *
ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error) MONO_INTERNAL;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches