summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-08-24 16:23:07 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-08-24 16:23:07 +0000
commit49bae4b3685fab510326e157468b1d218cf700cb (patch)
treeb7ab5adcc12e871ee7108c5360391ab7d1b44c5b /pango/pango-layout.c
parent3f197135e3ce78858165852b3985c660029b409b (diff)
downloadpango-49bae4b3685fab510326e157468b1d218cf700cb.tar.gz
Handle text == NULL, length == 0 again.
Fri Aug 24 12:21:50 2001 Owen Taylor <otaylor@redhat.com> * pango/pango-layout.c (pango_layout_set_text): Handle text == NULL, length == 0 again.
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r--pango/pango-layout.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 82e97e9c..40e6fad1 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -725,11 +725,14 @@ pango_layout_set_text (PangoLayout *layout,
g_return_if_fail (layout != NULL);
g_return_if_fail (length == 0 || text != NULL);
- if (!g_utf8_validate (text, length, &end))
- g_warning ("Invalid UTF8 string passed to pango_layout_set_text()");
+ if (length != 0)
+ {
+ if (!g_utf8_validate (text, length, &end))
+ g_warning ("Invalid UTF8 string passed to pango_layout_set_text()");
+
+ length = end - text;
+ }
- length = end - text;
-
if (layout->text)
g_free (layout->text);
@@ -2775,7 +2778,7 @@ pango_layout_check_lines (PangoLayout *layout)
* is non-NULL even if it is zero length
*/
if (!layout->text)
- pango_layout_set_text (layout, "", 0);
+ pango_layout_set_text (layout, NULL, 0);
attrs = pango_layout_get_effective_attributes (layout);
iter = pango_attr_list_get_iterator (attrs);