tags 341172 + patch
severity 341172 wishlist
retitle 341172 Please port to the experimental pilot-link 0.12 API
thanks

On Tue, Nov 29, 2005, Scott Anderson wrote:
> I'll try downgrading pilot-link to unstable.
> # apt-cache policy pilot-link
>   Installed: 0.11.8-0.12.0-pre4-3

 Yes, it's the problem.

 I think evolution 2.4.1 was never meant to be built against pilot-link
 0.12.  Only evolution 2.5/2.6 will support it.

> The pilot-link-0.12 patches are now in garnome-2.12.0

 I had a look, this is an evolution 2.5 patch, and it didn't apply
 against 2.4.  I tried backporting the patch to 2.4, but I'm relunctant
 to build evolution against pilot-link from experimental, I think this
 is inappropriate.  I attach the patch, let me know if it solves the
 problem for you.

   Cheers,
-- 
Loïc Minier <[EMAIL PROTECTED]>
diff -urN evolution-2.4.1.orig/addressbook/conduit/address-conduit.c 
evolution-2.4.1/addressbook/conduit/address-conduit.c
--- evolution-2.4.1.orig/addressbook/conduit/address-conduit.c  2004-09-23 
20:50:17.000000000 +0200
+++ evolution-2.4.1/addressbook/conduit/address-conduit.c       2005-11-29 
23:42:18.000000000 +0100
@@ -460,14 +460,19 @@
 {
        static char buff[ 4096 ];
        struct Address addr;
+       pi_buffer_t piBuf;
 
        if (remote == NULL) {
                sprintf (buff, "[NULL]");
                return buff;
        }
 
+       piBuf.data = remote->record;
+       piBuf.allocated = remote->length;
+       piBuf.used = remote->length;
+
        memset (&addr, 0, sizeof (struct Address));
-       unpack_Address (&addr, remote->record, remote->length);
+       unpack_Address (&addr, &piBuf, address_v1);
 
        g_snprintf (buff, 4096, "['%s' '%s' '%s']",
                    addr.entry[entryLastname] ?
@@ -789,7 +794,8 @@
                              EAddrConduitContext *ctxt)
 {
        GnomePilotRecord p;
-       static char record[0xffff];
+       static unsigned char record[0xffff];
+       pi_buffer_t piBuf;
        
        g_assert (local->addr != NULL );
        
@@ -801,9 +807,17 @@
        p.archived = local->local.archived;
        p.secret = local->local.secret;
 
+       memset (&piBuf, 0, sizeof (piBuf));
+       memset (record, 0, sizeof (record));
+       pack_Address (local->addr, &piBuf, address_v1);
+
        /* Generate pilot record structure */
+       if (piBuf.used > 0)
+               memcpy (record, piBuf.data, piBuf.used);
        p.record = record;
-       p.length = pack_Address (local->addr, p.record, 0xffff);
+       p.length = piBuf.used;
+       if (piBuf.data)
+               free (piBuf.data);
 
        return p;       
 }
@@ -832,16 +846,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, address_v1);
                        for (i = 0; i < 5; i++) {
                                if (addr.entry[entryPhone1 + i])
                                        local->addr->entry[entryPhone1 + i] = 
@@ -856,6 +870,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));
@@ -1012,10 +1028,16 @@
        EContactField next_mail, next_home, next_work, next_fax;
        EContactField next_other, next_main, next_pager, next_mobile;
        int i;
+       pi_buffer_t piBuf;
 
        g_return_val_if_fail(remote!=NULL,NULL);
        memset (&address, 0, sizeof (struct Address));
-       unpack_Address (&address, remote->record, remote->length);
+
+       piBuf.data = remote->record;
+       piBuf.allocated = remote->length;
+       piBuf.used = remote->length;
+
+       unpack_Address (&address, &piBuf, address_v1);
 
        if (in_contact == NULL)
                contact = e_contact_new ();
@@ -1161,7 +1183,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 +1266,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);
+                               -1, buffer);
        
        if (len < 0) {
                WARN (_("Could not read pilot's Address application block"));
@@ -1255,8 +1277,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
diff -urN evolution-2.4.1.orig/calendar/conduits/calendar/calendar-conduit.c 
evolution-2.4.1/calendar/conduits/calendar/calendar-conduit.c
--- evolution-2.4.1.orig/calendar/conduits/calendar/calendar-conduit.c  
2005-09-30 19:07:05.000000000 +0200
+++ evolution-2.4.1/calendar/conduits/calendar/calendar-conduit.c       
2005-11-29 23:42:18.000000000 +0100
@@ -404,14 +404,20 @@
 {
        static char buff[ 4096 ];
        struct Appointment appt;
+       pi_buffer_t piBuf;
 
        if (remote == NULL) {
                sprintf (buff, "[NULL]");
                return buff;
        }
 
+
+       piBuf.data = remote->record;
+       piBuf.allocated = remote->length;
+       piBuf.used = remote->length;
+
        memset (&appt, 0, sizeof (struct Appointment));
-       unpack_Appointment (&appt, remote->record, remote->length);
+       unpack_Appointment (&appt, &piBuf, datebook_v1);
 
        g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']",
                    mktime (&appt.begin),
@@ -769,7 +775,8 @@
                              ECalConduitContext *ctxt)
 {
        GnomePilotRecord p;
-       static char record[0xffff];
+       static unsigned char record[0xffff];
+       pi_buffer_t piBuf;
 
        g_assert (local->comp != NULL);
        g_assert (local->appt != NULL );
@@ -780,9 +787,17 @@
        p.archived = local->local.archived;
        p.secret = local->local.secret;
 
+       memset (&piBuf, 0, sizeof (piBuf));
+       memset (record, 0, sizeof (record));
+       pack_Appointment (local->appt, &piBuf, datebook_v1);
+
        /* Generate pilot record structure */
+       if (piBuf.used > 0)
+               memcpy (record, piBuf.data, piBuf.used);
        p.record = record;
-       p.length = pack_Appointment (local->appt, p.record, 0xffff);
+       p.length = piBuf.used;
+       if (piBuf.data)
+               free (piBuf.data);
 
        return p;       
 }
@@ -818,22 +833,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, datebook_v1);
                        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
