Attachment 'gnome-pilot-conduits-2.0.12-p1.txt'
Download 1 --- gnome-pilot-conduits-2.0.12/expense/expense_conduit.c.port-to-pilot-link-0.12 2003-01-26 18:04:09.000000000 -0500
2 +++ gnome-pilot-conduits-2.0.12/expense/expense_conduit.c 2005-03-15 17:35:07.000000000 -0500
3 @@ -238,8 +238,7 @@
4 static gint copy_from_pilot( GnomePilotConduit *c, GnomePilotDBInfo *dbi )
5 {
6 int dbHandle;
7 - guchar buffer[0xffff];
8 -
9 + pi_buffer_t *pi_buf;
10 struct ExpenseAppInfo *tai;
11 struct ExpensePref *tp;
12
13 @@ -263,8 +262,10 @@
14 g_warning("Unable to open ExpenseDB");
15 return -1;
16 }
17 +
18 + pi_buf = pi_buffer_new (0xffff);
19
20 - unpack_ExpensePref(tp, buffer, 0xffff);
21 + unpack_ExpensePref(tp, pi_buf->data, 0xffff);
22
23 #ifdef EC_DEBUG
24 fprintf(stderr, "Orig prefs, %d bytes:\n", ret);
25 @@ -280,9 +281,9 @@
26 fprintf(stderr, "\n");
27 #endif /* EC_DEBUG */
28
29 - ret = dlp_ReadAppBlock(dbi->pilot_socket, dbHandle, 0, buffer, 0xffff);
30 + ret = dlp_ReadAppBlock(dbi->pilot_socket, dbHandle, 0, 0xffff, pi_buf);
31
32 - unpack_ExpenseAppInfo(tai, buffer, 0xffff);
33 + unpack_ExpenseAppInfo(tai, pi_buf->data, 0xffff);
34
35 #ifdef EC_DEBUG
36 fprintf(stderr, "Orig length %d, new length %d, orig data:\n";, ret, i);
37 @@ -323,7 +324,7 @@
38 struct Expense t;
39 int attr, category, len;
40
41 - len = dlp_ReadRecordByIndex(dbi->pilot_socket, dbHandle, i, buffer, 0, 0, &attr, &category);
42 + len = dlp_ReadRecordByIndex(dbi->pilot_socket, dbHandle, i, pi_buf, 0, &attr, &category);
43
44 /* at the end of all the records? */
45 if(len < 0)
46 @@ -332,7 +333,7 @@
47 if((attr & dlpRecAttrDeleted) || (attr & dlpRecAttrArchived))
48 continue;
49
50 - unpack_Expense(&t, buffer, len);
51 + unpack_Expense(&t, pi_buf->data, len);
52 writeout_record(filehandle[category], &t, c);
53 free_Expense(&t);
54 }
55 @@ -348,6 +349,10 @@
56
57 /* Close the database */
58 dlp_CloseDB(dbi->pilot_socket, dbHandle);
59 +
60 + if (pi_buf) {
61 + pi_buffer_free (pi_buf);
62 + }
63
64 return( result );
65 }
66 --- gnome-pilot-conduits-2.0.12/memo_file/memo_file_conduit.c.port-to-pilot-link-0.12 2005-03-15 17:37:25.000000000 -0500
67 +++ gnome-pilot-conduits-2.0.12/memo_file/memo_file_conduit.c 2005-03-15 17:37:32.000000000 -0500
68 @@ -868,7 +868,7 @@
69 pre_sync (GnomePilotConduit *c, GnomePilotDBInfo *dbi)
70 {
71 int l;
72 - unsigned char *buf;
73 + pi_buffer_t *pi_buf;
74
75 g_message ("MemoFile Conduit v %s", CONDUIT_VERSION);
76
77 @@ -876,14 +876,14 @@
78
79 GET_CONDUIT_DATA (c)->dbi=dbi;
80
81 - buf = (unsigned char*)g_malloc (0xffff);
82 - if ((l=dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,(unsigned char *)buf, 0xffff))<0) {
83 + pi_buf = pi_buffer_new (0xffff);
84 + if ((l=dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0,0xffff, pi_buf))<0) {
85 LOG ("dlp_ReadAppBlock (...) failed");
86 - g_free (buf);
87 + pi_buffer_free (pi_buf);
88 return -1;
89 }
90 - unpack_MemoAppInfo (&(GET_CONDUIT_DATA (c)->ai), buf, l);
91 - g_free (buf);
92 + unpack_MemoAppInfo (&(GET_CONDUIT_DATA (c)->ai), pi_buf->data, l);
93 + pi_buffer_free (pi_buf);
94
95 if (GET_CONDUIT_CFG (c)->dir==NULL || *(GET_CONDUIT_CFG (c)->dir) == '\0') {
96 return -1;
97 --- gnome-pilot-conduits-2.0.12/email/email_conduit.c.port-to-pilot-link-0.12 2003-01-26 17:29:20.000000000 -0500
98 +++ gnome-pilot-conduits-2.0.12/email/email_conduit.c 2005-03-15 17:35:07.000000000 -0500
99 @@ -301,7 +301,7 @@
100 static gint synchronize( GnomePilotConduit *c, GnomePilotDBInfo *dbi )
101 {
102 int dbHandle;
103 - guchar buffer[0xffff];
104 + pi_buffer_t *pi_buf;
105 struct MailAppInfo tai;
106 struct MailSyncPref pref;
107 struct MailSignaturePref sig;
108 @@ -319,9 +319,11 @@
109 fprintf( stderr, "Unable to open mail database\n" );
110 return( -1 );
111 }
112 +
113 + pi_buf = pi_buffer_new (0xffff);
114
115 - dlp_ReadAppBlock( dbi->pilot_socket, dbHandle, 0, buffer, 0xffff );
116 - unpack_MailAppInfo( &tai, buffer, 0xffff );
117 + dlp_ReadAppBlock( dbi->pilot_socket, dbHandle, 0, 0xffff, pi_buf);
118 + unpack_MailAppInfo( &tai, pi_buf->data, 0xffff );
119
120 pref.syncType = 0;
121 pref.getHigh = 0;
122 @@ -333,20 +335,20 @@
123
124 if ( pi_version( dbi->pilot_socket ) > 0x0100 ) {
125 if ( dlp_ReadAppPreference( dbi->pilot_socket, makelong("mail"), 1, 1,
126 - 0xffff, buffer, 0, 0 ) >= 0 ) {
127 - unpack_MailSyncPref( &pref, buffer, 0xffff );
128 + 0xffff, pi_buf, 0, 0 ) >= 0 ) {
129 + unpack_MailSyncPref( &pref, pi_buf->data, 0xffff );
130 } else {
131 if ( dlp_ReadAppPreference( dbi->pilot_socket, makelong("mail"), 1,
132 - 1, 0xffff, buffer, 0, 0 ) >= 0 ) {
133 - unpack_MailSyncPref( &pref, buffer, 0xffff );
134 + 1, 0xffff, pi_buf, 0, 0 ) >= 0 ) {
135 + unpack_MailSyncPref( &pref, pi_buf->data, 0xffff );
136 } else {
137 LOG("Couldn't get any mail preferences.\n",0);
138 }
139 }
140
141 if ( dlp_ReadAppPreference( dbi->pilot_socket, makelong("mail"), 3, 1,
142 - 0xffff, buffer, 0, 0 ) > 0 ) {
143 - unpack_MailSignaturePref( &sig, buffer, 0xffff );
144 + 0xffff, pi_buf->data, 0, 0 ) > 0 ) {
145 + unpack_MailSignaturePref( &sig, pi_buf->data, 0xffff );
146 }
147 }
148
149 @@ -359,7 +361,7 @@
150 FILE * sendf;
151
152 length = dlp_ReadNextRecInCategory( dbi->pilot_socket, dbHandle, 1,
153 - buffer, &recID, 0, &size, &attr );
154 + pi_buf, &recID, 0, &attr );
155
156 if ( length < 0 ) {
157 break;
158 @@ -369,7 +371,7 @@
159 continue;
160 }
161
162 - unpack_Mail( &t, buffer, length );
163 + unpack_Mail( &t, pi_buf->data, length );
164
165 sendf = popen( GET_CONFIG(c)->sendmail, "w" );
166 if ( sendf == NULL ) {
167 @@ -451,7 +453,7 @@
168 } else if ( !strcmp( GET_CONFIG(c)->sendAction,
169 "file" ) ) {
170 dlp_WriteRecord( dbi->pilot_socket, dbHandle, attr, recID, 3,
171 - buffer, size, 0);
172 + pi_buf, size, 0);
173 }
174 free_Mail( &t );
175 }
176 @@ -469,7 +471,7 @@
177
178 /* iterate through records in category 0 (Inbox) ... */
179 length = dlp_ReadNextRecInCategory( dbi->pilot_socket, dbHandle, 0,
180 - buffer, &recID, 0, &size, &attr);
181 + pi_buf, &recID, 0, &attr);
182 if ( length < 0 ) {
183 break;
184 }
185 @@ -479,7 +481,7 @@
186 record->recID = recID;
187 record->size = length;
188 record->buffer = ((guchar *) record) + sizeof(*record);
189 - memcpy(record->buffer, buffer, length);
190 + memcpy(record->buffer, pi_buf->data, length);
191 inbox_list = g_list_append(inbox_list, record);
192 LOG("storing record %d", recID);
193 }
194 @@ -523,19 +525,19 @@
195 #endif
196
197 len = 0;
198 - while ( ( len < sizeof(buffer) ) &&
199 - ( ( l = read( mhmsg, (char *)(buffer+len),
200 - sizeof(buffer)-len ) ) > 0 ) ) {
201 + while ( ( len < pi_buf->allocated ) &&
202 + ( ( l = read( mhmsg, (char *)(pi_buf->data+len),
203 + pi_buf->allocated-len ) ) > 0 ) ) {
204 len += l;
205 }
206 - buffer[len] = 0;
207 + pi_buf->data[len] = 0;
208
209 if ( l < 0 ) {
210 fprintf( stderr, "Error processing message %d\n", i );
211 break;
212 }
213
214 - if (write_message_to_pilot (c, dbi, dbHandle, buffer, i)) {
215 + if (write_message_to_pilot (c, dbi, dbHandle, pi_buf->data, i)) {
216 rec++;
217 if ( strcmp( GET_CONFIG(c)->receiveAction, "delete" ) == 0 ) {
218 char filename[1000];
219 @@ -563,9 +565,9 @@
220
221
222 if (f) {
223 - fgets (buffer, sizeof (buffer) - 1, f);
224 - while (!feof (f) && strncmp (buffer, "From ", 5)) {
225 - fgets (buffer, sizeof (buffer) - 1, f);
226 + fgets (pi_buf->data, pi_buf->allocated - 1, f);
227 + while (!feof (f) && strncmp (pi_buf->data, "From ", 5)) {
228 + fgets (pi_buf->data, pi_buf->allocated - 1, f);
229 }
230 for( i = 1; !feof (f); i++ ) {
231 int len;
232 @@ -573,9 +575,9 @@
233
234 LOG( "Processing message %d", i );
235 len = 0;
236 - while ( ( len < sizeof(buffer) ) &&
237 - ( ( p = fgets ( (char *)(buffer+len),
238 - sizeof(buffer)-len, f ) ) != 0 ) ) {
239 + while ( ( len < pi_buf->allocated ) &&
240 + ( ( p = fgets ( (char *)(pi_buf->data+len),
241 + pi_buf->allocated-len, f ) ) != 0 ) ) {
242 if (!strncmp (p, "From ", 5)) {
243 break;
244 } else {
245 @@ -583,7 +585,7 @@
246 }
247 }
248
249 - buffer[len] = 0;
250 + pi_buf->data[len] = 0;
251 len = 0;
252
253 if ( len < 0 ) {
254 @@ -591,7 +593,7 @@
255 break;
256 }
257
258 - write_message_to_pilot (c, dbi, dbHandle, buffer, i);
259 + write_message_to_pilot (c, dbi, dbHandle, pi_buf->data, i);
260 }
261 fclose (f);
262 if ( strcmp( GET_CONFIG(c)->receiveAction, "delete" ) == 0 ) {
263 @@ -621,6 +623,8 @@
264 dlp_ResetLastSyncPC( dbi->pilot_socket );
265 dlp_CloseDB( dbi->pilot_socket, dbHandle );
266
267 + pi_buffer_free (pi_buf);
268 +
269 return( 0 );
270 }
271
272 --- gnome-pilot-conduits-2.0.12/mal-conduit/mal/client/unix/malsync.c.port-to-pilot-link-0.12 2002-09-16 13:16:23.000000000 -0400
273 +++ gnome-pilot-conduits-2.0.12/mal-conduit/mal/client/unix/malsync.c 2005-03-15 17:35:07.000000000 -0500
274 @@ -107,8 +107,7 @@
275 int pilot_rHandle;
276 int pilot_RecIndex;
277 recordid_t id;
278 - uint8 *pilot_buffer;
279 - int pilot_buffer_size;
280 + pi_buffer_t *pi_buf;
281
282 /* Secure Network Library Stuff */
283 AGBool hasseclib;
284 @@ -270,8 +269,8 @@
285 if (NULL != pInfo->userConfig)
286 AGUserConfigFree(pInfo->userConfig);
287
288 - if (NULL != pInfo->pilot_buffer)
289 - free(pInfo->pilot_buffer);
290 + if (NULL != pInfo->pi_buf)
291 + pi_buffer_free (pInfo->pi_buf);
292
293 if (NULL != pInfo->commandProcessor)
294 AGCommandProcessorFree(pInfo->commandProcessor);
295 @@ -294,9 +293,8 @@
296
297 bzero(pInfo, sizeof(PalmSyncInfo));
298
299 - pInfo->pilot_buffer_size = pbs;
300 - pInfo->pilot_buffer = (uint8 *)malloc(pbs);
301 - if (NULL == pInfo->pilot_buffer)
302 + pInfo->pi_buf = pi_buffer_new (pbs);
303 + if (NULL == pInfo->pi_buf)
304 goto fail;
305
306 /* Allocate the platform calls record. */
307 @@ -345,8 +343,7 @@
308 /*---------------------------------------------------------------------------*/
309 static void
310 readAndUseDeviceInfoDatabase(AGDeviceInfo * devInfo,
311 - uint8 *dev_db_info_buffer,
312 - uint32 dev_db_info_buffer_size)
313 + pi_buffer_t *pi_buf)
314 {
315 int database_id = 0;
316 long result;
317 @@ -373,13 +370,13 @@
318 int rc;
319
320 rc = dlp_ReadRecordByIndex(sd, database_id, 0,
321 - (void *)dev_db_info_buffer,
322 - &id, &dev_db_info_buffer_size,
323 + pi_buf,
324 + &id,
325 &attr, &cat);
326
327
328 if (rc >= 0) {
329 - uint8 *p = dev_db_info_buffer;
330 + uint8 *p = pi_buf->data;
331 int16 dev_db_info_version = readInt16(p);
332 p+=sizeof(int16);
333 devInfo->colorDepth = readInt32(p);
334 @@ -472,8 +469,7 @@
335 }
336
337 readAndUseDeviceInfoDatabase(devInfo,
338 - pInfo->pilot_buffer,
339 - pInfo->pilot_buffer_size);
340 + pInfo->pi_buf);
341
342 /* Override the color depth if the user wants low res images. */
343 if (lowres) {
344 @@ -664,31 +660,36 @@
345 readDeviceUserConfig32(int userConfigDBHandle, AGUserConfig **deviceUserConfig)
346 {
347 recordid_t id;
348 - int bufferSize = BUFFERSIZE;
349 + pi_buffer_t *pi_buf;
350 int attr = 0;
351 int cat = 0;
352 int rc;
353 - uint8 buffer[BUFFERSIZE];
354 AGBufferReader * r = NULL;
355
356 - rc = dlp_ReadRecordByIndex(sd, userConfigDBHandle, 0, (void *)buffer,
357 - &id, &bufferSize, &attr, &cat);
358 + pi_buf = pi_buffer_new (BUFFERSIZE);
359 +
360 + rc = dlp_ReadRecordByIndex(sd, userConfigDBHandle, 0, pi_buf,
361 + &id, &attr, &cat);
362
363 if (rc < 0) {
364 if (verbose)
365 printf("readDeviceUserConfig: dlp_ReadRecordByIndex , err = %d\n",
366 rc);
367 + pi_buffer_free (pi_buf);
368 return 0;
369 }
370
371 - r = AGBufferReaderNew(buffer);
372 + r = AGBufferReaderNew(pi_buf->data);
373 if (r) {
374 *deviceUserConfig = AGUserConfigNew();
375 AGUserConfigReadData(*deviceUserConfig, (AGReader*)r);
376 AGBufferReaderFree(r);
377 + pi_buffer_free (pi_buf);
378 return id;
379 - } else
380 + } else {
381 + pi_buffer_free (pi_buf);
382 return 0;
383 + }
384 }
385 #define BUFFERSIZE 0xFFFF
386 /*---------------------------------------------------------------------------*/
387 @@ -696,31 +697,36 @@
388 AGUserConfig **deviceUserConfig)
389 {
390 recordid_t id;
391 - int bufferSize = BUFFERSIZE;
392 int attr = 0;
393 int cat = 0;
394 int rc;
395 - uint8 buffer[BUFFERSIZE];
396 + pi_buffer_t *pi_buf;
397 AGBufferReader * r = NULL;
398
399 - rc = dlp_ReadRecordByIndex(sd, userConfigDBHandle, 0, (void *)buffer,
400 - &id, &bufferSize, &attr, &cat);
401 + pi_buf = pi_buffer_new (BUFFERSIZE);
402 +
403 + rc = dlp_ReadRecordByIndex(sd, userConfigDBHandle, 0, pi_buf,
404 + &id, &attr, &cat);
405
406 if (rc < 0) {
407 if (verbose)
408 printf("readDeviceUserConfig: dlp_ReadRecordByIndex , err = %d\n",
409 rc);
410 + pi_buffer_free (pi_buf);
411 return 0;
412 }
413
414 - r = AGBufferReaderNew(buffer);
415 + r = AGBufferReaderNew(pi_buf->data);
416 if (r) {
417 *deviceUserConfig = AGUserConfigNew();
418 MAL31ReadUserData(*deviceUserConfig, (AGReader*)r);
419 AGBufferReaderFree(r);
420 + pi_buffer_free (pi_buf);
421 return id;
422 - } else
423 + } else {
424 + pi_buffer_free (pi_buf);
425 return 0;
426 + }
427 }
428 /*---------------------------------------------------------------------------*/
429 static int32 readDeviceUserConfig(int userConfigDBHandle,
430 @@ -741,14 +747,16 @@
431 {
432
433 recordid_t id;
434 - int bufferSize = BUFFERSIZE;
435 int attr = 0;
436 int cat = 0;
437 - uint8 buffer[BUFFERSIZE];
438 AGBufferWriter * w = NULL;
439 +
440 w = AGBufferWriterNew(0);
441 if (w) {
442 long result;
443 + pi_buffer_t *pi_buf;
444 +
445 + pi_buf = pi_buffer_new (BUFFERSIZE);
446
447 if (threeone) {
448 MAL31WriteUserData(deviceUserConfig, (AGWriter*)w);
449 @@ -756,8 +764,8 @@
450 AGUserConfigWriteData(deviceUserConfig, (AGWriter*)w);
451 }
452
453 - result = dlp_ReadRecordByIndex(sd, userConfigDBHandle, 0, (void *)buffer,
454 - &id, &bufferSize, &attr, &cat);
455 + result = dlp_ReadRecordByIndex(sd, userConfigDBHandle, 0, pi_buf,
456 + &id, &attr, &cat);
457
458 if (result < 0)
459 id = 0;
460 @@ -767,7 +775,7 @@
461 AGBufferWriterGetBufferSize(w),
462 &id);
463 AGBufferWriterFree(w);
464 -
465 + pi_buffer_free (pi_buf);
466 }
467 }
468
469 @@ -1055,17 +1063,17 @@
470 int32 result;
471 int att = 0;
472 int cat = 0;
473 - int size = pInfo->pilot_buffer_size;
474 + //int size = pInfo->pi_buf->allocated;
475 int idx = pInfo->pilot_RecIndex++;
476
477 result = (modonly) ?
478 - dlp_ReadNextModifiedRec (sd, pInfo->pilot_rHandle, pInfo->pilot_buffer,
479 + dlp_ReadNextModifiedRec (sd, pInfo->pilot_rHandle, pInfo->pi_buf,
480 &pInfo->id, &idx,
481 - &size, &att, &cat)
482 + &att, &cat)
483 :
484 dlp_ReadRecordByIndex(sd, pInfo->pilot_rHandle, idx,
485 - pInfo->pilot_buffer, &pInfo->id,
486 - &size, &att, &cat);
487 + pInfo->pi_buf, &pInfo->id,
488 + &att, &cat);
489
490 if (result < 0) {
491 closeDatabase(pInfo);
492 @@ -1081,7 +1089,7 @@
493 }
494 pInfo->record = AGRecordInit(pInfo->record, pInfo->id,
495 AGPalmPilotAttribsToMALMod((uint8)att),
496 - size, pInfo->pilot_buffer, 0, NULL);
497 + pInfo->pi_buf->used, pInfo->pi_buf->data, 0, NULL);
498
499 *record = pInfo->record;
500 return AGCLIENT_CONTINUE;
501 @@ -1397,7 +1405,6 @@
502 static void
503 Connect(PalmSyncInfo *pi)
504 {
505 - struct pi_sockaddr addr;
506 int ret;
507
508 if (sd != 0)
509 @@ -1414,10 +1421,7 @@
510 exit(1);
511 }
512
513 - addr.pi_family = PI_AF_PILOT;
514 - strcpy(addr.pi_device, device);
515 -
516 - ret = pi_bind(sd, (struct sockaddr*)&addr, sizeof(addr));
517 + ret = pi_bind(sd, device);
518 if(ret == -1) {
519 fprintf(stderr, "Unable to bind to port '%s'.\n", device);
520 exit(1);
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.