Re: gnome-pilot Evolution conduits ported to pilot-link 0.12pre4



--- Matt Davey <mcdavey mrao cam ac uk> wrote:
> > I'm planning on submitting them to the evolution developers soon so
> > they'll make it into Evolution 2.8.
> 
> I don't have time right now to do a full review, but I spotted what may
> be an issue in the first patch section (may be a pattern).
> 
> 
> > Index: address-conduit.c
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/addressbook/conduit/address-conduit.c,v
> > retrieving revision 1.88
> > diff -u -r1.88 address-conduit.c
> > --- address-conduit.c	6 Dec 2005 08:43:37 -0000	1.88
> > +++ address-conduit.c	20 Aug 2006 19:50:34 -0000
> [....]
> >  static GnomePilotRecord
> >  local_record_to_pilot_record (EAddrLocalRecord *local,
> > -			      EAddrConduitContext *ctxt)
> > +			      EAddrConduitContext *ctxt,
> > +			      unsigned char *record,
> > +			      int maxRecordLen)
> >  {
> >  	GnomePilotRecord p;
> > -	static char record[0xffff];
> >  	
> >  	g_assert (local->addr != NULL );
> >  	
> > @@ -804,8 +825,19 @@
> >  	p.secret = local->local.secret;
> >  
> >  	/* Generate pilot record structure */
> > +#ifdef PILOT_LINK_0_12
> > +	{
> > +		pi_buffer_t piBuf;
> > +		piBuf.data = record;
> > +		piBuf.allocated = maxRecordLen;
> > +		piBuf.used = 0;
> > +		p.length = pack_Address(local->addr, &piBuf, address_v1);
> > +		p.record = piBuf.data;
> > +	}
> > +#else
> >  	p.record = record;
> > -	p.length = pack_Address (local->addr, p.record, 0xffff);
> > +	p.length = pack_Address (local->addr, p.record, maxRecordLen);
> > +#endif
> 
> 
> In the above code, the user supplies *record.  This memory is then
> assigned to piBuf.data, and may therefore be freed by pack_Address
> if it needs to reallocate the pi_buffer_t.  So, if the user passes
> in a pointer to a static array we could be in trouble.
> 
> One of the good things (sorry, David!) to come out of fedora's packaging
> of 0.12.0pre was that the evo conduits got ported to the 0.12.0 API
> as a fedora patch.  They didn't make it backwards compatible with 0.11.8,
> but it would be worth comparing your patch to the fedora patch (as we'll
> probably find issues in both that way!).  I'll append the patch here.
> 
> Would be great to submit a patch to evolution.  I'd cc jpr and fejj.

I used the fedora patch as a starting place for much of what I submitted. When I originally looked
at it, I thought that their patch was doing too much extra work. Now it's obvious that there was a
reason for letting pack_Address() and the others allocate the memory for piBuf. I believe that
this was the cause of my recent (last day or two) problems with losing Memos and Contacts entries
when doing a Copy To Pilot or Copy From Pilot.

With the attached changes (basically from the Fedora patch), it seems to work in all sync modes.
I've kept the "record" passed into the function to allow the calling function to control how it's
created, but left pack_Address() and the others allocate the piBuf memory.

Nathan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Index: acinclude.m4
===================================================================
RCS file: /cvs/gnome/evolution/acinclude.m4,v
retrieving revision 1.9
diff -u -r1.9 acinclude.m4
--- acinclude.m4	12 Jun 2006 12:52:02 -0000	1.9
+++ acinclude.m4	27 Aug 2006 18:28:37 -0000
@@ -268,3 +268,119 @@
   AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
   AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
 ])
