[Evolution-hackers] Patch to compile with pilot-link-0.12



Annoyingly, the pilot-link API changed from version 0.11 to 0.12, which
breaks Evolution's build inside the conduit code.

Attached is a patch against the Evolution 2.2.2 tarball that gets it to
compile against pilot-link-0.12  I haven't tested the results, but at
least it builds.

This isn't really committable until gnome-pilot is ported to the new
pilot-link API; hopefully it won't bitrot too much until that time
comes...

Dave

-- 
--- evolution-2.2.2/addressbook/conduit/address-conduit.c.port-to-pilot-link-0.12	2004-09-23 14:50:17.000000000 -0400
+++ evolution-2.2.2/addressbook/conduit/address-conduit.c	2005-04-30 02:22:44.000000000 -0400
@@ -789,7 +789,7 @@
 			      EAddrConduitContext *ctxt)
 {
 	GnomePilotRecord p;
-	static char record[0xffff];
+	static unsigned char record[0xffff];
 	
 	g_assert (local->addr != NULL );
 	
@@ -832,16 +832,16 @@
 	 */
 	if (local->local.ID != 0) {
 		struct Address addr;
-		char record[0xffff];
+		pi_buffer_t *buffer = pi_buffer_new (0xffff);
 		int cat = 0;
 		
 		if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
 					ctxt->dbi->db_handle,
-					local->local.ID, &record, 
-					NULL, NULL, NULL, &cat) > 0) {
+					local->local.ID, buffer, 
+					NULL, NULL, &cat) > 0) {
 			local->local.category = cat;
 			memset (&addr, 0, sizeof (struct Address));
-			unpack_Address (&addr, record, 0xffff);
+			unpack_Address (&addr, buffer->data, 0xffff);
 			for (i = 0; i < 5; i++) {
 				if (addr.entry[entryPhone1 + i])
 					local->addr->entry[entryPhone1 + i] = 
@@ -856,6 +856,8 @@
 			}
 			free_Address (&addr);
 		}
+
+		pi_buffer_free (buffer);
 	}
 
 	local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_GIVEN_NAME));
@@ -1161,7 +1163,7 @@
 	EBookQuery *query;
     	GList *l;
 	int len;
-	unsigned char *buf;
+	pi_buffer_t *buffer;
 	char *filename;
 	char *change_id;
 	gint num_records, add_records = 0, mod_records = 0, del_records = 0;
@@ -1244,9 +1246,9 @@
   	gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records);
   	gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records);
 
-	buf = (unsigned char*)g_malloc (0xffff);
+	buffer = pi_buffer_new (0xffff);
 	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
-			      (unsigned char *)buf, 0xffff);
+				0xffff, buffer);
 	
 	if (len < 0) {
 		WARN (_("Could not read pilot's Address application block"));
@@ -1255,8 +1257,8 @@
 					   _("Could not read pilot's Address application block"));
 		return -1;
 	}
-	unpack_AddressAppInfo (&(ctxt->ai), buf, len);
-	g_free (buf);
+	unpack_AddressAppInfo (&(ctxt->ai), buffer->data, len);
+	pi_buffer_free (buffer);
 
   	check_for_slow_setting (conduit, ctxt);
 	if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot
--- evolution-2.2.2/calendar/conduits/calendar/calendar-conduit.c.port-to-pilot-link-0.12	2005-04-30 01:51:32.000000000 -0400
+++ evolution-2.2.2/calendar/conduits/calendar/calendar-conduit.c	2005-04-30 02:15:02.000000000 -0400
@@ -751,7 +751,7 @@
 			      ECalConduitContext *ctxt)
 {
 	GnomePilotRecord p;
-	static char record[0xffff];
+	static unsigned char record[0xffff];
 
 	g_assert (local->comp != NULL);
 	g_assert (local->appt != NULL );
@@ -800,22 +800,24 @@
          * we don't overwrite them 
 	 */
 	if (local->local.ID != 0) {
-		struct Appointment appt;		
-		char record[0xffff];
+		struct Appointment appt;
+		pi_buffer_t *buffer = pi_buffer_new (0xffff);
 		int cat = 0;
 		
 		if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
 					ctxt->dbi->db_handle,
-					local->local.ID, &record, 
-					NULL, NULL, NULL, &cat) > 0) {
+					local->local.ID, buffer,
+					NULL, NULL, &cat) > 0) {
 			local->local.category = cat;
 			memset (&appt, 0, sizeof (struct Appointment));
-			unpack_Appointment (&appt, record, 0xffff);
+			unpack_Appointment (&appt, buffer->data, 0xffff);
 			local->appt->alarm = appt.alarm;
 			local->appt->advance = appt.advance;
 			local->appt->advanceUnits = appt.advanceUnits;
 			free_Appointment (&appt);
 		}
