[evolution-patches] patch to quiet down libebook



wrap all the printfs with a debug d(), expanded out if DEBUG_EBOOK is
defined.

Chris
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.89
diff -u -r1.89 ChangeLog
--- ChangeLog	12 Feb 2004 22:41:18 -0000	1.89
+++ ChangeLog	13 Feb 2004 17:21:32 -0000
@@ -1,3 +1,32 @@
+2004-02-13  Chris Toshok  <toshok ximian com>
+
+	* libebook/e-vcard.c (e_vcard_attribute_add_value_decoded): wrap
+	printf with d().
+	(_evc_base64_encode_close): unifdef the d(printf...) stuff.
+	(_evc_base64_encode_step): same.
+
+	* libebook/e-contact.c (e_contact_set_property): wrap printf with d().
+	(e_contact_set): same.
+
+	* libebook/e-book-view.c: add debug macro (unused at the moment.)
+
+	* libebook/e-book.c (e_book_add_contact): wrap printf with d().
+	(e_book_response_add_contact): same.
+	(e_book_response_get_contact): same.
+	(e_book_response_get_book_view): same.
+	(e_book_response_remove): same.
+
+	* libebook/e-book-listener.c (impl_BookListener_respond_get_view):
+	wrap printf with d().
+
+	* libebook/e-book-view-listener.c
+	(impl_BookViewListener_notify_contacts_added): wrap printf with
+	d().
+	(impl_BookViewListener_notify_contacts_removed): same.
+	(impl_BookViewListener_notify_contacts_changed): same.
+	(impl_BookViewListener_notify_sequence_complete): same.
+	(impl_BookViewListener_notify_progress): same.
+
 2004-02-12  Chris Toshok  <toshok ximian com>
 
 	* libebook/e-book-listener.c
Index: libebook/e-book-listener.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-book-listener.c,v
retrieving revision 1.7
diff -u -r1.7 e-book-listener.c
--- libebook/e-book-listener.c	12 Feb 2004 22:41:19 -0000	1.7
+++ libebook/e-book-listener.c	13 Feb 2004 17:21:32 -0000
@@ -15,6 +15,12 @@
 #include "e-book-listener.h"
 #include "e-book-marshal.h"
 
+#ifdef DEBUG_EBOOK
+#define d(x) (printf("%s(%d): ", __FILE__, __LINE__),(x))
+#else
+#define d(x)
+#endif
+
 extern GMainContext *_ebook_context;
 
 static EBookStatus e_book_listener_convert_status (GNOME_Evolution_Addressbook_CallStatus status);
@@ -160,7 +166,7 @@
 	EBookListener *listener = E_BOOK_LISTENER (bonobo_object (servant));
 	EBookListenerResponse response;
 
-	printf ("impl_BookListener_respond_get_view\n");
+	d(printf ("impl_BookListener_respond_get_view\n"));
 
 	if (listener->priv->stopped)
 		return;
Index: libebook/e-book-view-listener.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-book-view-listener.c,v
retrieving revision 1.4
diff -u -r1.4 e-book-view-listener.c
--- libebook/e-book-view-listener.c	11 Feb 2004 17:34:20 -0000	1.4
+++ libebook/e-book-view-listener.c	13 Feb 2004 17:21:32 -0000
@@ -16,6 +16,12 @@
 #include "e-contact.h"
 #include "e-book-marshal.h"
 
