]> git.pld-linux.org Git - packages/evolution.git/blob - evolution-pilot-link-0.12.patch
- evolution-groupwise-features-link.patch: missing #include to avoid
[packages/evolution.git] / evolution-pilot-link-0.12.patch
1 Index: acinclude.m4
2 ===================================================================
3 RCS file: /cvs/gnome/evolution/acinclude.m4,v
4 retrieving revision 1.9
5 diff -u -r1.9 acinclude.m4
6 --- acinclude.m4        12 Jun 2006 12:52:02 -0000      1.9
7 +++ acinclude.m4        17 Nov 2006 07:29:48 -0000
8 @@ -268,3 +268,119 @@
9    AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
10    AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
11  ])
12 +
13 +# PILOT_LINK_CHECK
14 +# Adds --with-pisock and determines the verion of the pisock
15 +#
16 +
17 +AC_SUBST(PISOCK_CFLAGS)
18 +AC_SUBST(PISOCK_LIBS)
19 +
20 +AC_DEFUN([PILOT_LINK_HOOK],[
21 +       AC_ARG_WITH(pisock,
22 +       [  --with-pisock            Specify prefix for pisock files],[
23 +       if test x$withval = xyes; then
24 +           dnl Note that an empty true branch is not valid sh syntax.
25 +           ifelse([$1], [], :, [$1])
26 +       else
27 +           PISOCK_CFLAGS="-I$withval/include"
28 +           incdir="$withval/include"
29 +           PISOCK_LIBS="-L$withval/lib -lpisock -lpisync"
30 +           AC_MSG_CHECKING("for existance of $withval/lib/libpisock.so")
31 +           if test -r $withval/lib/libpisock.so; then
32 +               AC_MSG_RESULT(yes)
33 +           else
34 +               AC_MSG_ERROR([Unable to find libpisock. Try  http://www.pilot-link.org.])
35 +           fi
36 +       fi
37 +       ])
38 +
39 +       if test x$PISOCK_CFLAGS = x; then
40 +           AC_CHECK_HEADER(pi-version.h, [incdir="/usr/include"], [
41 +           AC_CHECK_HEADER(libpisock/pi-version.h, [PISOCK_CFLAGS="-I/usr/include/libpisock"
42 +                                                    piversion_include="libpisock/pi-version.h"
43 +                                                    incdir="/usr/include/libpisock"
44 +                                                    ], [
45 +           AC_CHECK_HEADER($prefix/include/pi-version.h, [PISOCK_CFLAGS="-I$prefix/include/libpisock"
46 +                                                          piversion_include="$prefix/include/pi-version.h"
47 +                                                          if test x$PISOCK_LIBDIR = x; then
48 +                                                             incdir="$prefix/include"
49 +                                                             PISOCK_LIBS="-L$prefix/lib -lpisock -lpisync"
50 +                                                           fi                                                    ],
51 +           AC_MSG_ERROR([Unable to find pi-version.h])) 
52 +           ])
53 +           ])
54 +       fi
55 +               
56 +       if test "x$PISOCK_LIBS" = "x"; then
57 +               AC_CHECK_LIB(pisock, pi_accept, [ PISOCK_LIBS="-lpisock -lpisync"], 
58 +                       [ AC_MSG_ERROR([Unable to find libpisock. Try http://www.pilot-link.org.]) ])
59 +       fi
60 +       
61 +       AC_ARG_ENABLE(pilotlinktest,
62 +               [  --enable-pilotlinktest   Test for correct version of pilot-link],
63 +               [testplversion=$enableval],
64 +               [ testplversion=yes ]
65 +       )
66 +
67 +       if test x$piversion_include = x; then
68 +               piversion_include="pi-version.h"
69 +       fi
70 +
71 +       pi_major=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_VERSION'|sed 's/#define PILOT_LINK_VERSION \([[0-9]]*\)/\1/'`
72 +       pi_minor=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_MAJOR'|sed 's/#define PILOT_LINK_MAJOR \([[0-9]]*\)/\1/'`
73 +       pi_micro=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_MINOR'|sed 's/#define PILOT_LINK_MINOR \([[0-9]]*\)/\1/'`
74 +       pi_patch=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_PATCH'|sed 's/#define PILOT_LINK_PATCH \"\(.*\)\"/\1/'`
75 +
76 +       PILOT_LINK_MAJOR="$pi_major"
77 +       PILOT_LINK_MINOR="$pi_minor"
78 +       PILOT_LINK_MICRO="$pi_micro"
79 +       PILOT_LINK_PATCH="$pi_patch"
80 +       PILOT_LINK_VERSION="$pi_major.$pi_minor.$pi_micro$pi_patch"
81 +
82 +       if test x$testplversion = xyes; then
83 +               AC_MSG_CHECKING([for pilot-link version >= $1])
84 +               pl_ma=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
85 +               pl_mi=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
86 +               pl_mc=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
87 +               CFLAGS_save="$CFLAGS"
88 +               CFLAGS="$CFLAGS $PISOCK_CFLAGS"
89 +               AC_TRY_RUN(
90 +                       [
91 +                       #include <$piversion_include>
92 +                       int main(int argc,char *argv[]) {
93 +                               if (PILOT_LINK_VERSION == $pl_ma) {
94 +                                       if (PILOT_LINK_MAJOR == $pl_mi) {
95 +                                               if (PILOT_LINK_MINOR >= $pl_mc) {
96 +                                                       return 0;
97 +                                               }
98 +                                       } else if (PILOT_LINK_MAJOR > $pl_mi) {
99 +                                               return 0;
100 +                                       }
101 +                               } else if (PILOT_LINK_VERSION > $pl_ma) {
102 +                                       return 0;
103 +                               }
104 +                               return 1;
105 +                       }
106 +                       ],
107 +                       [AC_MSG_RESULT([yes (found $PILOT_LINK_VERSION)])],
108 +                       [AC_MSG_ERROR([pilot-link >= $1 required])],
109 +                       [AC_MSG_WARN([No action taken for crosscompile])]
110 +               )
111 +               CFLAGS="$CFLAGS_save"
112 +       fi
113 +
114 +       unset piversion_include
115 +       unset pi_verion
116 +       unset pi_major
117 +       unset pi_minor
118 +       unset pi_patch
119 +       unset incdir
120 +       unset pl_mi
121 +       unset pl_ma
122 +       unset pl_ve
123 +])
124 +
125 +AC_DEFUN([PILOT_LINK_CHECK],[
126 +       PILOT_LINK_HOOK($1,[],nofailure)
127 +])
128 Index: configure.in
129 ===================================================================
130 RCS file: /cvs/gnome/evolution/configure.in,v
131 retrieving revision 1.920
132 diff -u -r1.920 configure.in
133 --- configure.in        14 Nov 2006 17:45:52 -0000      1.920
134 +++ configure.in        17 Nov 2006 07:29:48 -0000
135 @@ -606,8 +606,22 @@
136         fi
137  fi
138  AM_CONDITIONAL(ENABLE_PILOT_CONDUITS, test "x$enable_pilot_conduits" = "xyes")
139 -if test x$enable_pilot_conduits = xyes; then
140 -   msg_pilot=yes
141 +dnl ******************************
142 +dnl If pilot conduits are enabled, check version of pilot-link
143 +dnl ******************************
144 + if test x$enable_pilot_conduits = xyes; then
145 +    msg_pilot=yes
146 +
147 +   PILOT_LINK_CHECK(0.11.4)
148 +   AC_SUBST(PILOT_LINK_MAJOR)
149 +   AC_SUBST(PILOT_LINK_MINOR)
150 +   AC_SUBST(PILOT_LINK_MICRO)
151 +   AC_SUBST(PILOT_LINK_PATCH)
152 +   AC_SUBST(PILOT_LINK_VERSION)
153 +
154 +   if test $PILOT_LINK_MINOR -ge 12; then
155 +      AC_DEFINE(PILOT_LINK_0_12,,[Building against pilot-link 0.12.0 or greater])
156 +   fi
157  else
158     msg_pilot=no
159  fi
160 Index: addressbook/conduit/address-conduit.c
161 ===================================================================
162 RCS file: /cvs/gnome/evolution/addressbook/conduit/address-conduit.c,v
163 retrieving revision 1.88
164 diff -u -r1.88 address-conduit.c
165 --- addressbook/conduit/address-conduit.c       6 Dec 2005 08:43:37 -0000       1.88
166 +++ addressbook/conduit/address-conduit.c       17 Nov 2006 07:29:48 -0000
167 @@ -462,6 +462,9 @@
168  {
169         static char buff[ 4096 ];
170         struct Address addr;
171 +#ifdef PILOT_LINK_0_12
172 +       pi_buffer_t * buffer;
173 +#endif
174  
175         if (remote == NULL) {
176                 sprintf (buff, "[NULL]");
177 @@ -469,7 +472,21 @@
178         }
179  
180         memset (&addr, 0, sizeof (struct Address));
181 +#ifdef PILOT_LINK_0_12
182 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
183 +       if(buffer == NULL){
184 +               sprintf (buff, "[NULL]");
185 +               return buff;
186 +       }
187 +       if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
188 +               sprintf (buff, "[NULL]");
189 +               return buff;
190 +       }
191 +       unpack_Address (&addr, buffer, address_v1);
192 +       pi_buffer_free(buffer);
193 +#else
194         unpack_Address (&addr, remote->record, remote->length);
195 +#endif
196  
197         g_snprintf (buff, 4096, "['%s' '%s' '%s']",
198                     addr.entry[entryLastname] ?
199 @@ -792,6 +809,9 @@
200  {
201         GnomePilotRecord p;
202         static char record[0xffff];
203 +#ifdef PILOT_LINK_0_12
204 +       pi_buffer_t * buffer;
205 +#endif
206         
207         g_assert (local->addr != NULL );
208         
209 @@ -804,9 +824,25 @@
210         p.secret = local->local.secret;
211  
212         /* Generate pilot record structure */
213 +
214 +#ifdef PILOT_LINK_0_12
215 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
216 +       if(buffer == NULL){
217 +               pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
218 +               return p;
219 +       }
220 +
221 +       pack_Address (local->addr, buffer, address_v1);
222 +
223 +       p.record = g_new0(unsigned char, buffer->used);
224 +       p.length = buffer->used;
225 +       memcpy(p.record, buffer->data, buffer->used);
226 +
227 +       pi_buffer_free(buffer);
228 +#else
229         p.record = record;
230         p.length = pack_Address (local->addr, p.record, 0xffff);
231 -
232 +#endif
233         return p;       
234  }
235  
236 @@ -834,16 +870,34 @@
237          */
238         if (local->local.ID != 0) {
239                 struct Address addr;
240 -               char record[0xffff];
241                 int cat = 0;
242 +#ifdef PILOT_LINK_0_12
243 +               pi_buffer_t * record;
244 +               record = pi_buffer_new(DLP_BUF_SIZE);
245 +               if(record == NULL){
246 +                       pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
247 +                       return;
248 +               }
249 +#else
250 +               char record[0xffff];
251 +#endif
252                 
253                 if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
254                                         ctxt->dbi->db_handle,
255 +#ifdef PILOT_LINK_0_12
256 +                                       local->local.ID, record, 
257 +                                       NULL, NULL, &cat) > 0) {
258 +#else
259                                         local->local.ID, &record, 
260                                         NULL, NULL, NULL, &cat) > 0) {
261 +#endif
262                         local->local.category = cat;
263                         memset (&addr, 0, sizeof (struct Address));
264 +#ifdef PILOT_LINK_0_12
265 +                       unpack_Address (&addr, record, address_v1);
266 +#else
267                         unpack_Address (&addr, record, 0xffff);
268 +#endif
269                         for (i = 0; i < 5; i++) {
270                                 if (addr.entry[entryPhone1 + i])
271                                         local->addr->entry[entryPhone1 + i] = 
272 @@ -858,6 +912,9 @@
273                         }
274                         free_Address (&addr);
275                 }
276 +#ifdef PILOT_LINK_0_12
277 +               pi_buffer_free (record);
278 +#endif
279         }
280  
281         local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_GIVEN_NAME));
282 @@ -1019,11 +1076,27 @@
283         EContactField next_mail, next_home, next_work, next_fax;
284         EContactField next_other, next_main, next_pager, next_mobile;
285         int i;
286 -
287 +#ifdef PILOT_LINK_0_12
288 +       pi_buffer_t * buffer;
289 +#endif
290         g_return_val_if_fail(remote!=NULL,NULL);
291         memset (&address, 0, sizeof (struct Address));
292 -       unpack_Address (&address, remote->record, remote->length);
293 +#ifdef PILOT_LINK_0_12
294 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
295 +       if(buffer == NULL){
296 +               pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
297 +               return NULL;
298 +       }
299  
300 +       if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
301 +               pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
302 +               return NULL;
303 +       }
304 +       unpack_Address (&address, buffer, address_v1);
305 +       pi_buffer_free(buffer);
306 +#else
307 +       unpack_Address (&address, remote->record, remote->length);
308 +#endif
309         if (in_contact == NULL)
310                 contact = e_contact_new ();
311         else
312 @@ -1217,6 +1290,9 @@
313         char *change_id;
314         char *auth;
315         gint num_records, add_records = 0, mod_records = 0, del_records = 0;
316 +#ifdef PILOT_LINK_0_12
317 +       pi_buffer_t *buffer;
318 +#endif
319  
320         abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
321  
322 @@ -1302,10 +1378,19 @@
323         gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records);
324         gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records);
325  
326 +#ifdef PILOT_LINK_0_12
327 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
328 +       if(buffer == NULL){
329 +               return pi_set_error(dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
330 +       }
331 +       
332 +       len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
333 +                             DLP_BUF_SIZE, buffer);
334 +#else
335         buf = (unsigned char*)g_malloc (0xffff);
336         len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
337                               (unsigned char *)buf, 0xffff);
338 -       
339 +#endif 
340         if (len < 0) {
341                 WARN (_("Could not read pilot's Address application block"));
342                 WARN ("dlp_ReadAppBlock(...) = %d", len);
343 @@ -1313,9 +1398,13 @@
344                                            _("Could not read pilot's Address application block"));
345                 return -1;
346         }
347 +#ifdef PILOT_LINK_0_12
348 +       unpack_AddressAppInfo (&(ctxt->ai), buffer->data, len);
349 +       pi_buffer_free (buffer);
350 +#else
351         unpack_AddressAppInfo (&(ctxt->ai), buf, len);
352         g_free (buf);
353 -
354 +#endif
355         check_for_slow_setting (conduit, ctxt);
356         if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot
357             || ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyFromPilot)
358 Index: calendar/conduits/calendar/calendar-conduit.c
359 ===================================================================
360 RCS file: /cvs/gnome/evolution/calendar/conduits/calendar/calendar-conduit.c,v
361 retrieving revision 1.132
362 diff -u -r1.132 calendar-conduit.c
363 --- calendar/conduits/calendar/calendar-conduit.c       23 Dec 2005 04:39:34 -0000      1.132
364 +++ calendar/conduits/calendar/calendar-conduit.c       17 Nov 2006 07:29:48 -0000
365 @@ -413,6 +413,9 @@
366  {
367         static char buff[ 4096 ];
368         struct Appointment appt;
369 +#ifdef PILOT_LINK_0_12
370 +       pi_buffer_t * buffer;
371 +#endif
372  
373         if (remote == NULL) {
374                 sprintf (buff, "[NULL]");
375 @@ -420,8 +423,22 @@
376         }
377  
378         memset (&appt, 0, sizeof (struct Appointment));
379 +#ifdef PILOT_LINK_0_12
380 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
381 +       if(buffer == NULL){
382 +               sprintf (buff, "[NULL]");
383 +               return buff;
384 +       }
385 +       if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
386 +               sprintf (buff, "[NULL]");
387 +               return buff;
388 +       }
389 +       
390 +       unpack_Appointment (&appt, buffer, datebook_v1);
391 +       pi_buffer_free(buffer);
392 +#else
393         unpack_Appointment (&appt, remote->record, remote->length);
394 -
395 +#endif
396         g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']",
397                     mktime (&appt.begin),
398                     mktime (&appt.end),
399 @@ -819,6 +836,9 @@
400  {
401         GnomePilotRecord p;
402         static char record[0xffff];
403 +#ifdef PILOT_LINK_0_12
404 +       pi_buffer_t * buffer;
405 +#endif
406  
407         g_assert (local->comp != NULL);
408         g_assert (local->appt != NULL );
409 @@ -830,9 +850,23 @@
410         p.secret = local->local.secret;
411  
412         /* Generate pilot record structure */
413 +#ifdef PILOT_LINK_0_12
414 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
415 +       if(buffer == NULL){
416 +               pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
417 +               return p;
418 +       }
419 +       
420 +       pack_Appointment (local->appt, buffer, datebook_v1);
421 +       p.record = g_new0(unsigned char, buffer->used);
422 +       p.length = buffer->used;
423 +       memcpy(p.record, buffer->data, buffer->used);
424 +       
425 +       pi_buffer_free(buffer); 
426 +#else
427         p.record = record;
428         p.length = pack_Appointment (local->appt, p.record, 0xffff);
429 -
430 +#endif
431         return p;       
432  }
433  
434 @@ -867,22 +901,44 @@
435           * we don't overwrite them 
436          */
437         if (local->local.ID != 0) {
438 +               int cat = 0;
439 +#ifdef PILOT_LINK_0_12
440 +               struct Appointment appt;
441 +               pi_buffer_t * record;
442 +       
443 +               record = pi_buffer_new(DLP_BUF_SIZE);
444 +               if(record == NULL){
445 +                       pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
446 +                       return;
447 +               }
448 +#else
449                 struct Appointment appt;                
450                 char record[0xffff];
451 -               int cat = 0;
452 -               
453 +#endif 
454                 if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
455                                         ctxt->dbi->db_handle,
456 +#ifdef PILOT_LINK_0_12
457 +                                       local->local.ID, record, 
458 +                                       NULL, NULL, &cat) > 0) {
459 +#else
460                                         local->local.ID, &record, 
461                                         NULL, NULL, NULL, &cat) > 0) {
462 +#endif
463                         local->local.category = cat;
464                         memset (&appt, 0, sizeof (struct Appointment));
465 +#ifdef PILOT_LINK_0_12
466 +                       unpack_Appointment (&appt, record, datebook_v1);
467 +#else
468                         unpack_Appointment (&appt, record, 0xffff);
469 +#endif
470                         local->appt->alarm = appt.alarm;
471                         local->appt->advance = appt.advance;
472                         local->appt->advanceUnits = appt.advanceUnits;
473                         free_Appointment (&appt);
474                 }
475 +#ifdef PILOT_LINK_0_12
476 +               pi_buffer_free (record);
477 +#endif
478         }
479  
480         /* STOP: don't replace these with g_strdup, since free_Appointment
481 @@ -1140,12 +1196,28 @@
482         GSList *edl = NULL;     
483         char *txt;
484         int pos, i;
485 -       
486 +#ifdef PILOT_LINK_0_12
487 +       pi_buffer_t * buffer;
488 +#endif
489         g_return_val_if_fail (remote != NULL, NULL);
490  
491 +#ifdef PILOT_LINK_0_12
492 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
493 +       if(buffer == NULL){
494 +               return NULL;
495 +       }
496 +       
497 +       if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
498 +               return NULL;
499 +       }
500 +
501 +       unpack_Appointment (&appt, buffer, datebook_v1);
502 +       pi_buffer_free(buffer);
503 +
504 +#else
505         memset (&appt, 0, sizeof (struct Appointment));
506         unpack_Appointment (&appt, remote->record, remote->length);
507 -
508 +#endif
509         if (in_comp == NULL) {
510                 comp = e_cal_component_new ();
511                 e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
512 @@ -1413,7 +1485,9 @@
513         char *filename, *change_id;
514         icalcomponent *icalcomp;
515         gint num_records, add_records = 0, mod_records = 0, del_records = 0;
516 -
517 +#ifdef PILOT_LINK_0_12
518 +       pi_buffer_t * buffer;
519 +#endif
520         abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
521  
522         LOG (g_message ( "---------------------------------------------------------\n" ));
523 @@ -1521,10 +1595,21 @@
524         gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records);
525         gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records);
526  
527 +#ifdef PILOT_LINK_0_12
528 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
529 +       if(buffer == NULL){
530 +               pi_set_error(dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
531 +               return -1;
532 +       }
533 +
534 +       len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
535 +                               DLP_BUF_SIZE,
536 +                               buffer);
537 +#else
538         buf = (unsigned char*)g_malloc (0xffff);
539         len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
540                               (unsigned char *)buf, 0xffff);
541 -       
542 +#endif
543         if (len < 0) {
544                 WARN (_("Could not read pilot's Calendar application block"));
545                 WARN ("dlp_ReadAppBlock(...) = %d", len);
546 @@ -1532,6 +1617,11 @@
547                                            _("Could not read pilot's Calendar application block"));
548                 return -1;
549         }
550 +#ifdef PILOT_LINK_0_12
551 +       buf = g_new0 (unsigned char,buffer->used);
552 +       memcpy(buf, buffer->data, buffer->used);
553 +       pi_buffer_free(buffer);
554 +#endif
555         unpack_AppointmentAppInfo (&(ctxt->ai), buf, len);
556         g_free (buf);
557  
558 Index: calendar/conduits/todo/todo-conduit.c
559 ===================================================================
560 RCS file: /cvs/gnome/evolution/calendar/conduits/todo/todo-conduit.c,v
561 retrieving revision 1.98
562 diff -u -r1.98 todo-conduit.c
563 --- calendar/conduits/todo/todo-conduit.c       13 May 2006 07:58:02 -0000      1.98
564 +++ calendar/conduits/todo/todo-conduit.c       17 Nov 2006 07:29:48 -0000
565 @@ -402,15 +402,30 @@
566  {
567         static char buff[ 4096 ];
568         struct ToDo todo;
569 -
570 +#ifdef PILOT_LINK_0_12
571 +       pi_buffer_t * buffer;
572 +#endif
573         if (remote == NULL) {
574                 sprintf (buff, "[NULL]");
575                 return buff;
576         }
577  
578         memset (&todo, 0, sizeof (struct ToDo));
579 +#ifdef PILOT_LINK_0_12
580 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
581 +       if(buffer == NULL){
582 +               sprintf (buff, "[NULL]");
583 +               return buff;
584 +       }
585 +       if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
586 +               sprintf (buff, "[NULL]");
587 +               return buff;
588 +       }
589 +       unpack_ToDo (&todo, buffer, todo_v1);
590 +       pi_buffer_free(buffer);
591 +#else
592         unpack_ToDo (&todo, remote->record, remote->length);
593 -
594 +#endif
595         g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s' %d]",
596                     todo.indefinite,
597                     mktime (&todo.due),
598 @@ -594,7 +609,11 @@
599                               EToDoConduitContext *ctxt)
600  {
601         GnomePilotRecord p;
602 +#ifdef PILOT_LINK_0_12
603 +       pi_buffer_t * buffer;
604 +#else
605         static char record[0xffff];
606 +#endif
607  
608         g_assert (local->comp != NULL);
609         g_assert (local->todo != NULL );
610 @@ -607,10 +626,24 @@
611         p.archived = local->local.archived;
612         p.secret = local->local.secret;
613  
614 -       /* Generate pilot record structure */
615 +       /* Generate pilot record structure */
616 +#ifdef PILOT_LINK_0_12
617 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
618 +       if(buffer == NULL){
619 +               pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
620 +               return p;
621 +       }
622 +
623 +       pack_ToDo (local->todo, buffer, todo_v1);
624 +       p.record = g_new0(unsigned char, buffer->used);
625 +       p.length = buffer->used;
626 +       memcpy(p.record, buffer->data, buffer->used);
627 +
628 +       pi_buffer_free(buffer); 
629 +#else
630         p.record = record;
631         p.length = pack_ToDo (local->todo, p.record, 0xffff);
632 -
633 +#endif
634         return p;       
635  }
636  
637 @@ -696,15 +729,32 @@
638  
639         /* Don't overwrite the category */
640         if (local->local.ID != 0) {
641 -               char record[0xffff];
642                 int cat = 0;
643 +#ifdef PILOT_LINK_0_12
644 +               pi_buffer_t * record;
645 +               record = pi_buffer_new(DLP_BUF_SIZE);
646 +               if(record == NULL){
647 +                       pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
648 +                       return;
649 +               }
650 +#else
651 +               char record[0xffff];
652 +#endif
653                 
654                 if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
655                                         ctxt->dbi->db_handle,
656 +#ifdef PILOT_LINK_0_12
657 +                                       local->local.ID, record, 
658 +                                       NULL, NULL, &cat) > 0) {
659 +#else
660                                         local->local.ID, &record, 
661                                         NULL, NULL, NULL, &cat) > 0) {
662 +#endif
663                         local->local.category = cat;
664                 }
665 +#ifdef PILOT_LINK_0_12
666 +               pi_buffer_free(record);
667 +#endif
668         }
669         
670         /*
671 @@ -860,11 +910,28 @@
672         int priority;
673         char *txt;
674         char *category;
675 +#ifdef PILOT_LINK_0_12
676 +       pi_buffer_t * buffer;
677 +#endif
678         
679         g_return_val_if_fail (remote != NULL, NULL);
680  
681 +#ifdef PILOT_LINK_0_12
682 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
683 +       if(buffer == NULL){
684 +               return NULL;
685 +       }
686 +
687 +       if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
688 +               return NULL;
689 +       }
690 +
691 +       unpack_ToDo (&todo, buffer, todo_v1);
692 +       pi_buffer_free(buffer);
693 +#else
694         memset (&todo, 0, sizeof (struct ToDo));
695         unpack_ToDo (&todo, remote->record, remote->length);
696 +#endif
697  
698         utc_zone = icaltimezone_get_utc_timezone ();
699         now = icaltime_from_timet_with_zone (time (NULL), FALSE, 
700 @@ -1018,6 +1085,9 @@
701         char *filename, *change_id;
702         icalcomponent *icalcomp;
703         gint num_records, add_records = 0, mod_records = 0, del_records = 0;
704 +#ifdef PILOT_LINK_0_12
705 +       pi_buffer_t * buffer;
706 +#endif
707  
708         abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
709  
710 @@ -1104,10 +1174,20 @@
711         g_message("num_records: %d\nadd_records: %d\nmod_records: %d\ndel_records: %d\n",
712                         num_records, add_records, mod_records, del_records);
713  
714 +#ifdef PILOT_LINK_0_12
715 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
716 +       if(buffer == NULL){
717 +               pi_set_error(dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
718 +               return -1;
719 +       }
720 +       len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
721 +                               DLP_BUF_SIZE,
722 +                               buffer);
723 +#else
724         buf = (unsigned char*)g_malloc (0xffff);
725         len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
726                               (unsigned char *)buf, 0xffff);
727 -       
728 +#endif 
729         if (len < 0) {
730                 WARN (_("Could not read pilot's ToDo application block"));
731                 WARN ("dlp_ReadAppBlock(...) = %d", len);
732 @@ -1115,6 +1195,12 @@
733                                            _("Could not read pilot's ToDo application block"));
734                 return -1;
735         }
736 +
737 +#ifdef PILOT_LINK_0_12
738 +       buf = g_new0 (unsigned char,buffer->used);
739 +       memcpy(buf, buffer->data,buffer->used);
740 +       pi_buffer_free(buffer);
741 +#endif
742         unpack_ToDoAppInfo (&(ctxt->ai), buf, len);
743         g_free (buf);
744         
745 Index: calendar/conduits/memo/memo-conduit.c
746 ===================================================================
747 RCS file: /cvs/gnome/evolution/calendar/conduits/memo/memo-conduit.c,v
748 retrieving revision 1.1
749 diff -u -r1.1 memo-conduit.c
750 --- calendar/conduits/memo/memo-conduit.c       19 Oct 2005 11:39:35 -0000      1.1
751 +++ calendar/conduits/memo/memo-conduit.c       17 Nov 2006 07:29:48 -0000
752 @@ -331,6 +331,9 @@
753  {
754         static char buff[ 64 ];
755         struct Memo memo;
756 +#ifdef PILOT_LINK_0_12
757 +       pi_buffer_t *buffer;
758 +#endif
759  
760         if (remote == NULL) {
761                 sprintf (buff, "[NULL]");
762 @@ -338,8 +341,22 @@
763         }
764  
765         memset (&memo, 0, sizeof (struct Memo));
766 -       unpack_Memo (&memo, remote->record, remote->length);
767 +#ifdef PILOT_LINK_0_12
768 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
769 +       if(buffer == NULL){
770 +               sprintf (buff, "[NULL]");
771 +               return buff;
772 +       }
773 +       if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
774 +               sprintf (buff, "[NULL]");
775 +               return buff;
776 +       }
777 +       unpack_Memo (&memo, buffer, memo_v1);
778  
779 +       pi_buffer_free(buffer);
780 +#else
781 +       unpack_Memo (&memo, remote->record, remote->length);
782 +#endif
783         g_snprintf (buff, 64, "['%s']",
784                     memo.text ?
785                     memo.text : "");
786 @@ -452,6 +469,9 @@
787  {
788         GnomePilotRecord p;
789         static char record[0xffff];
790 +#ifdef PILOT_LINK_0_12
791 +       pi_buffer_t * buffer;
792 +#endif
793  
794         g_assert (local->comp != NULL);
795         g_assert (local->memo != NULL );
796 @@ -465,9 +485,23 @@
797         p.secret = local->local.secret;
798  
799         /* Generate pilot record structure */
800 +#ifdef PILOT_LINK_0_12
801 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
802 +       if(buffer == NULL){
803 +               pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
804 +               return p;
805 +       }
806 +
807 +       pack_Memo (local->memo, buffer, memo_v1);
808 +       p.record = g_new0(unsigned char, buffer->used);
809 +       p.length = buffer->used;
810 +       memcpy(p.record, buffer->data, buffer->used);
811 +
812 +       pi_buffer_free(buffer);
813 +#else
814         p.record = record;
815         p.length = pack_Memo (local->memo, p.record, 0xffff);
816 -
817 +#endif
818         return p;       
819  }
820  
821 @@ -568,16 +602,41 @@
822  
823         /* Don't overwrite the category */
824         if (local->local.ID != 0) {
825 +#ifdef PILOT_LINK_0_12
826 +               struct Memo memo;
827 +               pi_buffer_t * record;
828 +#else
829                 char record[0xffff];
830 +#endif
831                 int cat = 0;
832                 
833 +#ifdef PILOT_LINK_0_12
834 +               record = pi_buffer_new(DLP_BUF_SIZE);
835 +               if(record == NULL){
836 +                       pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
837 +                       return;
838 +               }
839 +#endif
840 +
841                 LOG(fprintf(stderr, "local_record_from_comp: calling dlp_ReadRecordById\n"));
842                 if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, 
843                                         ctxt->dbi->db_handle,
844 +#ifdef PILOT_LINK_0_12
845 +                                       local->local.ID, record, 
846 +                                       NULL, NULL, &cat) > 0) {
847 +                       local->local.category = cat;
848 +                       memset (&memo, 0, sizeof (struct Memo));
849 +                       unpack_Memo (&memo, record, memo_v1);
850 +                       local->memo->text = strdup (memo.text);
851 +                       free_Memo (&memo);
852 +               }
853 +               pi_buffer_free (record);
854 +#else
855                                         local->local.ID, &record, 
856                                         NULL, NULL, NULL, &cat) > 0) {
857                         local->local.category = cat;
858 -               }
859 +               }       
860 +#endif
861                 LOG(fprintf(stderr, "local_record_from_comp: done calling dlp_ReadRecordById\n"));
862         }
863         
864 @@ -704,11 +763,27 @@
865         char *txt, *txt2, *txt3;
866         char *category;
867         int i;
868 -       
869 +#ifdef PILOT_LINK_0_12
870 +       pi_buffer_t * buffer;
871 +#endif
872         g_return_val_if_fail (remote != NULL, NULL);
873  
874 +#ifdef PILOT_LINK_0_12
875 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
876 +       if(buffer == NULL){
877 +               return NULL;
878 +       }
879 +       
880 +       if(pi_buffer_append(buffer, remote->record, remote->length)==NULL){
881 +               return NULL;
882 +       }
883 +       
884 +       unpack_Memo (&memo, buffer, memo_v1);
885 +       pi_buffer_free(buffer);
886 +#else
887         memset (&memo, 0, sizeof (struct Memo));
888         unpack_Memo (&memo, remote->record, remote->length);
889 +#endif
890  
891         utc_zone = icaltimezone_get_utc_timezone ();
892         now = icaltime_from_timet_with_zone (time (NULL), FALSE, 
893 @@ -840,6 +915,9 @@
894         char *filename, *change_id;
895         icalcomponent *icalcomp;
896         gint num_records, add_records = 0, mod_records = 0, del_records = 0;
897 +#ifdef PILOT_LINK_0_12
898 +       pi_buffer_t * buffer;
899 +#endif
900  
901         abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit);
902  
903 @@ -929,10 +1007,21 @@
904         g_message("num_records: %d\nadd_records: %d\nmod_records: %d\ndel_records: %d\n",
905                 num_records, add_records, mod_records, del_records);
906  
907 +#ifdef PILOT_LINK_0_12
908 +       buffer = pi_buffer_new(DLP_BUF_SIZE);
909 +       if(buffer == NULL){
910 +               pi_set_error(dbi->pilot_socket, PI_ERR_GENERIC_MEMORY);
911 +               return -1;
912 +       }
913 +
914 +       len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
915 +                               DLP_BUF_SIZE,
916 +                               buffer);
917 +#else
918         buf = (unsigned char*)g_malloc (0xffff);
919         len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,
920                               (unsigned char *)buf, 0xffff);
921 -       
922 +#endif
923         if (len < 0) {
924                 WARN (_("Could not read pilot's Memo application block"));
925                 WARN ("dlp_ReadAppBlock(...) = %d", len);
926 @@ -940,7 +1029,15 @@
927                                            _("Could not read pilot's Memo application block"));
928                 return -1;
929         }
930 +#ifdef PILOT_LINK_0_12
931 +       buf = g_new0 (unsigned char,buffer->used);
932 +       memcpy(buf, buffer->data, buffer->used);
933 +       unpack_MemoAppInfo (&(ctxt->ai), buf, len);
934 +       pi_buffer_free(buffer);
935 +#else
936         unpack_MemoAppInfo (&(ctxt->ai), buf, len);
937 +#endif
938 +
939         g_free (buf);
940         
941         lastDesktopUniqueID = 128;
This page took 0.120582 seconds and 3 git commands to generate.