[Mono-list] System.String::.ctor cant be resolved
Duncan Mak
duncan@ximian.com
24 Apr 2002 02:46:25 -0400
--=-KdbEs//DvoznDfFBnxwU
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Here's the new and improved patch.
From the ChangeLog:
2002-04-23 Duncan Mak <duncan@ximian.com>
* string-icalls.c (mono_string_Internal_ctor_charp_int_int):
(mono_string_Internal_ctor_sbytep_int_int): Removed check for
sindex < 0, throw ArgumentOutOfRangeException instead of
ArgumentNullException.
Added new check for length == 0, however
I need to make it return String.Empty from the C code.
(mono_string_Internal_ctor_sbytep):
(mono_string_Internal_ctor_sbytep_int_int): Replaced
mono_string_new_utf16 with mono_string_new_len, since value is utf8.
Duncan.
--=-KdbEs//DvoznDfFBnxwU
Content-Disposition: attachment; filename=string.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=string.patch; charset=ISO-8859-1
Index: string-icalls.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/mono/mono/metadata/string-icalls.c,v
retrieving revision 1.9
diff -u -b -r1.9 string-icalls.c
--- string-icalls.c 23 Apr 2002 11:16:51 -0000 1.9
+++ string-icalls.c 24 Apr 2002 02:35:01 -0000
@@ -3,6 +3,7 @@
*
* Author:
* Patrik Torstensson (patrik.torstensson@labs2.com)
+ * Duncan Mak (duncan@ximian.com)
*
* (C) 2001 Ximian, Inc.
*/
@@ -63,12 +64,15 @@
=09
domain =3D mono_domain_get ();
=20
- if ((value =3D=3D NULL) && (sindex !=3D 0) && (length !=3D 0))
- mono_raise_exception (mono_get_exception_argument_null ("Argument null")=
);
+ if ((value =3D=3D NULL) && (length !=3D 0))
+ mono_raise_exception (mono_get_exception_argument_out_of_range ("Out of =
range"));
=20
if ((sindex < 0) || (length < 0))
mono_raise_exception (mono_get_exception_argument_out_of_range ("Out of =
range"));
=09
+ if (length =3D=3D 0) /* fixme: return String.Empty here */
+ g_assert_not_reached ();
+=09
begin =3D (gunichar2 *) (value + sindex);
=20
return mono_string_new_utf16 (domain, begin, length);
@@ -77,38 +81,36 @@
MonoString *
mono_string_Internal_ctor_sbytep (gpointer dummy, gint8 *value)
{
- int i, length;
+ guint length;
MonoDomain *domain;
=09
domain =3D mono_domain_get ();
=20
- if (value =3D=3D NULL)
- length =3D 0;
- else {
- for (i =3D 0; *(value + i) !=3D '\0'; i++);
- length =3D i;
- }
+ if (value =3D=3D NULL) /* fixme: return String.Empty here */
+ g_assert_not_reached ();
+ else=20
+ for (length =3D 0; *(value + length) !=3D '\0'; length ++);
=20
- return mono_string_new_utf16 (domain, (gunichar2 *) value, length);
+ return mono_string_new_len (domain, (const char *) value, length);
}
=20
MonoString *
mono_string_Internal_ctor_sbytep_int_int (gpointer dummy, gint8 *value, gi=
nt32 sindex, gint32 length)
{
- gunichar2 *begin;
+ char *begin;
MonoDomain *domain;
=09
domain =3D mono_domain_get ();
=20
- if ((value =3D=3D NULL) && (sindex !=3D 0) && (length !=3D 0))
- mono_raise_exception (mono_get_exception_argument_null ("Argument null")=
);
+ if ((value =3D=3D NULL) && (length !=3D 0))
+ mono_raise_exception (mono_get_exception_argument_out_of_range ("Out of =
range"))
=20
- if ((sindex > 0) || (length < 0))
+ if ((sindex < 0) || (length < 0))
mono_raise_exception (mono_get_exception_argument_out_of_range ("Out of =
range"));
=20
- begin =3D (gunichar2 *) (value + sindex);
+ begin =3D (char *) (value + sindex);
=20
- return mono_string_new_utf16 (domain, begin, length);
+ return mono_string_new_len (domain, begin, length);
}
=20
MonoString *
Index: ChangeLog
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/mono/mono/metadata/ChangeLog,v
retrieving revision 1.317
diff -u -b -r1.317 ChangeLog
--- ChangeLog 23 Apr 2002 19:44:36 -0000 1.317
+++ ChangeLog 24 Apr 2002 02:35:01 -0000
@@ -2,6 +2,20 @@
=20
* object.c (mono_runtime_invoke_array) : Bug because of my incompetence.
=20
+2002-04-23 Duncan Mak <duncan@ximian.com>
+
+ * string-icalls.c (mono_string_Internal_ctor_charp_int_int):
+ (mono_string_Internal_ctor_sbytep_int_int): Removed check for
+ sindex < 0, throw ArgumentOutOfRangeException instead of
+ ArgumentNullException.
+
+ Added new check for length =3D=3D 0, however
+ I need to make it return String.Empty from the C code.
+=09
+ (mono_string_Internal_ctor_sbytep):=20
+ (mono_string_Internal_ctor_sbytep_int_int): Replaced
+ mono_string_new_utf16 with mono_string_new_len, since value is utf8.
+
2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
=20
* reflection.c (mono_reflection_get_custom_attrs) : fixed image bug (cras=
h)
--=-KdbEs//DvoznDfFBnxwU--