Author: miguel
Date: 2006-10-18 14:13:16 -0400 (Wed, 18 Oct 2006)
New Revision: 66796
Modified:
trunk/mono/eglib/ChangeLog
trunk/mono/eglib/src/gpath.c
trunk/mono/eglib/src/gutf8.c
trunk/mono/eglib/test/path.c
Log:
2006-10-18 Miguel de Icaza <[EMAIL PROTECTED]>
* src/gpath.c (g_build_path): Do not append terminator if the next
string is empty.
* src/gutf8.c (g_utf8_to_utf16): Include trailing zero as
documented.
(g_utf16_to_utf8): Include trailing zero as documented.
Modified: trunk/mono/eglib/ChangeLog
===================================================================
--- trunk/mono/eglib/ChangeLog 2006-10-18 18:00:09 UTC (rev 66795)
+++ trunk/mono/eglib/ChangeLog 2006-10-18 18:13:16 UTC (rev 66796)
@@ -1,3 +1,12 @@
+2006-10-18 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * src/gpath.c (g_build_path): Do not append terminator if the next
+ string is empty.
+
+ * src/gutf8.c (g_utf8_to_utf16): Include trailing zero as
+ documented.
+ (g_utf16_to_utf8): Include trailing zero as documented.
+
2006-10-17 Miguel de Icaza <[EMAIL PROTECTED]>
* src/gstr.c (g_strdown): Actually move.
Modified: trunk/mono/eglib/src/gpath.c
===================================================================
--- trunk/mono/eglib/src/gpath.c 2006-10-18 18:00:09 UTC (rev 66795)
+++ trunk/mono/eglib/src/gpath.c 2006-10-18 18:13:16 UTC (rev 66796)
@@ -60,13 +60,14 @@
}
g_string_append_len (result, s, p - s);
- if (next){
+ if (next && *next){
g_string_append (result, separator);
for (; strncmp (next, separator, slen) == 0; )
next += slen;
}
}
+ g_string_append_c (result, 0);
va_end (args);
return g_string_free (result, FALSE);
Modified: trunk/mono/eglib/src/gutf8.c
===================================================================
--- trunk/mono/eglib/src/gutf8.c 2006-10-18 18:00:09 UTC (rev 66795)
+++ trunk/mono/eglib/src/gutf8.c 2006-10-18 18:13:16 UTC (rev 66796)
@@ -49,7 +49,7 @@
if (utf16_len < 0)
return NULL;
- ret = g_malloc (utf16_len * sizeof (gunichar2));
+ ret = g_malloc ((1 + utf16_len) * sizeof (gunichar2));
for (in_pos = 0; len < 0 ? str [in_pos] : in_pos < len; in_pos++) {
ch = (guchar) str [in_pos];
@@ -102,6 +102,7 @@
}
}
+ ret [out_pos] = 0;
if (items_written)
*items_written = out_pos;
return ret;
@@ -252,7 +253,7 @@
if (utf8_len < 0)
return NULL;
- ret = g_malloc (utf8_len * sizeof (gchar));
+ ret = g_malloc ((1+utf8_len) * sizeof (gchar));
while (len < 0 ? str [in_pos] : in_pos < len) {
ch = str [in_pos];
@@ -301,6 +302,7 @@
ret [out_pos++] = (gchar) (0x80 | (codepoint & 0x3F));
}
}
+ ret [out_pos] = 0;
if (items_written)
*items_written = out_pos;
Modified: trunk/mono/eglib/test/path.c
===================================================================
--- trunk/mono/eglib/test/path.c 2006-10-18 18:00:09 UTC (rev 66795)
+++ trunk/mono/eglib/test/path.c 2006-10-18 18:13:16 UTC (rev 66796)
@@ -77,6 +77,12 @@
if (strcmp (s, "a/b/c/d") != 0)
return FAILED ("13 Got wrong result, got: %s", s);
g_free (s);
+
+ s = g_build_path ("/", "/a", "", "/c/", NULL);
+ if (strcmp (s, "/a/c/") != 0)
+ return FAILED ("14 Got wrong result, got: %s", s);
+ g_free (s);
+ return OK;
return OK;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches