Re: Cleanups for e-d-s/libedataserverui

Kjartan Maraas <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <1155799357.2951.15.camel@rivendell>
tor, 17,.08.2006 kl. 12.28 +0530, skrev chenthill:
> Hi kmaraas,
> 
> On Wed, 2006-08-16 at 17:27 +0200, Kjartan Maraas wrote:
> > gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW (list->tree_view),
> > event->x, event->y, &path, &pos);
> >         selection = gtk_tree_view_get_selection 
> Since the pos is not used anywhere, NULL could be passed in place of
> &pos.
> 
Done.

> int noreply = msg->noreply;
> The type of noreply should be changed in e-passwords.c (ep_ask_password)
> and (pass_response) since the type has been changed in the _EPassMsg
> structure.
> 
Done.

> The rest of it looks good.
> 
> While reviewing this patch, i found there are still some more warnings
> e-name-selector-entry.c: In function 'user_delete_text':
> e-name-selector-entry.c:1156: warning: comparison between pointer and
> integer
> e-name-selector-entry.c:1231: warning: label 'end_of_user_delete_text'
> defined but not used
> e-name-selector-entry.c: In function 'e_name_selector_entry_init':
> e-name-selector-entry.c:2091: warning: suggest parentheses around
> assignment used as truth value.
> It would be nice if you could add a fix for these also.
> 
Attaching an updated patch.