+
+# PILOT_LINK_CHECK
+# Adds --with-pisock and determines the verion of the pisock
+#
+
+AC_SUBST(PISOCK_CFLAGS)
+AC_SUBST(PISOCK_LIBS)
+
+AC_DEFUN([PILOT_LINK_HOOK],[
+	AC_ARG_WITH(pisock,
+	[  --with-pisock            Specify prefix for pisock files],[
+	if test x$withval = xyes; then
+	    dnl Note that an empty true branch is not valid sh syntax.
+	    ifelse([$1], [], :, [$1])
+	else
+	    PISOCK_CFLAGS="-I$withval/include"
+	    incdir="$withval/include"
+	    PISOCK_LIBS="-L$withval/lib -lpisock -lpisync"
+	    AC_MSG_CHECKING("for existance of $withval/lib/libpisock.so")
+	    if test -r $withval/lib/libpisock.so; then
+		AC_MSG_RESULT(yes)
+	    else
+		AC_MSG_ERROR([Unable to find libpisock. Try  http://www.pilot-link.org.])
+	    fi
+	fi
+	])
+
+	if test x$PISOCK_CFLAGS = x; then
+	    AC_CHECK_HEADER(pi-version.h, [incdir="/usr/include"], [
+	    AC_CHECK_HEADER(libpisock/pi-version.h, [PISOCK_CFLAGS="-I/usr/include/libpisock"
+	                                             piversion_include="libpisock/pi-version.h"
+						     incdir="/usr/include/libpisock"
+                                                    ], [
+	    AC_CHECK_HEADER($prefix/include/pi-version.h, [PISOCK_CFLAGS="-I$prefix/include/libpisock"
+	                                                   piversion_include="$prefix/include/pi-version.h"
+						           if test x$PISOCK_LIBDIR = x; then
+							      incdir="$prefix/include"
+							      PISOCK_LIBS="-L$prefix/lib -lpisock -lpisync"
+                                                           fi							  ],
+	    AC_MSG_ERROR([Unable to find pi-version.h])) 
+	    ])
+	    ])
+	fi
+		
+	if test "x$PISOCK_LIBS" = "x"; then
+		AC_CHECK_LIB(pisock, pi_accept, [ PISOCK_LIBS="-lpisock -lpisync"], 
+			[ AC_MSG_ERROR([Unable to find libpisock. Try http://www.pilot-link.org.]) ])
+	fi
+	
+	AC_ARG_ENABLE(pilotlinktest,
+		[  --enable-pilotlinktest   Test for correct version of pilot-link],
+		[testplversion=$enableval],
+		[ testplversion=yes ]
+	)
+
+	if test x$piversion_include = x; then
+		piversion_include="pi-version.h"
+	fi
+
+	pi_major=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_VERSION'|sed 's/#define PILOT_LINK_VERSION \([[0-9]]*\)/\1/'`
+	pi_minor=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_MAJOR'|sed 's/#define PILOT_LINK_MAJOR \([[0-9]]*\)/\1/'`
+	pi_micro=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_MINOR'|sed 's/#define PILOT_LINK_MINOR \([[0-9]]*\)/\1/'`
+	pi_patch=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_PATCH'|sed 's/#define PILOT_LINK_PATCH \"\(.*\)\"/\1/'`
+
+	PILOT_LINK_MAJOR="$pi_major"
+	PILOT_LINK_MINOR="$pi_minor"
+	PILOT_LINK_MICRO="$pi_micro"
+	PILOT_LINK_PATCH="$pi_patch"
+	PILOT_LINK_VERSION="$pi_major.$pi_minor.$pi_micro$pi_patch"
+
+	if test x$testplversion = xyes; then
+		AC_MSG_CHECKING([for pilot-link version >= $1])
+		pl_ma=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+		pl_mi=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+		pl_mc=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+		CFLAGS_save="$CFLAGS"
+		CFLAGS="$CFLAGS $PISOCK_CFLAGS"
+		AC_TRY_RUN(
+			[
+			#include <$piversion_include>
+			int main(int argc,char *argv[]) {
+				if (PILOT_LINK_VERSION == $pl_ma) {
+					if (PILOT_LINK_MAJOR == $pl_mi) {
+						if (PILOT_LINK_MINOR >= $pl_mc) {
+							return 0;
+				       	  	}
+					} else if (PILOT_LINK_MAJOR > $pl_mi) {
+						return 0;
+					}
+				} else if (PILOT_LINK_VERSION > $pl_ma) {
+					return 0;
+				}
+				return 1;
+			}
+			],
+			[AC_MSG_RESULT([yes (found $PILOT_LINK_VERSION)])],
+			[AC_MSG_ERROR([pilot-link >= $1 required])],
+			[AC_MSG_WARN([No action taken for crosscompile])]
+		)
+		CFLAGS="$CFLAGS_save"
+	fi
+
+	unset piversion_include
+	unset pi_verion
+	unset pi_major
+	unset pi_minor
+	unset pi_patch
+	unset incdir
+	unset pl_mi
+	unset pl_ma
+	unset pl_ve
+])
+
+AC_DEFUN([PILOT_LINK_CHECK],[
+	PILOT_LINK_HOOK($1,[],nofailure)
+])
\ No newline at end of file
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.912
diff -u -r1.912 configure.in
--- configure.in	21 Aug 2006 10:43:17 -0000	1.912
+++ configure.in	27 Aug 2006 18:28:38 -0000
@@ -606,8 +606,22 @@
 	fi
 fi
 AM_CONDITIONAL(ENABLE_PILOT_CONDUITS, test "x$enable_pilot_conduits" = "xyes")
+dnl ******************************
+dnl If pilot conduits are enabled, check version of pilot-link
+dnl ******************************
 if test x$enable_pilot_conduits = xyes; then
    msg_pilot=yes
+
+   PILOT_LINK_CHECK(0.11.4)
+   AC_SUBST(PILOT_LINK_MAJOR)
+   AC_SUBST(PILOT_LINK_MINOR)
+   AC_SUBST(PILOT_LINK_MICRO)
+   AC_SUBST(PILOT_LINK_PATCH)
+   AC_SUBST(PILOT_LINK_VERSION)
+
+   if test $PILOT_LINK_MINOR -ge 12; then
+      AC_DEFINE(PILOT_LINK_0_12,,[Building against pilot-link 0.12.0 or greater])
+   fi
 else
    msg_pilot=no
 fi
Index: addressbook/conduit/address-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/conduit/address-conduit.c,v
retrieving revision 1.88
diff -u -r1.88 address-conduit.c
--- addressbook/conduit/address-conduit.c	6 Dec 2005 08:43:37 -0000	1.88
+++ addressbook/conduit/address-conduit.c	27 Aug 2006 18:28:39 -0000
@@ -462,6 +462,9 @@
 {
 	static char buff[ 4096 ];
 	struct Address addr;
+#ifdef PILOT_LINK_0_12
+	pi_buffer_t piBuf;
+#endif
 
 	if (remote == NULL) {
 		sprintf (buff, "[NULL]");
@@ -469,7 +472,14 @@
 	}
 
 	memset (&addr, 0, sizeof (struct Address));
+#ifdef PILOT_LINK_0_12
+	piBuf.data = remote->record;
+	piBuf.allocated = remote->length;
+	piBuf.used = remote->length;
+	unpack_Address(&addr, &piBuf, address_v1);
+#else
 	unpack_Address (&addr, remote->record, remote->length);
+#endif
 
 	g_snprintf (buff, 4096, "['%s' '%s' '%s']",
 		    addr.entry[entryLastname] ?
@@ -786,12 +796,23 @@
 	}
 }
 
+/* convert a local EAddrLocalRecord to a GnomePilotRecord for the PDA
+ * 
+ * @param local local Evolution address record
+ * @param ctxt conduit context
+ * @param record record to use for GnomePilotRecord. Allow the calling
+ *               function to determine if the record should be allocated
+ *               dynamically or statically.
+ * @param maxRecordLen size of *record (max amount of data that can be put
+ *                      into record)
+ */
 static GnomePilotRecord
 local_record_to_pilot_record (EAddrLocalRecord *local,
-			      EAddrConduitContext *ctxt)
+			      EAddrConduitContext *ctxt,
+			      unsigned char *record,
+			      int maxRecordLen)
 {
 	GnomePilotRecord p;
-	static char record[0xffff];
 	
 	g_assert (local->addr != NULL );
 	
@@ -802,10 +823,30 @@
 	p.attr = local->local.attr;
 	p.archived = local->local.archived;
 	p.secret = local->local.secret;
+	
+	memset(record, 0, maxRecordLen);
 
 	/* Generate pilot record structure */
+#ifdef PILOT_LINK_0_12
+	{
+		pi_buffer_t piBuf;
+		memset (&piBuf, 0, sizeof (piBuf));
+
+		pack_Address(local->addr, &piBuf, address_v1);
+		if(piBuf.used > 0) {
+			memcpy(record, piBuf.data, MIN(piBuf.used, maxRecordLen) );
+		}
+		
+		p.length = piBuf.used;
+		p.record = record;
+		if(piBuf.data) {
+			free(piBuf.data);
+		}
+	}
+#else
 	p.record = record;
-	p.length = pack_Address (local->addr, p.record, 0xffff);
+	p.length = pack_Address (local->addr, p.record, maxRecordLen);
+#endif
 
 	return p;	
 }
@@ -834,16 +875,41 @@
 	 */
 	if (local->local.ID != 0) {
 		struct Address addr;
-		char record[0xffff];
+#ifdef PILOT_LINK_0_12
+		pi_buffer_t *piBuf;
+#else
+		unsigned char record[0xffff];
+#endif
 		int cat = 0;
+		int dlpReadRetval = 0;
+
 		
-		if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
-					ctxt->dbi->db_handle,
-					local->local.ID, &record, 
-					NULL, NULL, NULL, &cat) > 0) {
+#ifdef PILOT_LINK_0_12
+		piBuf = pi_buffer_new(0xffff);
+		if(piBuf == NULL) {
+			WARN( _("local_record_from_ecard: no more memory to allocate") );
+			return;
+		}
+		dlpReadRetval = dlp_ReadRecordById(ctxt->dbi->pilot_socket,
+		                                  ctxt->dbi->db_handle,
+		                                  local->local.ID, piBuf,
+		                                  NULL, NULL, &cat);
+
+#else
+		dlpReadRetval = dlp_ReadRecordById(ctxt->dbi->pilot_socket,
+						  ctxt->dbi->db_handle,
+						  local->local.ID, &record,
+						  NULL, NULL, NULL, &cat);
+#endif
+
+		if (dlpReadRetval > 0) {
 			local->local.category = cat;
 			memset (&addr, 0, sizeof (struct Address));
+#ifdef PILOT_LINK_0_12
+			unpack_Address(&addr, piBuf, address_v1);
+#else
 			unpack_Address (&addr, record, 0xffff);
+#endif
 			for (i = 0; i < 5; i++) {
 				if (addr.entry[entryPhone1 + i])
 					local->addr->entry[entryPhone1 + i] = 
@@ -858,6 +924,10 @@
 			}
 			free_Address (&addr);
 		}
+		
+#ifdef PILOT_LINK_0_12
+		pi_buffer_free(piBuf);
+#endif
 	}
 
 	local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_GIVEN_NAME));
@@ -1022,7 +1092,17 @@
 
 	g_return_val_if_fail(remote!=NULL,NULL);
 	memset (&address, 0, sizeof (struct Address));
+#ifdef PILOT_LINK_0_12
+	{
+		pi_buffer_t piBuf;
+		piBuf.data = remote->record;
+		piBuf.allocated = remote->length;
+		piBuf.used = remote->length;
+		unpack_Address(&address, &piBuf, address_v1);
+	}
+#else
 	unpack_Address (&address, remote->record, remote->length);
+#endif
 
 	if (in_contact == NULL)
 		contact = e_contact_new ();
@@ -1212,7 +1292,11 @@
 	EBookQuery *query;
     	GList *l;
 	int len;
+#ifdef PILOT_LINK_0_12
+	pi_buffer_t *piBuf;
+#else
 	unsigned char *buf;
+#endif
 	char *filename;
 	char *change_id;
 	char *auth;
@@ -1302,9 +1386,26 @@
   	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);
 
+#ifdef PILOT_LINK_0_12
+	piBuf = pi_buffer_new(0xffff);
+	if(piBuf == NULL) {
+		WARN (_("pre_sync(): Error allocating pi_buffer_t memory"));
+		gnome_pilot_conduit_error (conduit,
+			_("pre_sync(): Error allocating pi_buffer_t memory"));
+		return -1;
+	}
+	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0, -1, piBuf);
+#else
 	buf = (unsigned char*)g_malloc (0xffff);