+
+		pi_buffer_free (buffer);
 	}
 
 	/* STOP: don't replace these with g_strdup, since free_Appointment
@@ -1342,7 +1344,7 @@
 	GnomePilotConduitSyncAbs *abs_conduit;
 	GList *removed = NULL, *added = NULL, *l;
 	int len;
-	unsigned char *buf;
+	pi_buffer_t *buffer;
 	char *filename, *change_id;
 	icalcomponent *icalcomp;
 	gint num_records, add_records = 0, mod_records = 0, del_records = 0;
@@ -1460,9 +1462,9 @@
 	gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records);
 	gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records);
 
-	buf = (unsigned char*)g_malloc (0xffff);
+	buffer = pi_buffer_new (0xffff);
 	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
-			      (unsigned char *)buf, 0xffff);
+				0xffff, buffer);
 	
 	if (len < 0) {
 		WARN (_("Could not read pilot's Calendar application block"));
@@ -1471,8 +1473,8 @@
 					   _("Could not read pilot's Calendar application block"));
 		return -1;
 	}
-	unpack_AppointmentAppInfo (&(ctxt->ai), buf, len);
-	g_free (buf);
+	unpack_AppointmentAppInfo (&(ctxt->ai), buffer->data, len);
+	pi_buffer_free (buffer);
 
 	check_for_slow_setting (conduit, ctxt);
 	if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot
--- evolution-2.2.2/calendar/conduits/todo/todo-conduit.c.port-to-pilot-link-0.12	2005-04-30 02:13:27.000000000 -0400
+++ evolution-2.2.2/calendar/conduits/todo/todo-conduit.c	2005-04-30 02:18:11.000000000 -0400
@@ -545,7 +545,7 @@
 			      EToDoConduitContext *ctxt)
 {
 	GnomePilotRecord p;
-	static char record[0xffff];
+	static unsigned char record[0xffff];
 
 	g_assert (local->comp != NULL);
 	g_assert (local->todo != NULL );
@@ -598,15 +598,17 @@
 
 	/* Don't overwrite the category */
 	if (local->local.ID != 0) {
-		char record[0xffff];
+		pi_buffer_t *buffer = pi_buffer_new (0xffff);
 		int cat = 0;
 		
 		if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
 					ctxt->dbi->db_handle,
-					local->local.ID, &record, 
-					NULL, NULL, NULL, &cat) > 0) {
+					local->local.ID, buffer, 
+					NULL, NULL, &cat) > 0) {
 			local->local.category = cat;			
 		}
+
+		pi_buffer_free (buffer);
 	}
 
 	/* STOP: don't replace these with g_strdup, since free_ToDo
@@ -861,7 +863,7 @@
 	GnomePilotConduitSyncAbs *abs_conduit;
 	GList *l;
 	int len;
-	unsigned char *buf;
+	pi_buffer_t *buffer;
 	char *filename, *change_id;
 	icalcomponent *icalcomp;
 	gint num_records, add_records = 0, mod_records = 0, del_records = 0;
@@ -951,9 +953,9 @@
 	gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records);
 	gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records);
 
-	buf = (unsigned char*)g_malloc (0xffff);
+	buffer = pi_buffer_new (0xffff);
 	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
-			      (unsigned char *)buf, 0xffff);
+				0xffff, buffer);
 	
 	if (len < 0) {
 		WARN (_("Could not read pilot's ToDo application block"));
@@ -962,8 +964,8 @@
 					   _("Could not read pilot's ToDo application block"));
 		return -1;
 	}
-	unpack_ToDoAppInfo (&(ctxt->ai), buf, len);
-	g_free (buf);
+	unpack_ToDoAppInfo (&(ctxt->ai), buffer->data, len);
+	pi_buffer_free (buffer);
 
 	check_for_slow_setting (conduit, ctxt);
 	if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot


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