Cheers
Kjartan

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
libedataserverui-cleanups-updated.patch (text/x-patch, 8.2 KB)
Index: e-destination-store.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-destination-store.c,v
retrieving revision 1.11
diff -u -p -r1.11 e-destination-store.c
--- e-destination-store.c	7 Aug 2006 10:57:45 -0000	1.11
+++ e-destination-store.c	17 Aug 2006 07:22:02 -0000
@@ -262,11 +262,11 @@ static gint
 find_destination_by_email (EDestinationStore *destination_store, EDestination *destination)
 {
 	gint i;
-	char *e_mail = e_destination_get_email (destination);
+	const char *e_mail = e_destination_get_email (destination);
 
 	for (i = 0; i < destination_store->destinations->len; i++) {
 		EDestination *destination_here = g_ptr_array_index (destination_store->destinations, i);
-		char *mail = e_destination_get_email (destination_here);
+		const char *mail = e_destination_get_email (destination_here);
 
 		if (g_str_equal (e_mail, mail))
 			return i;
Index: e-name-selector-dialog.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-dialog.c,v
retrieving revision 1.34
diff -u -p -r1.34 e-name-selector-dialog.c
--- e-name-selector-dialog.c	7 Aug 2006 10:57:45 -0000	1.34
+++ e-name-selector-dialog.c	17 Aug 2006 07:22:02 -0000
@@ -127,7 +127,7 @@ e_name_selector_dialog_populate_categori
 
 	category_list = e_categories_get_list () ;
 	category_list = g_list_prepend (category_list, "Any Category");
-	g_list_sort (category_list, compare_func);
+	category_list = g_list_sort (category_list, compare_func);
 
 	category_menu = gtk_menu_new ();
 	l = category_list;
@@ -155,6 +155,8 @@ e_name_selector_dialog_init (ENameSelect
 	GtkTreeSelection  *selection;
 	ESourceList       *source_list;
 	char              *gladefile;
+	GConfClient *gconf_client;	
+	char *uid;
 
 	ENameSelectorDialogPrivate *priv = E_NAME_SELECTOR_DIALOG_GET_PRIVATE (name_selector_dialog);
 	priv->destination_index = 0;
@@ -237,9 +239,6 @@ e_name_selector_dialog_init (ENameSelect
 
 	widget = e_source_option_menu_new (name_selector_dialog->source_list);
         
-	GConfClient *gconf_client;	
-	char *uid;
-	
 	gconf_client = gconf_client_get_default();
 	uid = gconf_client_get_string (gconf_client, "/apps/evolution/addressbook/display/primary_addressbook",
 			NULL);
Index: e-name-selector-entry.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-entry.c,v
retrieving revision 1.40
diff -u -p -r1.40 e-name-selector-entry.c
--- e-name-selector-entry.c	7 Aug 2006 08:44:34 -0000	1.40
+++ e-name-selector-entry.c	17 Aug 2006 07:22:03 -0000
@@ -535,12 +535,6 @@ utf8_casefold_collate_len (const gchar *
 	return rv;
 }
 
-static gint
-utf8_casefold_collate (const gchar *str1, const gchar *str2)
-{
-	return utf8_casefold_collate_len (str1, str2, -1);
-}
-
 static gchar *
 build_textrep_for_contact (EContact *contact, EContactField cue_field)
 {
@@ -942,22 +936,6 @@ modify_destination_at_position (ENameSel
 }
 
 static void
-remove_destination_at_position (ENameSelectorEntry *name_selector_entry, gint pos)
-{
-	EDestination *destination;
-
-	destination = find_destination_at_position (name_selector_entry, pos);
-	if (destination) {
-		g_signal_handlers_block_by_func (name_selector_entry->destination_store,
-					 destination_row_deleted, name_selector_entry);
-		e_destination_store_remove_destination (name_selector_entry->destination_store,
-						destination);
-		g_signal_handlers_unblock_by_func (name_selector_entry->destination_store,
-					   destination_row_deleted, name_selector_entry);
-	}
-}
-
-static void
 sync_destination_at_position (ENameSelectorEntry *name_selector_entry, gint range_pos, gint *cursor_pos)
 {
 	EDestination *destination;
@@ -1160,7 +1138,7 @@ user_delete_text (ENameSelectorEntry *na
 	const gchar *text;
 	gint         index_start, index_end;
 	gint	     selection_start, selection_end;	
-	gunichar     str_context [2], str_b_context [2];;
+	gunichar     str_context [2], str_b_context [2];
 	gint         len;
 	gint         i;
 	gboolean     already_selected = FALSE;
@@ -1175,7 +1153,7 @@ user_delete_text (ENameSelectorEntry *na
 					       &selection_start, 
 					       &selection_end)) 
 		if ((g_utf8_get_char (g_utf8_offset_to_pointer (text, selection_end)) == 0) ||
-		    (g_utf8_get_char (g_utf8_offset_to_pointer (text, selection_end)) == ","))
+		    (g_utf8_get_char (g_utf8_offset_to_pointer (text, selection_end)) == (gunichar)","))
 			already_selected = TRUE;
 	
 	get_utf8_string_context (text, start_pos, str_context, 2);
@@ -1250,7 +1228,6 @@ user_delete_text (ENameSelectorEntry *na
 		name_selector_entry->type_ahead_complete_cb_id = 0;
 	}
 	
-end_of_user_delete_text:
 	g_signal_handlers_unblock_by_func (name_selector_entry, user_delete_text, name_selector_entry);
 }
 
@@ -2110,7 +2087,8 @@ e_name_selector_entry_init (ENameSelecto
   GConfClient *gconf;
   gconf = gconf_client_get_default();
   if (COMPLETION_CUE_MIN_LEN == 0) {
-	  if (COMPLETION_CUE_MIN_LEN = gconf_client_get_int (gconf, MINIMUM_QUERY_LENGTH, NULL));
+	  if ((COMPLETION_CUE_MIN_LEN = gconf_client_get_int (gconf, MINIMUM_QUERY_LENGTH, NULL)))
+		;
 	  else COMPLETION_CUE_MIN_LEN = 3;
   }
   g_object_unref (G_OBJECT (gconf));
Index: e-name-selector-list.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-list.c,v
retrieving revision 1.2
diff -u -p -r1.2 e-name-selector-list.c
--- e-name-selector-list.c	24 Apr 2006 06:46:54 -0000	1.2
+++ e-name-selector-list.c	17 Aug 2006 07:22:03 -0000
@@ -370,8 +370,7 @@ enl_tree_button_press_event (GtkWidget *
   	if ( !GTK_WIDGET_HAS_GRAB (list->popup))
         	enl_popup_grab (list);
   
-	
-	gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW (list->tree_view), event->x, event->y, &path, GTK_TREE_VIEW_DROP_BEFORE);
+	gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW (list->tree_view), event->x, event->y, &path, NULL);
 	selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW (list->tree_view));
 	if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (E_NAME_SELECTOR_ENTRY (list)->destination_store), &iter, path))
 		return FALSE;
@@ -655,7 +654,7 @@ e_name_selector_list_init (ENameSelector
 }
 
 ENameSelectorList *
-e_name_selector_list_new ()
+e_name_selector_list_new (void)
 {
 	return g_object_new (e_name_selector_list_get_type (), NULL);
 }
Index: e-passwords.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-passwords.c,v
retrieving revision 1.34
diff -u -p -r1.34 e-passwords.c
--- e-passwords.c	3 Aug 2006 06:23:01 -0000	1.34
+++ e-passwords.c	17 Aug 2006 07:22:03 -0000
@@ -97,8 +97,8 @@ struct _EPassMsg {
 	/* work variables */
 	GtkWidget *entry;
 	GtkWidget *check;
-	int ismain:1;
-	int noreply:1;		/* supress replies; when calling
+	guint ismain:1;
+	guint noreply:1;	/* supress replies; when calling
 				 * dispatch functions from others */
 };
 
@@ -446,7 +446,7 @@ ep_remember_password(EPassMsg *msg)
 		len = strlen (value);
 		pass64 = g_malloc0 ((len + 2) * 4 / 3 + 1);
 		state = save = 0;
-		base64_encode_close (value, len, FALSE, pass64, &state, &save);
+		base64_encode_close (value, len, FALSE, (guchar *)pass64, &state, &save);
 
 		gnome_config_private_set_string (path, pass64);
 		g_free (path);
@@ -800,7 +800,7 @@ ep_ask_password(EPassMsg *msg)
 {
 	GtkWidget *vbox;
 	int type = msg->flags & E_PASSWORDS_REMEMBER_MASK;
-	int noreply = msg->noreply;
+	guint noreply = msg->noreply;
 	AtkObject *a11y;
 
 	msg->noreply = 1;
@@ -1326,17 +1326,19 @@ base64_decode_step(unsigned char *in, in
 static char *
 decode_base64 (char *base64)
 {
-	char *plain, *pad = "==";
-	int len, out, state, save;
+	guchar *plain;
+	char *pad = "==";
+	int len, out, state;
+	unsigned int save;
 	
 	len = strlen (base64);
 	plain = g_malloc0 (len);
 	state = save = 0;
-	out = base64_decode_step (base64, len, plain, &state, &save);
+	out = base64_decode_step ((guchar *)base64, len, plain, &state, &save);
 	if (len % 4) {
-		base64_decode_step (pad, 4 - len % 4, plain + out,
+		base64_decode_step ((guchar *)pad, 4 - len % 4, plain + out,
 				    &state, &save);
 	}
 	
-	return plain;
+	return (char *)plain;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.