+	if(buf == NULL) {
+		WARN (_("pre_sync(): Error allocating buf memory"));
+		gnome_pilot_conduit_error (conduit,
+			_("pre_sync(): Error allocating buf memory"));
+		return -1;
+	}
 	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
 			      (unsigned char *)buf, 0xffff);
+#endif
 	
 	if (len < 0) {
 		WARN (_("Could not read pilot's Address application block"));
@@ -1313,8 +1414,13 @@
 					   _("Could not read pilot's Address application block"));
 		return -1;
 	}
+#ifdef PILOT_LINK_0_12
+	unpack_AddressAppInfo (&(ctxt->ai), piBuf->data, len);
+	pi_buffer_free(piBuf);
+#else
 	unpack_AddressAppInfo (&(ctxt->ai), buf, len);
 	g_free (buf);
+#endif
 
   	check_for_slow_setting (conduit, ctxt);
 	if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot
@@ -1494,6 +1600,7 @@
 {
 	GnomePilotRecord local_pilot;
 	int retval = 0;
+	static unsigned char record[0xffff];
 
 	LOG (g_message ("compare: local=%s remote=%s...\n",
 			print_local (local), print_remote (remote)));
@@ -1501,7 +1608,7 @@
 	g_return_val_if_fail (local != NULL, -1);
 	g_return_val_if_fail (remote != NULL, -1);
 
-	local_pilot = local_record_to_pilot_record (local, ctxt);
+	local_pilot = local_record_to_pilot_record (local, ctxt, record, sizeof(record));
 
 	if (remote->length != local_pilot.length
 	    || memcmp (local_pilot.record, remote->record, remote->length))
@@ -1693,9 +1800,11 @@
 	 GnomePilotRecord *remote,
 	 EAddrConduitContext *ctxt)
 {
+	static unsigned char record[0xffff];
+	
 	LOG (g_message ( "prepare: encoding local %s\n", print_local (local) ));
 	
-	*remote = local_record_to_pilot_record (local, ctxt);
+	*remote = local_record_to_pilot_record (local, ctxt, record, sizeof(record));
 	
 	return 0;
 }
