Author: joncham
Date: 2006-06-11 20:53:44 -0400 (Sun, 11 Jun 2006)
New Revision: 61621

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/icall.c
Log:
Fix for building mono in VS, and implement reading/writing USER/MACHINE level 
environment variables.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2006-06-11 18:23:21 UTC (rev 61620)
+++ trunk/mono/mono/metadata/ChangeLog  2006-06-12 00:53:44 UTC (rev 61621)
@@ -1,5 +1,9 @@
 2006-06-09  Jonathan Chambers  <[EMAIL PROTECTED]>
 
+       * icall.c: Another fix for building mono in Visual Studio.
+
+2006-06-09  Jonathan Chambers  <[EMAIL PROTECTED]>
+
        * marshal.c icall.c: Minor fixes for building mono in Visual Studio.
        
 2006-06-09  Martin Baulig  <[EMAIL PROTECTED]>

Modified: trunk/mono/mono/metadata/icall.c
===================================================================
--- trunk/mono/mono/metadata/icall.c    2006-06-11 18:23:21 UTC (rev 61620)
+++ trunk/mono/mono/metadata/icall.c    2006-06-12 00:53:44 UTC (rev 61621)
@@ -5622,23 +5622,43 @@
 static void
 ves_icall_System_Environment_InternalSetEnvironmentVariable (MonoString *name, 
MonoString *value)
 {
+#ifdef PLATFORM_WIN32
+       gunichar2 *utf16_name, *utf16_value;
+#else
        gchar *utf8_name, *utf8_value;
+#endif
 
        MONO_ARCH_SAVE_REGS;
+       
+#ifdef PLATFORM_WIN32
+       utf16_name = mono_string_to_utf16 (name);
+       if ((value == NULL) || (mono_string_length (value) == 0) || 
(mono_string_chars (value)[0] == 0)) {
+               SetEnvironmentVariable (utf16_name, NULL);
+               g_free (utf16_name);
+               return;
+       }
 
+       utf16_value = mono_string_to_utf16 (value);
+
+       SetEnvironmentVariable (utf16_name, utf16_value);
+
+       g_free (utf16_name);
+       g_free (utf16_value);
+#else
        utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii 
*/
 
        if ((value == NULL) || (mono_string_length (value) == 0) || 
(mono_string_chars (value)[0] == 0)) {
                g_unsetenv (utf8_name);
+               g_free (utf8_name);
                return;
        }
 
        utf8_value = mono_string_to_utf8 (value);
-
        g_setenv (utf8_name, utf8_value, TRUE);
 
        g_free (utf8_name);
        g_free (utf8_value);
+#endif
 }
 
 /*

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to