[evolution-patches] gtkhtml: Fix for warning in gtkhml.c (RH bug 162143)



Attached is a fix for this warning (seen on GCC 4):
gtkhtml.c:3285: warning: 'offset' is used uninitialized in this function

The existing code assumed that the 2nd argument was evaluated before the
4th in this function call; is this true for every C compiler?

OK to commit?
Index: src/ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2140
diff -u -p -r1.2140 ChangeLog
--- src/ChangeLog	17 Aug 2005 01:52:23 -0000	1.2140
+++ src/ChangeLog	18 Aug 2005 20:56:25 -0000
@@ -1,3 +1,8 @@
+2005-08-18  David Malcolm  <dmalcolm redhat com>
+
+	* gtkhtml.c (gtk_html_im_retrieve_surrounding_cb): Remove assumption
+	about order of evaluation of arguments; fix warning.
+
 2005-08-17  Mengjie Yu  <meng-jie yu sun com>
 
 	* htmltext.c: (html_text_prepare_attrs),
Index: src/gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.605
diff -u -p -r1.605 gtkhtml.c
--- src/gtkhtml.c	6 Jul 2005 10:34:19 -0000	1.605
+++ src/gtkhtml.c	18 Aug 2005 20:56:26 -0000
@@ -3308,10 +3308,13 @@ get_surrounding_text (HTMLEngine *e, gin
 static gboolean
 gtk_html_im_retrieve_surrounding_cb (GtkIMContext *context, GtkHTML *html)
 {
-	gint offset;
+	gint offset = 0;
+	gchar *text;
 
 	D_IM (printf ("IM gtk_html_im_retrieve_surrounding_cb\n");)
-	gtk_im_context_set_surrounding (context, get_surrounding_text (html->engine, &offset), -1, offset);
+
+	text = get_surrounding_text (html->engine, &offset);
+	gtk_im_context_set_surrounding (context, text, -1, offset);
 
 	return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]