Index: calendar/conduits/calendar/calendar-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/calendar/calendar-conduit.c,v
retrieving revision 1.132
diff -u -r1.132 calendar-conduit.c
--- calendar/conduits/calendar/calendar-conduit.c	23 Dec 2005 04:39:34 -0000	1.132
+++ calendar/conduits/calendar/calendar-conduit.c	27 Aug 2006 18:28:40 -0000
@@ -413,6 +413,9 @@
 {
 	static char buff[ 4096 ];
 	struct Appointment appt;
+#ifdef PILOT_LINK_0_12
+	pi_buffer_t piBuf;
+#endif
 
 	if (remote == NULL) {
 		sprintf (buff, "[NULL]");
@@ -420,7 +423,14 @@
 	}
 
 	memset (&appt, 0, sizeof (struct Appointment));
+#ifdef PILOT_LINK_0_12
+	piBuf.data = remote->record;
+	piBuf.allocated = remote->length;
+	piBuf.used = remote->length;
+	unpack_Appointment(&appt, &piBuf, datebook_v1);
+#else
 	unpack_Appointment (&appt, remote->record, remote->length);
+#endif
 
 	g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']",
 		    mktime (&appt.begin),
@@ -813,12 +823,23 @@
 	return TRUE;
 }
 
+/* convert a local ECalLocalRecord to a GnomePilotRecord for the PDA
+ * 
+ * @param local local Evolution Calendar record
+ * @param ctxt conduit context
+ * @param record record to use for GnomePilotRecord. Allow the calling
+ *               function to determine if the record should be allocated
+ *               dynamically or statically.
+ * @param maxRecordLen size of *record (max amount of data that can be put
+ *                      into record)
+ */
 static GnomePilotRecord
 local_record_to_pilot_record (ECalLocalRecord *local,
-			      ECalConduitContext *ctxt)
+			      ECalConduitContext *ctxt,
+			      unsigned char *record,
+			      int maxRecordLen)
 {
 	GnomePilotRecord p;
-	static char record[0xffff];
 
 	g_assert (local->comp != NULL);
 	g_assert (local->appt != NULL );
@@ -829,9 +850,30 @@
 	p.archived = local->local.archived;
 	p.secret = local->local.secret;
 
+	memset(record, 0, maxRecordLen);
+
 	/* Generate pilot record structure */
+#ifdef PILOT_LINK_0_12
+	{
+
+		pi_buffer_t piBuf;
+		memset (&piBuf, 0, sizeof (piBuf));
+
+		pack_Appointment(local->appt, &piBuf, datebook_v1);
+		if(piBuf.used > 0) {
+			memcpy(record, piBuf.data, MIN(piBuf.used, maxRecordLen) );
+		}
+		
+		p.length = piBuf.used;
+		p.record = record;
+		if(piBuf.data) {
+			free(piBuf.data);
+		}
+	}
+#else
 	p.record = record;
-	p.length = pack_Appointment (local->appt, p.record, 0xffff);
+	p.length = pack_Appointment (local->appt, p.record, maxRecordLen);
+#endif
 
 	return p;	
 }
@@ -867,22 +909,48 @@
          * we don't overwrite them 
 	 */
 	if (local->local.ID != 0) {
-		struct Appointment appt;		
-		char record[0xffff];
+		struct Appointment appt;
+#ifdef PILOT_LINK_0_12
+		pi_buffer_t *piBuf;
+#else
+		unsigned char record[0xffff];
+#endif
 		int cat = 0;
+		int dlpReadRetval = 0;
 		
-		if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
-					ctxt->dbi->db_handle,
-					local->local.ID, &record, 
-					NULL, NULL, NULL, &cat) > 0) {
+#ifdef PILOT_LINK_0_12
+		piBuf = pi_buffer_new(0xffff);
+		if(piBuf == NULL) {
+			WARN( _("local_record_from_comp: no more memory to allocate") );
+			return;
+		}
+		dlpReadRetval = dlp_ReadRecordById (ctxt->dbi->pilot_socket,
+						    ctxt->dbi->db_handle,
+						    local->local.ID, piBuf,
+						    NULL, NULL, &cat);
+#else
+		dlpReadRetval = dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
+						    ctxt->dbi->db_handle,
+						    local->local.ID, &record,
+						    NULL, NULL, NULL, &cat);
+#endif
+		
+		if (dlpReadRetval > 0) {
 			local->local.category = cat;
 			memset (&appt, 0, sizeof (struct Appointment));
+#ifdef PILOT_LINK_0_12
+			unpack_Appointment (&appt, piBuf, datebook_v1);
+#else
 			unpack_Appointment (&appt, record, 0xffff);
+#endif
 			local->appt->alarm = appt.alarm;
 			local->appt->advance = appt.advance;
 			local->appt->advanceUnits = appt.advanceUnits;
 			free_Appointment (&appt);
 		}
