[MPlayer-cvslog] r19897 - trunk/libass/ass_render.c

eugeni subversion at mplayerhq.hu
Mon Sep 18 20:54:38 CEST 2006


Author: eugeni
Date: Mon Sep 18 20:54:38 2006
New Revision: 19897

Modified:
   trunk/libass/ass_render.c

Log:
Fix a stupid bug in list concatenation.


Modified: trunk/libass/ass_render.c
==============================================================================
--- trunk/libass/ass_render.c	(original)
+++ trunk/libass/ass_render.c	Mon Sep 18 20:54:38 2006
@@ -1900,16 +1900,6 @@
 	return 0;
 }
 
-static ass_image_t** find_list_tail(ass_image_t** phead)
-{
-	ass_image_t* img = *phead;
-	if (!img)
-		return phead;
-	while (img->next)
-		img = img->next;
-	return &img->next;
-}
-
 static int cmp_event_layer(const void* p1, const void* p2)
 {
 	ass_event_t* e1 = ((event_images_t*)p1)->event;
@@ -2084,8 +2074,7 @@
 	int i, cnt, rc;
 	event_images_t eimg[MAX_EVENTS];
 	event_images_t* last;
-	ass_image_t* head = 0;
-	ass_image_t** tail = &head;
+	ass_image_t** tail;
 	
 	// init frame
 	rc = ass_start_frame(priv, track, now);
@@ -2121,14 +2110,16 @@
 		fix_collisions(last, eimg + cnt - last);
 
 	// concat lists
-	head = cnt ? eimg[0].imgs : 0;
-	tail = find_list_tail(&head);
-	for (i = 1; i < cnt; ++i) {
-		*tail = eimg[i].imgs;
-		tail = find_list_tail(&eimg[i].imgs);
+	tail = &ass_instance->images_root;
+	for (i = 0; i < cnt; ++i) {
+		ass_image_t* cur = eimg[i].imgs;
+		while (cur) {
+			*tail = cur;
+			tail = &cur->next;
+			cur = cur->next;
+		}
 	}
 	
-	ass_instance->images_root = head;
 	return ass_instance->images_root;
 }
 



More information about the MPlayer-cvslog mailing list