Re: Two broken pango patches
- From: Tim Janik <timj gimp org>
- To: Andreas Bogk <andreas andreas org>
- Cc: gtk-devel-list gnome org
- Subject: Re: Two broken pango patches
- Date: Wed, 29 Aug 2001 18:55:16 -0700 (PDT)
On 30 Aug 2001, Andreas Bogk wrote:
without getting into the pango specifics here,
> Index: pango/pango-context.c
> ===================================================================
> RCS file: /cvs/gnome/pango/pango/pango-context.c,v
> retrieving revision 1.40
> diff -u -r1.40 pango-context.c
> --- pango/pango-context.c 2001/07/19 20:49:00 1.40
> +++ pango/pango-context.c 2001/08/23 12:22:06
> @@ -521,12 +521,13 @@
> {
> gunichar *text_ucs4;
> long n_chars, i;
> - guint8 *embedding_levels;
> + gint8 *embedding_levels;
> PangoDirection base_dir;
> PangoItem *item;
> const char *p;
> const char *next;
> GList *result = NULL;
> + GSList *to_be_deleted = NULL;
>
> PangoAnalysis *analyses;
>
> @@ -548,7 +549,7 @@
> */
> text_ucs4 = g_utf8_to_ucs4_fast (text + start_index, length, &n_chars);
>
> - embedding_levels = g_new (guint8, n_chars);
> + embedding_levels = g_new (gint8, n_chars);
>
> pango_log2vis_get_embedding_levels (text_ucs4, n_chars, &base_dir,
> embedding_levels);
> @@ -620,13 +621,18 @@
> else
> item->analysis.extra_attrs = analysis->extra_attrs;
>
> - result = g_list_prepend (result, item);
> + /* negative embedding levels are
> + LRE, RLE, LRO, RLO, PDF or BN codes */
> + if (embedding_levels[i] >= 0)
> + result = g_list_prepend (result, item);
> + else
> + to_be_deleted = g_slist_prepend (to_be_deleted, item);
> }
> else
> g_object_unref (analysis->font);
>
> item->length = (next - text) - item->offset;
> item->num_chars++;
>
> p = next;
> }
>
> @@ -634,6 +640,8 @@
> g_free (embedding_levels);
> g_free (text_ucs4);
>
> + g_slist_foreach (to_be_deleted, (GFunc) pango_item_free, NULL);
> +
you'll want g_slist_free (to_be_deleted); after this to avoid
leaking the list nodes.
> return g_list_reverse (result);
> }
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]