+#ifdef PILOT_LINK_0_12
+		pi_buffer_free(piBuf);
+#endif
 	}
 
 	/* STOP: don't replace these with g_strdup, since free_Appointment
@@ -1144,7 +1212,17 @@
 	g_return_val_if_fail (remote != NULL, NULL);
 
 	memset (&appt, 0, sizeof (struct Appointment));
+#ifdef PILOT_LINK_0_12
+	{
+		pi_buffer_t piBuf;
+		piBuf.data = remote->record;
+		piBuf.allocated = remote->length;
+		piBuf.used = remote->length;
+		unpack_Appointment(&appt, &piBuf, datebook_v1);
+	}
+#else
 	unpack_Appointment (&appt, remote->record, remote->length);
+#endif
 
 	if (in_comp == NULL) {
 		comp = e_cal_component_new ();
@@ -1409,7 +1487,11 @@
 	GnomePilotConduitSyncAbs *abs_conduit;
 	GList *removed = NULL, *added = NULL, *l;
 	int len;
+#ifdef PILOT_LINK_0_12
+	pi_buffer_t *piBuf;
+#else
 	unsigned char *buf;
+#endif
 	char *filename, *change_id;
 	icalcomponent *icalcomp;
 	gint num_records, add_records = 0, mod_records = 0, del_records = 0;
@@ -1521,9 +1603,26 @@
 	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);
 
+#ifdef PILOT_LINK_0_12
+	piBuf = pi_buffer_new(0xffff);
+	if(piBuf == NULL) {
+		WARN (_("pre_sync(): Error allocating pi_buffer_t memory"));
+		gnome_pilot_conduit_error (conduit,
+			_("pre_sync(): Error allocating pi_buffer_t memory"));
+		return -1;
+	}
+	len = dlp_ReadAppBlock(dbi->pilot_socket, dbi->db_handle, 0, -1, piBuf);
+#else
 	buf = (unsigned char*)g_malloc (0xffff);
+	if(buf == NULL) {
+		WARN (_("pre_sync(): Error allocating buf memory"));
+		gnome_pilot_conduit_error (conduit,
+			_("pre_sync(): Error allocating buf memory"));
+		return -1;
+	}
 	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
 			      (unsigned char *)buf, 0xffff);
+#endif
 	
 	if (len < 0) {
 		WARN (_("Could not read pilot's Calendar application block"));
@@ -1532,8 +1631,13 @@
 					   _("Could not read pilot's Calendar application block"));
 		return -1;
 	}
+#ifdef PILOT_LINK_0_12
+	unpack_AppointmentAppInfo (&(ctxt->ai), piBuf->data, len);
+	pi_buffer_free(piBuf);
+#else
 	unpack_AppointmentAppInfo (&(ctxt->ai), buf, len);
 	g_free (buf);
+#endif
 
 	check_for_slow_setting (conduit, ctxt);
 	if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot
@@ -1715,6 +1819,7 @@
 	/* used by the quick compare */
 	GnomePilotRecord local_pilot;
 	int retval = 0;
+	static unsigned char record[0xffff];
 
 	LOG (g_message ("compare: local=%s remote=%s...\n",
 			print_local (local), print_remote (remote)));
@@ -1722,7 +1827,7 @@
 	g_return_val_if_fail (local!=NULL,-1);
 	g_return_val_if_fail (remote!=NULL,-1);
 
-	local_pilot = local_record_to_pilot_record (local, ctxt);
+	local_pilot = local_record_to_pilot_record (local, ctxt, record, sizeof(record));
 
 	if (remote->length != local_pilot.length
 	    || memcmp (local_pilot.record, remote->record, remote->length))
@@ -1883,9 +1988,11 @@
 	 GnomePilotRecord *remote,
 	 ECalConduitContext *ctxt)
 {
+	static unsigned char record[0xffff];
+	
 	LOG (g_message ( "prepare: encoding local %s\n", print_local (local) ));
 
-	*remote = local_record_to_pilot_record (local, ctxt);
+	*remote = local_record_to_pilot_record (local, ctxt, record, sizeof(record));
 
 	return 0;
 }
Index: calendar/conduits/memo/memo-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/memo/memo-conduit.c,v
retrieving revision 1.1
diff -u -r1.1 memo-conduit.c
--- calendar/conduits/memo/memo-conduit.c	19 Oct 2005 11:39:35 -0000	1.1
+++ calendar/conduits/memo/memo-conduit.c	27 Aug 2006 18:28:41 -0000
@@ -331,6 +331,9 @@
 {
 	static char buff[ 64 ];
 	struct Memo memo;
+#ifdef PILOT_LINK_0_12
+	pi_buffer_t piBuf;
+#endif
 
 	if (remote == NULL) {
 		sprintf (buff, "[NULL]");
@@ -338,7 +341,15 @@
 	}
 
 	memset (&memo, 0, sizeof (struct Memo));
+#ifdef PILOT_LINK_0_12
+	piBuf.data = remote->record;
+	piBuf.allocated = remote->length;
+	piBuf.used = remote->length;
+	unpack_Memo(&memo, &piBuf, memo_v1);
+#else
+	
 	unpack_Memo (&memo, remote->record, remote->length);
+#endif
 
 	g_snprintf (buff, 64, "['%s']",
 		    memo.text ?
@@ -446,12 +457,24 @@
 	}
 }
 
+/**
+ * convert a local EMemoLocalRecord to a GnomePilotRecord for the PDA
+ * 
+ * @param local local Evolution memo record
+ * @param ctxt conduit context
+ * @param record record to use for GnomePilotRecord. Allow the calling
+ *               function to determine if the record should be allocated
+ *               dynamically or statically.
+ * @param maxRecordLen size of *record (max amount of data that can be put
+ *                      into record)
+ */
 static GnomePilotRecord
 local_record_to_pilot_record (EMemoLocalRecord *local,
-			      EMemoConduitContext *ctxt)
+			      EMemoConduitContext *ctxt,
+			      unsigned char *record,
+			      int maxRecordLen)
 {
 	GnomePilotRecord p;
-	static char record[0xffff];
 
 	g_assert (local->comp != NULL);
 	g_assert (local->memo != NULL );
@@ -464,9 +487,30 @@
 	p.archived = local->local.archived;
 	p.secret = local->local.secret;
 
+	memset(record, 0, maxRecordLen);
+
 	/* Generate pilot record structure */
+#ifdef PILOT_LINK_0_12
+	{
+
+		pi_buffer_t piBuf;
+		memset (&piBuf, 0, sizeof (piBuf));
+
+		pack_Memo(local->memo, &piBuf, memo_v1);
+		if(piBuf.used > 0) {
+			memcpy(record, piBuf.data, MIN(piBuf.used, maxRecordLen) );
+		}
+		
+		p.length = piBuf.used;
+		p.record = record;
+		if(piBuf.data) {
+			free(piBuf.data);
+		}
+	}
+#else
 	p.record = record;
-	p.length = pack_Memo (local->memo, p.record, 0xffff);
+	p.length = pack_Memo (local->memo, p.record, maxRecordLen);
+#endif
 
 	return p;	
 }
