diff options
author | Miguel de Icaza <miguel@gnome.org> | 2006-11-04 01:34:28 +0300 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2006-11-04 01:34:28 +0300 |
commit | 45e90d597e7f31dd20cad425ce5d11cee5cad477 (patch) | |
tree | 4d33605d1b0821424cdaccba6426a30d5312e83d /eglib | |
parent | f1dbcecc198da85841cb376905f9ddcdd9032eec (diff) |
2006-11-03 Miguel de Icaza <miguel@novell.com>
* test/string-util.c (test_strlcpy): Add new test.
* src/gunicode.c (g_filename_from_utf8): g_strlcpy needs the full
size, with the extra zero at the end; Fixes the stack trace
issue.
svn path=/trunk/mono/; revision=67332
Diffstat (limited to 'eglib')
-rw-r--r-- | eglib/ChangeLog | 12 | ||||
-rw-r--r-- | eglib/src/gunicode.c | 2 | ||||
-rw-r--r-- | eglib/test/string-util.c | 9 |
3 files changed, 22 insertions, 1 deletions
diff --git a/eglib/ChangeLog b/eglib/ChangeLog index 5e246afbad7..bdbf05e5de7 100644 --- a/eglib/ChangeLog +++ b/eglib/ChangeLog @@ -1,3 +1,15 @@ +2006-11-03 Miguel de Icaza <miguel@novell.com> + + * test/string-util.c (test_strlcpy): Add new test. + + * src/gunicode.c (g_filename_from_utf8): g_strlcpy needs the full + size, with the extra zero at the end; Fixes the stack trace + issue. + +2006-10-30 Miguel de Icaza <miguel@novell.com> + + * test/utf8.c (test_utf8_seq): Add new failing test. + 2006-10-30 Atsushi Enomoto <atsushi@ximian.com> * src/gutf8.c : several fixes: diff --git a/eglib/src/gunicode.c b/eglib/src/gunicode.c index 93da31aad0c..9c05e60857d 100644 --- a/eglib/src/gunicode.c +++ b/eglib/src/gunicode.c @@ -140,7 +140,7 @@ g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gs len = strlen (utf8string); res = g_malloc (len + 1); - g_strlcpy (res, utf8string, len); + g_strlcpy (res, utf8string, len + 1); return res; } diff --git a/eglib/test/string-util.c b/eglib/test/string-util.c index 4f75015d6eb..10e0ea0ce95 100644 --- a/eglib/test/string-util.c +++ b/eglib/test/string-util.c @@ -310,6 +310,8 @@ test_strdelimit () return OK; } +#define TEXT "0123456789" + RESULT test_strlcpy () { @@ -344,6 +346,13 @@ test_strlcpy () if (0 != strcmp (dest, src)) return FAILED ("Src and dest not equal 2"); g_free (dest); + + /* This is a test for g_filename_from_utf8, even if it does not look like it */ + dest = g_filename_from_utf8 (TEXT, strlen (TEXT), NULL, NULL, NULL); + if (0 != strcmp (dest, TEXT)) + return FAILED ("problem [%s] and [%s]", dest, TEXT); + g_free (dest); + return OK; } |