From 78c8cdd38641a75b6bd8667d3229659a2db319b1 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Thu, 30 Jul 2009 01:04:29 +0200 Subject: Get rid of MAX_EVENTS limit Allocate the maximum possible number of used events in fix_collisions dynamically, eliminating the MAX_EVENTS limit. --- libass/ass_render.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index 440099f..8c249e0 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -3334,8 +3334,6 @@ static int cmp_event_layer(const void *p1, const void *p2) return 0; } -#define MAX_EVENTS 100 - static render_priv_t *get_render_priv(ass_renderer_t *render_priv, ass_event_t *event) { @@ -3421,7 +3419,7 @@ static int fit_segment(segment_t *s, segment_t *fixed, int *cnt, int dir) static void fix_collisions(ass_renderer_t *render_priv, event_images_t *imgs, int cnt) { - segment_t used[MAX_EVENTS]; + segment_t *used = malloc(cnt * sizeof(*used)); int cnt_used = 0; int i, j; @@ -3477,6 +3475,8 @@ fix_collisions(ass_renderer_t *render_priv, event_images_t *imgs, int cnt) } } + + free(used); } /** -- cgit v1.2.3