@@ -483,53 +527,39 @@
 {
 	int i, j;
 	int retval = 0; /* 0 is the Unfiled category */
-	LOG(fprintf(stderr, "add_category_if_possible: called\n"));
+	LOG(g_message("add_category_if_possible\n"));
 	
 	for(i=0; i<16; i++){
 		/* if strlen is 0, then the category is empty
 		   the PalmOS doesn't let 0-length strings for
 		   categories */
-		LOG(fprintf(stderr, "add_category_if_possible: calling strlen, i==%d\n", i));
 		if(strlen(category->name[i]) == 0){
 			int cat_to_add_len;
-			LOG(fprintf(stderr, "add_category_if_possible: strlen == 0\n"));
 			
 			cat_to_add_len = strlen(cat_to_add);
-			LOG(fprintf(stderr, "add_category_if_possible: cat_to_add_len: %d\n",
-					cat_to_add_len));
 			retval = i;
 			
 			/* only 15 characters for category, 16th is
 			 * '\0' can't do direct mem transfer due to
 			 * declaration type
 			 */
-			LOG(fprintf(stderr, "add_category_if_possible: copying first 15 of category\n"));
 			for(j=0; j<cat_to_add_len; j++){
 				category->name[i][j] = cat_to_add[j];
 			}
-			LOG(fprintf(stderr,
-				"add_category_if_possible: setting from %d to i==15 to \\0\n",
-				cat_to_add_len));
 
 			for(j=cat_to_add_len; j<16; j++)
 				category->name[i][j] = '\0';
 			
-			LOG(fprintf(stderr, "add_category_if_possible: setting ID[%d] to %d\n",
-				category->ID[i], lastDesktopUniqueID));
 			category->ID[i] = lastDesktopUniqueID;
 			lastDesktopUniqueID++;
-			
-			LOG(fprintf(stderr, "add_category_if_possible: setting renamed[%d] to TRUE\n", i));
 			category->renamed[i] = TRUE;
 			
-			LOG(g_message("*** adding category '%s', ID %d ***",
-				category->name[i], category->ID[i]));
 			break;
 		}
 	}
 	
 	if(retval == 0){
-		LOG(g_message("*** not adding category - category list already full ***"));
+		LOG(g_warning( _("*** not adding category - category list already full ***") ));
 	}
 	
 	return retval;
@@ -554,31 +584,45 @@
 	local->comp = comp;
 	g_object_ref (comp);
 
-	LOG(fprintf(stderr, "local_record_from_comp: calling e_cal_component_get_uid\n"));
 	e_cal_component_get_uid (local->comp, &uid);
-	LOG(fprintf(stderr, "local_record_from_comp: got UID - %s, calling e_pilot_map_lookup_pid\n", uid));
 	local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid, TRUE);
-	LOG(fprintf(stderr, "local_record_from_comp: local->local.ID == %lu\n", local->local.ID));
 
 	compute_status (ctxt, local, uid);
-	
-	LOG(fprintf(stderr, "local_record_from_comp: local->local.attr: %d\n", local->local.attr));
 
 	local->memo = g_new0 (struct Memo,1);
 
 	/* Don't overwrite the category */
 	if (local->local.ID != 0) {
-		char record[0xffff];
 		int cat = 0;
+		int dlpReadRetval = 0;
+#ifdef PILOT_LINK_0_12
+		pi_buffer_t *piBuf;
+		piBuf = pi_buffer_new(0xffff);
+		if(piBuf == NULL) {
+			WARN( _("local_record_from_comp: no more memory to allocate") );
+			return;
+		}
 		
-		LOG(fprintf(stderr, "local_record_from_comp: calling dlp_ReadRecordById\n"));
-		if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
-					ctxt->dbi->db_handle,
-					local->local.ID, &record, 
-					NULL, NULL, NULL, &cat) > 0) {
+		dlpReadRetval = dlp_ReadRecordById(ctxt->dbi->pilot_socket,
+						   ctxt->dbi->db_handle,
+						   local->local.ID, piBuf,
+						   NULL, NULL, &cat);
+#else
+		unsigned char record[0xffff];
+		dlpReadRetval = dlp_ReadRecordById(ctxt->dbi->pilot_socket, 
+						   ctxt->dbi->db_handle,
+						   local->local.ID, &record, 
+						   NULL, NULL, NULL, &cat);
+#endif
+
+		
+		if (dlpReadRetval > 0) {
 			local->local.category = cat;
 		}
-		LOG(fprintf(stderr, "local_record_from_comp: done calling dlp_ReadRecordById\n"));
+		
+#ifdef PILOT_LINK_0_12
+		pi_buffer_free(piBuf);
+#endif
 	}
 	
 	/*
@@ -589,34 +633,23 @@
 		int cat = -1;
 		int i;
 		
-		LOG(fprintf(stderr, "local_record_from_comp: trying to set category"));
-		LOG(fprintf(stderr, "local_record_from_comp: calling e_cal_component_get_categories_list\n"));
-		
 		e_cal_component_get_categories_list(comp, &categ_list_head);
-		LOG(fprintf(stderr, "local_record_from_comp: got list, setting categ_list_cur to head\n"));
 		
 		categ_list_cur = categ_list_head;
 		while (categ_list_cur && cat == -1)
 		{	
-			LOG(fprintf(stderr, "local_record_from_comp: iterating, data == %s",
-				(char *)categ_list_cur->data));
 			for(i=0; i<16; i++){
-				LOG(fprintf(stderr, "local_record_from_comp: i == %d\n", i));
 				if(strcmp((char *)categ_list_cur->data,
 					  ctxt->ai.category.name[i]) == 0){
 					cat = i;
-					LOG(fprintf(stderr, "local_record_from_comp: found category, name: %s\n",
-							ctxt->ai.category.name[i]));
 					break;
 				}
 			}
 			
-			LOG(fprintf(stderr, "local_record_from_comp: calling g_slist_next\n"));
 			categ_list_cur = g_slist_next(categ_list_cur);
 		}
 		
 		if(cat != -1){
-			LOG(fprintf(stderr, "local_record_from_comp: setting category\n"));
 			local->local.category = cat;
 		}
 		else if(categ_list_head != NULL){
@@ -708,7 +741,18 @@
 	g_return_val_if_fail (remote != NULL, NULL);
 
 	memset (&memo, 0, sizeof (struct Memo));
+#ifdef PILOT_LINK_0_12
+	{
+		pi_buffer_t piBuf;
+		piBuf.data = remote->record;
+		piBuf.allocated = remote->length;
+		piBuf.used = remote->length;
+		unpack_Memo(&memo, &piBuf, memo_v1);
+	}
+#else
+
 	unpack_Memo (&memo, remote->record, remote->length);
+#endif
 
 	utc_zone = icaltimezone_get_utc_timezone ();
 	now = icaltime_from_timet_with_zone (time (NULL), FALSE, 
@@ -836,7 +880,11 @@
 	GnomePilotConduitSyncAbs *abs_conduit;
 	GList *l;
 	int len;
+#ifdef PILOT_LINK_0_12
+	pi_buffer_t *piBuf;
+#else
 	unsigned char *buf;
+#endif
 	char *filename, *change_id;
 	icalcomponent *icalcomp;
 	gint num_records, add_records = 0, mod_records = 0, del_records = 0;
@@ -929,9 +977,26 @@
 	g_message("num_records: %d\nadd_records: %d\nmod_records: %d\ndel_records: %d\n",
 		num_records, add_records, mod_records, del_records);
 
+#ifdef PILOT_LINK_0_12
+	piBuf = pi_buffer_new(0xffff);
+	if(piBuf == NULL) {
+		WARN (_("pre_sync(): Error allocating pi_buffer_t memory"));
+		gnome_pilot_conduit_error (conduit,
+			_("pre_sync(): Error allocating pi_buffer_t memory"));
+		return -1;
+	}
+	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0, -1, piBuf);
+#else
 	buf = (unsigned char*)g_malloc (0xffff);
+	if(buf == NULL) {
+		WARN (_("pre_sync(): Error allocating buf memory"));
+		gnome_pilot_conduit_error (conduit,
+			_("pre_sync(): Error allocating buf memory"));
+		return -1;
+	}
 	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
 			      (unsigned char *)buf, 0xffff);
+#endif
 	
 	if (len < 0) {
 		WARN (_("Could not read pilot's Memo application block"));
@@ -940,8 +1005,14 @@
 					   _("Could not read pilot's Memo application block"));
 		return -1;
 	}
+	
+#ifdef PILOT_LINK_0_12
+	unpack_MemoAppInfo (&(ctxt->ai), piBuf->data, len);
+	pi_buffer_free(piBuf);
+#else
 	unpack_MemoAppInfo (&(ctxt->ai), buf, len);
 	g_free (buf);
+#endif
 	
 	lastDesktopUniqueID = 128;
 
@@ -963,6 +1034,9 @@
 	unsigned char *buf;
 	int dlpRetVal, len;
 
+	/* Write AppBlock to PDA - updates categories */
+	/* NOTE: not changed for pilot-link 0.12 because the two
+	 * functions below didn't change */
 	buf = (unsigned char*)g_malloc (0xffff);
 	
 	len = pack_MemoAppInfo (&(ctxt->ai), buf, 0xffff);