+#ifdef DEBUG_EBOOK
+#define d(x) (printf("%s(%d): ", __FILE__, __LINE__),(x))
+#else
+#define d(x)
+#endif
+
 static EBookViewStatus e_book_view_listener_convert_status (GNOME_Evolution_Addressbook_CallStatus status);
 
 enum {
@@ -198,7 +204,7 @@
 {
 	EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
 
-	printf ("impl_BookViewListener_notify_contacts_added\n");
+	d(printf ("impl_BookViewListener_notify_contacts_added\n"));
 
 	e_book_view_listener_queue_sequence_event (
 		listener, ContactsAddedEvent, vcards);
@@ -211,7 +217,7 @@
 {
 	EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
 
-	printf ("impl_BookViewListener_notify_contacts_removed\n");
+	d(printf ("impl_BookViewListener_notify_contacts_removed\n"));
 
 	e_book_view_listener_queue_idlist_event (listener, ContactsRemovedEvent, ids);
 }
@@ -223,7 +229,7 @@
 {
 	EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
 
-	printf ("impl_BookViewListener_notify_contacts_changed\n");
+	d(printf ("impl_BookViewListener_notify_contacts_changed\n"));
 
 	e_book_view_listener_queue_sequence_event (
 		listener, ContactsModifiedEvent, vcards);
@@ -236,7 +242,7 @@
 {
 	EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
 
-	printf ("impl_BookViewListener_notify_sequence_complete\n");
+	d(printf ("impl_BookViewListener_notify_sequence_complete\n"));
 
 	e_book_view_listener_queue_status_event (listener, SequenceCompleteEvent,
 						 e_book_view_listener_convert_status (status));
@@ -250,7 +256,7 @@
 {
 	EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object (servant));
 
-	printf ("impl_BookViewListener_notify_progress\n");
+	d(printf ("impl_BookViewListener_notify_progress\n"));
 
 	e_book_view_listener_queue_message_event (listener, StatusMessageEvent, message);
 }
Index: libebook/e-book-view.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-book-view.c,v
retrieving revision 1.4
diff -u -r1.4 e-book-view.c
--- libebook/e-book-view.c	11 Feb 2004 17:34:20 -0000	1.4
+++ libebook/e-book-view.c	13 Feb 2004 17:21:32 -0000
@@ -15,6 +15,12 @@
 #include "e-book.h"
 #include "e-book-marshal.h"
 
+#ifdef DEBUG_EBOOK
+#define d(x) (printf("%s(%d): ", __FILE__, __LINE__),(x))
+#else
+#define d(x)
+#endif
+
 static GObjectClass *parent_class;
 
 struct _EBookViewPrivate {
Index: libebook/e-book.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-book.c,v
retrieving revision 1.26
diff -u -r1.26 e-book.c
--- libebook/e-book.c	12 Feb 2004 22:41:19 -0000	1.26
+++ libebook/e-book.c	13 Feb 2004 17:21:33 -0000
@@ -21,6 +21,12 @@
 #include "e-book-marshal.h"
 #include "e-book-listener.h"
 
+#ifdef DEBUG_EBOOK
+#define d(x) (printf("%s(%d): ", __FILE__, __LINE__),(x))
+#else
+#define d(x)
+#endif
+
 GMainContext *_ebook_context;
 
 static GObjectClass *parent_class;
@@ -201,7 +207,7 @@
 	CORBA_Environment ev;
 	char *vcard_str;
 
-	printf ("e_book_add_contact\n");
+	d(printf ("e_book_add_contact\n"));
 
 	e_return_error_if_fail (book && E_IS_BOOK (book), E_BOOK_ERROR_INVALID_ARG);
 	e_return_error_if_fail (contact && E_IS_CONTACT (contact), E_BOOK_ERROR_INVALID_ARG);
@@ -277,7 +283,7 @@
 {
 	EBookOp *op;
 
-	printf ("e_book_response_add_contact\n");
+	d(printf ("e_book_response_add_contact\n"));
 
 	op = e_book_get_op (book);
 
@@ -768,7 +774,7 @@
 {
 	EBookOp *op;
 
-	printf ("e_book_response_get_contact\n");
+	d(printf ("e_book_response_get_contact\n"));
 
 	op = e_book_get_op (book);
 
@@ -1046,13 +1052,13 @@
 
 	EBookOp *op;
 
-	printf ("e_book_response_get_book_view\n");
+	d(printf ("e_book_response_get_book_view\n"));
 
 	op = e_book_get_op (book);
 
 	if (op == NULL) {
-	  g_warning ("e_book_response_get_book_view: Cannot find operation ");
-	  return;
+		g_warning ("e_book_response_get_book_view: Cannot find operation ");
+		return;
 	}
 
 	g_mutex_lock (op->mutex);
@@ -1167,8 +1173,8 @@
 	op = e_book_get_op (book);
 
 	if (op == NULL) {
-	  g_warning ("e_book_response_get_contacts: Cannot find operation ");
-	  return;
+		g_warning ("e_book_response_get_contacts: Cannot find operation ");
+		return;
 	}
 
 	g_mutex_lock (op->mutex);
@@ -1264,8 +1270,8 @@
 	op = e_book_get_op (book);
 
 	if (op == NULL) {
-	  g_warning ("e_book_response_get_contacts: Cannot find operation ");
-	  return;
+		g_warning ("e_book_response_get_contacts: Cannot find operation ");
+		return;
 	}
 
 	g_mutex_lock (op->mutex);
@@ -1303,8 +1309,8 @@
 	op = e_book_get_op (book);
 
 	if (op == NULL) {
-	  g_warning ("e_book_response_generic: Cannot find operation ");
-	  return;
+		g_warning ("e_book_response_generic: Cannot find operation ");
+		return;
 	}
 
 	g_mutex_lock (op->mutex);
@@ -1402,8 +1408,8 @@
 	op = e_book_get_op (book);
 
 	if (op == NULL) {
-	  g_warning ("e_book_response_open: Cannot find operation ");
-	  return;
+		g_warning ("e_book_response_open: Cannot find operation ");
+		return;
 	}
 
 	g_mutex_lock (op->mutex);
@@ -1496,13 +1502,13 @@
 {
 	EBookOp *op;
 
-	printf ("e_book_response_remove\n");
+	d(printf ("e_book_response_remove\n"));
 
 	op = e_book_get_op (book);
 
 	if (op == NULL) {
-	  g_warning ("e_book_response_remove: Cannot find operation ");
-	  return;
+		g_warning ("e_book_response_remove: Cannot find operation ");
+		return;
 	}
 
 	g_mutex_lock (op->mutex);
Index: libebook/e-contact.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-contact.c,v
retrieving revision 1.22
diff -u -r1.22 e-contact.c
--- libebook/e-contact.c	4 Feb 2004 17:34:45 -0000	1.22
+++ libebook/e-contact.c	13 Feb 2004 17:21:34 -0000
@@ -30,6 +30,12 @@
 #include "e-book.h"
 #include "e-name-western.h"
 
+#ifdef DEBUG_EBOOK
+#define d(x) (printf("%s(%d): ", __FILE__, __LINE__),(x))
+#else
+#define d(x)
+#endif
+
 struct _EContactPrivate {
 };
 
@@ -822,7 +828,7 @@
 				if (!sval || !*sval)
 					return;
 
-				printf ("adding new %s\n", info->vcard_field_name);
+				d(printf ("adding new %s\n", info->vcard_field_name));
 
 				attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
 				e_vcard_add_attribute (E_VCARD (contact), attr);
@@ -883,7 +889,7 @@
 		void *data = info->t & E_CONTACT_FIELD_TYPE_STRUCT ? g_value_get_boxed (value) : (char*)g_value_get_string (value);
 
 		if (attr && data) {
-			printf ("overwriting existing %s\n", info->vcard_field_name);
+			d(printf ("overwriting existing %s\n", info->vcard_field_name));
 			/* remove all existing values and parameters.
 			   the setter will add the correct ones */
 			e_vcard_attribute_remove_values (attr);
@@ -892,7 +898,7 @@
 			info->struct_setter (contact, attr, data);
 		}
 		else if (data) {
-			printf ("adding new %s\n", info->vcard_field_name);
+			d(printf ("adding new %s\n", info->vcard_field_name));
 			attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
 
 			e_vcard_add_attribute (E_VCARD (contact), attr);
@@ -900,7 +906,7 @@
 			info->struct_setter (contact, attr, data);
 		}
 		else if (attr) {
-			printf ("removing %s\n", info->vcard_field_name);
+			d(printf ("removing %s\n", info->vcard_field_name));
 
 			e_vcard_remove_attribute (E_VCARD (contact), attr);
 		}
@@ -911,7 +917,7 @@
 		/* first we search for an attribute we can overwrite */
 		attr = e_contact_get_first_attr (contact, info->vcard_field_name);
 		if (attr) {
-			printf ("setting %s to `%s'\n", info->vcard_field_name, g_value_get_string (value));
+			d(printf ("setting %s to `%s'\n", info->vcard_field_name, g_value_get_string (value)));
 			e_vcard_attribute_remove_values (attr);
 			e_vcard_attribute_add_value (attr, g_value_get_boolean (value) ? "TRUE" : "FALSE");
 		}
@@ -929,7 +935,7 @@
 		/* first we search for an attribute we can overwrite */
 		attr = e_contact_get_first_attr (contact, info->vcard_field_name);
 		if (attr) {
-			printf ("setting %s to `%s'\n", info->vcard_field_name, sval);
+			d(printf ("setting %s to `%s'\n", info->vcard_field_name, sval));
 			e_vcard_attribute_remove_values (attr);
 			if (sval)
 				e_vcard_attribute_add_value (attr, sval);
@@ -1401,7 +1407,7 @@
 void
 e_contact_set (EContact *contact, EContactField field_id, gpointer value)
 {
-	printf ("e_contact_set (%p, %d, %p)\n", contact, field_id, value);
+	d(printf ("e_contact_set (%p, %d, %p)\n", contact, field_id, value));
 
 	g_return_if_fail (contact && E_IS_CONTACT (contact));
 	g_return_if_fail (field_id >= 1 && field_id <= E_CONTACT_FIELD_LAST);
Index: libebook/e-vcard.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-vcard.c,v
retrieving revision 1.8
diff -u -r1.8 e-vcard.c
--- libebook/e-vcard.c	3 Feb 2004 20:11:51 -0000	1.8
+++ libebook/e-vcard.c	13 Feb 2004 17:21:35 -0000
@@ -26,6 +26,12 @@
 #include <ctype.h>
 #include "e-vcard.h"
 
+#ifdef DEBUG_EBOOK
+#define d(x) (printf("%s(%d): ", __FILE__, __LINE__),(x))
+#else
+#define d(x)
+#endif
+
 #define CRLF "\r\n"
 
 typedef enum {
@@ -523,16 +529,13 @@
 		*end = '\0';
 	}
 	
-#if DEBUG_FOLDING
-	printf ("BEFORE FOLDING:\n");
-	printf (str);
-#endif
 	buf = fold_lines (buf);
 
-#if DEBUG_FOLDING
-	printf ("\n\nAFTER FOLDING:\n");
-	printf (buf);
-#endif
+	d(printf ("BEFORE FOLDING:\n"));
+	d(printf (str));
+	d(printf ("\n\nAFTER FOLDING:\n"));
+	d(printf (buf));
+
 	p = buf;
 
 	attr = read_attribute (&p);
@@ -958,8 +961,8 @@
 		/* make sure the decoded list is up to date */
 		e_vcard_attribute_get_values_decoded (attr);
 
-		printf ("base64 encoded value: %s\n", b64_data);
-		printf ("original length: %d\n", len);
+		d(printf ("base64 encoded value: %s\n", b64_data));
+		d(printf ("original length: %d\n", len));
 
 		attr->values = g_list_append (attr->values, b64_data);
 		attr->decoded_values = g_list_append (attr->decoded_values, decoded);
@@ -1243,12 +1246,10 @@
 	c1 = ((unsigned char *)save)[1];
 	c2 = ((unsigned char *)save)[2];
 	
-#if 0
 	d(printf("mode = %d\nc1 = %c\nc2 = %c\n",
 		 (int)((char *)save)[0],
 		 (int)((char *)save)[1],
 		 (int)((char *)save)[2]));
-#endif
 
 	switch (((char *)save)[0]) {
 	case 2:
@@ -1289,9 +1290,7 @@
 	inptr = in;
 	outptr = out;
 
-#if 0
 	d(printf("we have %d chars, and %d saved chars\n", len, ((char *)save)[0]));
-#endif
 
 	if (len + ((char *)save)[0] > 2) {
 		unsigned char *inend = in+len-2;
@@ -1329,11 +1328,9 @@
 		*state = already;
 	}
 
-#if 0
 	d(printf("state = %d, len = %d\n",
 		 (int)((char *)save)[0],
 		 len));
-#endif
 
 	if (len>0) {
 		register char *saveout;
@@ -1349,12 +1346,10 @@
 		((char *)save)[0]+=len;
 	}
 
-#if 0
 	d(printf("mode = %d\nc1 = %c\nc2 = %c\n",
 		 (int)((char *)save)[0],
 		 (int)((char *)save)[1],
 		 (int)((char *)save)[2]));
-#endif
 
 	return outptr-out;
 }


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