@@ -1091,11 +1108,17 @@
        GSList *edl = NULL;     
        char *txt;
        int pos, i;
+       pi_buffer_t piBuf;
        
        g_return_val_if_fail (remote != NULL, NULL);
 
+
+       piBuf.data = remote->record;
+       piBuf.allocated = remote->length;
+       piBuf.used = remote->length;
+
        memset (&appt, 0, sizeof (struct Appointment));
-       unpack_Appointment (&appt, remote->record, remote->length);
+       unpack_Appointment (&appt, &piBuf, datebook_v1);
 
        if (in_comp == NULL) {
                comp = e_cal_component_new ();
@@ -1360,7 +1383,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;
@@ -1478,9 +1501,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);
+                               -1, buffer);
        
        if (len < 0) {
                WARN (_("Could not read pilot's Calendar application block"));
@@ -1489,8 +1512,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
diff -urN evolution-2.4.1.orig/calendar/conduits/todo/todo-conduit.c 
evolution-2.4.1/calendar/conduits/todo/todo-conduit.c
--- evolution-2.4.1.orig/calendar/conduits/todo/todo-conduit.c  2005-07-01 
17:14:33.000000000 +0200
+++ evolution-2.4.1/calendar/conduits/todo/todo-conduit.c       2005-11-29 
23:56:16.000000000 +0100
@@ -396,14 +396,19 @@
 {
        static char buff[ 4096 ];
        struct ToDo todo;
+       pi_buffer_t piBuf;
 
        if (remote == NULL) {
                sprintf (buff, "[NULL]");
                return buff;
        }
 
+       piBuf.data = remote->record;
+       piBuf.allocated = remote->length;
+       piBuf.used = remote->length;
+
        memset (&todo, 0, sizeof (struct ToDo));
-       unpack_ToDo (&todo, remote->record, remote->length);
+       unpack_ToDo (&todo, &piBuf, todo_v1);
 
        g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s']",
                    todo.indefinite,
@@ -545,7 +550,8 @@
                              EToDoConduitContext *ctxt)
 {
        GnomePilotRecord p;
-       static char record[0xffff];
+       static unsigned char record[0xffff];
+       pi_buffer_t piBuf;
 
        g_assert (local->comp != NULL);
        g_assert (local->todo != NULL );
@@ -558,9 +564,17 @@
        p.archived = local->local.archived;
        p.secret = local->local.secret;
 
+       memset (&piBuf, 0, sizeof (piBuf));
+       memset (record, 0, sizeof (record));
+       pack_ToDo (local->todo, &piBuf, todo_v1);
+
        /* Generate pilot record structure */
+       if (piBuf.used > 0)
+               memcpy (record, piBuf.data, piBuf.used);
        p.record = record;
-       p.length = pack_ToDo (local->todo, p.record, 0xffff);
+       p.length = piBuf.used;
+       if (piBuf.data)
+               free (piBuf.data);
 
        return p;       
 }
@@ -598,13 +612,13 @@
 
        /* 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;                    
                }
        }
@@ -721,11 +735,16 @@
        icaltimezone *utc_zone;
        int priority;
        char *txt;
+       pi_buffer_t piBuf;
        
        g_return_val_if_fail (remote != NULL, NULL);
 
+       piBuf.data = remote->record;
+       piBuf.allocated = remote->length;
+       piBuf.used = remote->length;
+
        memset (&todo, 0, sizeof (struct ToDo));
-       unpack_ToDo (&todo, remote->record, remote->length);
+       unpack_ToDo (&todo, &piBuf, todo_v1);
 
        utc_zone = icaltimezone_get_utc_timezone ();
        now = icaltime_from_timet_with_zone (time (NULL), FALSE, 
@@ -861,7 +880,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 +970,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);
+                               -1, buffer);
        
        if (len < 0) {
                WARN (_("Could not read pilot's ToDo application block"));
@@ -962,8 +981,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

Reply via email to