@@ -1156,6 +1230,7 @@
 	/* used by the quick compare */
 	GnomePilotRecord local_pilot;
 	int retval = 0;
+	static unsigned char record[0xffff];
 
 	LOG (g_message ("compare: local=%s remote=%s...\n",
 			print_local (local), print_remote (remote)));
@@ -1163,7 +1238,7 @@
 	g_return_val_if_fail (local!=NULL,-1);
 	g_return_val_if_fail (remote!=NULL,-1);
 
-	local_pilot = local_record_to_pilot_record (local, ctxt);
+	local_pilot = local_record_to_pilot_record (local, ctxt, record, sizeof(record));
 
 	if (remote->length != local_pilot.length
 	    || memcmp (local_pilot.record, remote->record, remote->length))
@@ -1319,9 +1394,10 @@
 	 GnomePilotRecord *remote,
 	 EMemoConduitContext *ctxt)
 {
+	static unsigned char record[0xffff];
 	LOG (g_message ( "prepare: encoding local %s\n", print_local (local) ));
 
-	*remote = local_record_to_pilot_record (local, ctxt);
+	*remote = local_record_to_pilot_record (local, ctxt, record, sizeof(record));
 
 	return 0;
 }
Index: calendar/conduits/todo/todo-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/todo/todo-conduit.c,v
retrieving revision 1.98
diff -u -r1.98 todo-conduit.c
--- calendar/conduits/todo/todo-conduit.c	13 May 2006 07:58:02 -0000	1.98
+++ calendar/conduits/todo/todo-conduit.c	27 Aug 2006 18:28:42 -0000
@@ -409,7 +409,17 @@
 	}
 
 	memset (&todo, 0, sizeof (struct ToDo));
+#ifdef PILOT_LINK_0_12
+	{
+		pi_buffer_t piBuf;
+		piBuf.data = remote->record;
+		piBuf.allocated = remote->length;
+		piBuf.used = remote->length;
+		unpack_ToDo(&todo, &piBuf, todo_v1);
+	}
+#else
 	unpack_ToDo (&todo, remote->record, remote->length);
+#endif
 
 	g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s' %d]",
 		    todo.indefinite,
@@ -589,12 +599,24 @@
 	}
 }
 
+/**
+ * convert a local EMemoLocalRecord to a GnomePilotRecord for the PDA
+ * 
+ * @param local local Evolution memo record
+ * @param ctxt conduit context
+ * @param record record to use for GnomePilotRecord. Allow the calling
+ *               function to determine if the record should be allocated
+ *               dynamically or statically.
+ * @param maxRecordLen size of *record (max amount of data that can be put
+ *                      into record)
+ */
 static GnomePilotRecord
 local_record_to_pilot_record (EToDoLocalRecord *local,
-			      EToDoConduitContext *ctxt)
+			      EToDoConduitContext *ctxt,
+			      unsigned char *record,
+			      int maxRecordLen)
 {
 	GnomePilotRecord p;
-	static char record[0xffff];
 
 	g_assert (local->comp != NULL);
 	g_assert (local->todo != NULL );
@@ -607,9 +629,29 @@
 	p.archived = local->local.archived;
 	p.secret = local->local.secret;
 
+	memset(record, 0, maxRecordLen);
+
 	/* Generate pilot record structure */
+#ifdef PILOT_LINK_0_12
+	{
+		pi_buffer_t piBuf;
+		memset (&piBuf, 0, sizeof (piBuf));
+
+		pack_ToDo(local->todo, &piBuf, todo_v1);
+		if(piBuf.used > 0) {
+			memcpy(record, piBuf.data, MIN(piBuf.used, maxRecordLen) );
+		}
+		
+		p.length = piBuf.used;
+		p.record = record;
+		if(piBuf.data) {
+			free(piBuf.data);
+		}
+	}
+#else
 	p.record = record;
-	p.length = pack_ToDo (local->todo, p.record, 0xffff);
+	p.length = pack_ToDo (local->todo, p.record, maxRecordLen);
+#endif
 
 	return p;	
 }
