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

reimar subversion at mplayerhq.hu
Sat Mar 28 20:21:35 CET 2009


Author: reimar
Date: Sat Mar 28 20:21:34 2009
New Revision: 29086

Log:
Initialize all structs to 0 before using them.
This is consistent with the remaining code (which uses e.g. calloc) and makes
it easier to extend the structs in the future.
As a side effect it fixes several valgrind errors in hashmap_hash/hashmap_key_compare
caused by padding in the structures, but it is not a correct fix for that issue.

Modified:
   trunk/libass/ass_render.c

Modified: trunk/libass/ass_render.c
==============================================================================
--- trunk/libass/ass_render.c	Sat Mar 28 19:53:26 2009	(r29085)
+++ trunk/libass/ass_render.c	Sat Mar 28 20:21:34 2009	(r29086)
@@ -455,6 +455,7 @@ static void render_overlap(ass_image_t**
 	cur_top = top-by;
 
 	// Query cache
+	memset(&hk, 0, sizeof(hk));
 	memcpy(&hk.a, last_hash, sizeof(*last_hash));
 	memcpy(&hk.b, hash, sizeof(*hash));
 	hk.aw = aw;
@@ -1429,6 +1430,7 @@ static void get_outline_glyph(int symbol
 	int error;
 	glyph_hash_val_t* val;
 	glyph_hash_key_t key;
+	memset(&key, 0, sizeof(key));
 	key.font = render_context.font;
 	key.size = render_context.font_size;
 	key.ch = symbol;
@@ -2166,6 +2168,7 @@ static int ass_render_event(ass_event_t*
 	for (i = 0; i < text_info.length; ++i)
 		get_bitmap_glyph(text_info.glyphs + i);
 
+	memset(event_images, 0, sizeof(*event_images));
 	event_images->top = device_y - d6_to_int(text_info.lines[0].asc);
 	event_images->height = d6_to_int(text_info.height);
 	event_images->detect_collisions = render_context.detect_collisions;


More information about the MPlayer-cvslog mailing list