[evolution-mapi] Add debugging for bin-to-rrule converter



commit c7286a3363e52ea71ddbf962e9b0618344547d7e
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 2 10:45:33 2012 +0100

    Add debugging for bin-to-rrule converter

 src/libexchangemapi/e-mapi-cal-recur-utils.c |    6 ++++++
 src/libexchangemapi/e-mapi-debug.c           |   10 ++++++----
 src/libexchangemapi/e-mapi-debug.h           |    3 +++
 3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/libexchangemapi/e-mapi-cal-recur-utils.c b/src/libexchangemapi/e-mapi-cal-recur-utils.c
index 404afca..8dc5abf 100644
--- a/src/libexchangemapi/e-mapi-cal-recur-utils.c
+++ b/src/libexchangemapi/e-mapi-cal-recur-utils.c
@@ -710,6 +710,12 @@ e_mapi_cal_util_bin_to_rrule (const guint8 *lpb, guint32 cb, ECalComponent *comp
 	GSList *exdate_list = NULL;
 	GByteArray fake_ba;
 
+	if (e_mapi_debug_is_enabled ()) {
+		e_mapi_debug_print ("Converting binary to RRULE:");
+		e_mapi_debug_dump_bin (lpb, cb, 3);
+		e_mapi_debug_print ("\n");
+	}
+
 	fake_ba.data = (guint8 *) lpb;
 	fake_ba.len = cb;
 
diff --git a/src/libexchangemapi/e-mapi-debug.c b/src/libexchangemapi/e-mapi-debug.c
index 4bb0414..994ed32 100644
--- a/src/libexchangemapi/e-mapi-debug.c
+++ b/src/libexchangemapi/e-mapi-debug.c
@@ -50,8 +50,10 @@ e_mapi_debug_print (const gchar *format, ...)
 	fflush (stdout);
 }
 
-static void
-dump_bin (const uint8_t *bin, uint32_t bin_sz, gint indent)
+void
+e_mapi_debug_dump_bin (const uint8_t *bin,
+		       uint32_t bin_sz,
+		       gint indent)
 {
 	gint k, l, last;
 
@@ -808,7 +810,7 @@ e_mapi_debug_dump_properties (struct mapi_SPropValue_array *properties,
 			break;
 		case PT_BINARY:
 			g_print (" (struct SBinary_short *) - %p Binary data follows (size %d): %s", &lpProp->value.bin, lpProp->value.bin.cb, lpProp->value.bin.cb > 0 ? "\n" : "");
-			dump_bin (lpProp->value.bin.lpb, lpProp->value.bin.cb, indent + 3);
+			e_mapi_debug_dump_bin (lpProp->value.bin.lpb, lpProp->value.bin.cb, indent + 3);
 			break;
 		case PT_MV_STRING8:
 			g_print (" (struct mapi_SLPSTRArray *) (%d items)", lpProp->value.MVszA.cValues);
@@ -853,7 +855,7 @@ e_mapi_debug_dump_properties (struct mapi_SPropValue_array *properties,
 			g_print (" PT_MV_BINARY (%d items)", lpProp->value.MVbin.cValues);
 			for (j = 0; j < lpProp->value.MVbin.cValues; j++) {
 				g_print ("\n%*sitem[%d] (size %d)\n", indent + 2, "", j, lpProp->value.MVbin.bin[j].cb);
-				dump_bin (lpProp->value.MVbin.bin[j].lpb, lpProp->value.MVbin.bin[j].cb, indent + 3);
+				e_mapi_debug_dump_bin (lpProp->value.MVbin.bin[j].lpb, lpProp->value.MVbin.bin[j].cb, indent + 3);
 			}
 			break;
 		default:
diff --git a/src/libexchangemapi/e-mapi-debug.h b/src/libexchangemapi/e-mapi-debug.h
index 3056aff..0aea241 100644
--- a/src/libexchangemapi/e-mapi-debug.h
+++ b/src/libexchangemapi/e-mapi-debug.h
@@ -30,6 +30,9 @@ G_BEGIN_DECLS
 gboolean	e_mapi_debug_is_enabled (void);
 void		e_mapi_debug_print (const gchar *format, ...);
 
+void		e_mapi_debug_dump_bin		(const uint8_t *bin,
+						 uint32_t bin_sz,
+						 gint indent);
 void		e_mapi_debug_dump_properties	(struct mapi_SPropValue_array *properties,
 						 gint indent);
 void		e_mapi_debug_dump_object	(EMapiObject *object,



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