@@ -696,15 +738,33 @@
 
 	/* Don't overwrite the category */
 	if (local->local.ID != 0) {
-		char record[0xffff];
 		int cat = 0;
-		
-		if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
-					ctxt->dbi->db_handle,
-					local->local.ID, &record, 
-					NULL, NULL, NULL, &cat) > 0) {
+		int dlpReadRetval = 0;
+#ifdef PILOT_LINK_0_12
+		pi_buffer_t *piBuf = pi_buffer_new(0xffff);
+		if(piBuf == NULL) {
+			WARN( _("local_record_from_comp: no more memory to allocate") );
+			return;
+		}
+		dlpReadRetval = dlp_ReadRecordById(ctxt->dbi->pilot_socket,
+						   ctxt->dbi->db_handle,
+						   local->local.ID, piBuf,
+						   NULL, NULL, &cat);
+#else
+		char record[0xffff];
+		dlpReadRetval = dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
+						    ctxt->dbi->db_handle,
+						    local->local.ID, &record, 
+						    NULL, NULL, NULL, &cat);
+#endif
+
+		if (dlpReadRetval > 0) {
 			local->local.category = cat;
 		}
+		
+#ifdef PILOT_LINK_0_12
+		pi_buffer_free(piBuf);
+#endif
 	}
 	
 	/*
@@ -864,7 +924,17 @@
 	g_return_val_if_fail (remote != NULL, NULL);
 
 	memset (&todo, 0, sizeof (struct ToDo));
+#ifdef PILOT_LINK_0_12
+	{
+		pi_buffer_t piBuf;
+		piBuf.data = remote->record;
+		piBuf.allocated = remote->length;
+		piBuf.used = remote->length;
+		unpack_ToDo(&todo, &piBuf, todo_v1);
+	}
+#else
 	unpack_ToDo (&todo, remote->record, remote->length);
+#endif
 
 	utc_zone = icaltimezone_get_utc_timezone ();
 	now = icaltime_from_timet_with_zone (time (NULL), FALSE, 
@@ -1014,7 +1084,11 @@
 	GnomePilotConduitSyncAbs *abs_conduit;
 	GList *l;
 	int len;
+#ifdef PILOT_LINK_0_12
+	pi_buffer_t *piBuf;
+#else
 	unsigned char *buf;
+#endif
 	char *filename, *change_id;
 	icalcomponent *icalcomp;
 	gint num_records, add_records = 0, mod_records = 0, del_records = 0;
@@ -1104,9 +1178,20 @@
 	g_message("num_records: %d\nadd_records: %d\nmod_records: %d\ndel_records: %d\n",
 			num_records, add_records, mod_records, del_records);
 
+#ifdef PILOT_LINK_0_12
+	piBuf = pi_buffer_new(0xffff);
+	if(piBuf == NULL) {
+		WARN (_("pre_sync(): Error allocating pi_buffer_t memory"));
+		gnome_pilot_conduit_error (conduit,
+			_("pre_sync(): Error allocating pi_buffer_t memory"));
+		return -1;
+	}
+	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0, -1, piBuf);
+#else
 	buf = (unsigned char*)g_malloc (0xffff);
 	len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
 			      (unsigned char *)buf, 0xffff);
+#endif
 	
 	if (len < 0) {
 		WARN (_("Could not read pilot's ToDo application block"));
@@ -1115,8 +1200,14 @@
 					   _("Could not read pilot's ToDo application block"));
 		return -1;
 	}
+
+#ifdef PILOT_LINK_0_12
+	unpack_ToDoAppInfo (&(ctxt->ai), piBuf->data, len);
+	pi_buffer_free(piBuf);
+#else
 	unpack_ToDoAppInfo (&(ctxt->ai), buf, len);
 	g_free (buf);
+#endif
 	
 	lastDesktopUniqueID = 128;
 
@@ -1138,6 +1229,9 @@
 	unsigned char *buf;
 	int dlpRetVal, len;
 
+	/* Write AppBlock to PDA - updates categories */
+	/* NOTE: not changed for pilot-link 0.12 because the two
+	 * functions below didn't change */
 	buf = (unsigned char*)g_malloc (0xffff);
 	
 	len = pack_ToDoAppInfo (&(ctxt->ai), buf, 0xffff);
@@ -1320,6 +1414,7 @@
 	/* used by the quick compare */
 	GnomePilotRecord local_pilot;
 	int retval = 0;
+	static unsigned char record[0xffff];
 
 	LOG (g_message ("compare: local=%s remote=%s...\n",
 			print_local (local), print_remote (remote)));
@@ -1327,7 +1422,7 @@
 	g_return_val_if_fail (local!=NULL,-1);
 	g_return_val_if_fail (remote!=NULL,-1);
 
-	local_pilot = local_record_to_pilot_record (local, ctxt);
+	local_pilot = local_record_to_pilot_record (local, ctxt, record, sizeof(record));
 
 	if (remote->length != local_pilot.length
 	    || memcmp (local_pilot.record, remote->record, remote->length))
@@ -1484,9 +1579,11 @@
 	 GnomePilotRecord *remote,
 	 EToDoConduitContext *ctxt)
 {
+	static unsigned char record[0xffff];
+
 	LOG (g_message ( "prepare: encoding local %s\n", print_local (local) ));
 
-	*remote = local_record_to_pilot_record (local, ctxt);
+	*remote = local_record_to_pilot_record (local, ctxt, record, sizeof(record));
 
 	return 0;
 }


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