diff options
author | Owen Taylor <otaylor@redhat.com> | 2004-11-21 16:45:36 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2004-11-21 16:45:36 +0000 |
commit | 145e118d8d071e5836334a3ffacf22cf789e4257 (patch) | |
tree | 84b17ff8afca40011a5101711cd987c8ad3b8e3b /pango | |
parent | a74950580a02c579cef2f523a148e0f386d620b6 (diff) | |
download | pango-145e118d8d071e5836334a3ffacf22cf789e4257.tar.gz |
Return n+1 logical attributes not n logical attributes (#155912)
Sun Nov 21 11:40:03 2004 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_get_log_attrs): Return n+1
logical attributes not n logical attributes (#155912)
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-layout.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 5f846a78..97649f40 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -917,8 +917,10 @@ pango_layout_context_changed (PangoLayout *layout) * @attrs: location to store a pointer to an array of logical attributes * This value must be freed with g_free(). * @n_attrs: location to store the number of the attributes in the - * array. (The stored value will be equal to the total number - * of characters in the layout.) + * array. (The stored value will be one more than the total number + * of characters in the layout, since there need to be attributes + * corresponding to both the position before the first character + * and the position after the last character.) * * Retrieves an array of logical attributes for each character in * the @layout. @@ -934,12 +936,12 @@ pango_layout_get_log_attrs (PangoLayout *layout, if (attrs) { - *attrs = g_new (PangoLogAttr, layout->n_chars); - memcpy (*attrs, layout->log_attrs, sizeof(PangoLogAttr) * layout->n_chars); + *attrs = g_new (PangoLogAttr, layout->n_chars + 1); + memcpy (*attrs, layout->log_attrs, sizeof(PangoLogAttr) * (layout->n_chars + 1)); } if (n_attrs) - *n_attrs = layout->n_chars; + *n_attrs = layout->n_chars + 1; } |