Changeset 2103
- Timestamp:
- 06/09/07 01:12:14 (1 year ago)
- Files:
-
- plugins/gnokii-sync/src/gnokii_contact.c (modified) (7 diffs)
- plugins/gnokii-sync/src/gnokii_contact_format.c (modified) (1 diff)
- plugins/gnokii-sync/src/gnokii_sync.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/gnokii-sync/src/gnokii_contact.c
r2102 r2103 359 359 gn_phonebook_entry *contact = NULL; 360 360 gn_memory_status memstat; 361 gn_data *data = (gn_data *) malloc(sizeof(gn_data)); 362 363 memset(data, 0, sizeof(gn_data)); 361 gn_data *data = osync_try_malloc0(sizeof(gn_data), &error); 364 362 365 363 OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); … … 422 420 continue; 423 421 422 // prepare UID with gnokii-contact-<memory type>-<memory location> 423 uid = gnokii_contact_uid(contact); 424 424 425 hash = gnokii_contact_hash(contact); 425 426 OSyncChangeType type = osync_hashtable_get_changetype(sinkenv->hashtable, uid, hash); … … 427 428 if (type == OSYNC_CHANGE_TYPE_UNMODIFIED) { 428 429 g_free(hash); 430 g_free(uid); 431 g_free(contact); 429 432 continue; 430 433 } … … 434 437 OSyncChange *change = osync_change_new(&error); 435 438 436 // prepare UID with gnokii-contact-<memory type>-<memory location>437 uid = gnokii_contact_uid(contact);438 439 439 440 osync_change_set_uid(change, uid); … … 443 444 // set data 444 445 osync_trace(TRACE_INTERNAL, "objformat: %p", sinkenv->objformat); 445 OSyncData * data = osync_data_new((char *) contact, sizeof(gn_phonebook_entry), sinkenv->objformat, &error);446 if (! data) {446 OSyncData *odata = osync_data_new((char *) contact, sizeof(gn_phonebook_entry), sinkenv->objformat, &error); 447 if (!odata) { 447 448 osync_change_unref(change); 448 449 osync_context_report_osyncwarning(ctx, error); … … 450 451 g_free(hash); 451 452 g_free(uid); 453 g_free(contact); 452 454 continue; 453 455 } 454 456 455 osync_data_set_objtype( data, osync_objtype_sink_get_name(sink));456 osync_change_set_data(change, data);457 osync_data_unref( data);457 osync_data_set_objtype(odata, osync_objtype_sink_get_name(sink)); 458 osync_change_set_data(change, odata); 459 osync_data_unref(odata); 458 460 459 461 osync_context_report_change(ctx, change); … … 466 468 g_free(hash); 467 469 g_free(uid); 468 469 470 } 470 471 } 472 473 g_free(data); 471 474 472 475 plugins/gnokii-sync/src/gnokii_contact_format.c
r2101 r2103 34 34 static osync_bool conv_gnokii_contact_to_xmlformat(char *input, unsigned int inpsize, char **output, unsigned int *outpsize, osync_bool *free_input, const char *config, OSyncError **error) 35 35 { 36 osync_trace(TRACE_ENTRY, "%s(%p, % p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config, error);36 osync_trace(TRACE_ENTRY, "%s(%p, %i, %p, %p, %p, %s, %p)", __func__, input, inpsize, output, outpsize, free_input, config, error); 37 37 38 38 OSyncXMLField *xmlfield = NULL; plugins/gnokii-sync/src/gnokii_sync.c
r2102 r2103 24 24 osync_trace(TRACE_ENTRY, "%s()", __func__); 25 25 26 while (env->sinks) { 27 gnokii_sinkenv *sinkenv = env->sinks->data; 28 29 osync_objtype_sink_unref(sinkenv->sink); 30 g_free(sinkenv); 31 32 env->sinks = g_list_remove(env->sinks, sinkenv); 33 } 34 26 35 if (env->state) 27 36 g_free(env->state); … … 117 126 free_gnokiienv(env); 118 127 128 119 129 osync_trace(TRACE_EXIT, "%s", __func__); 120 130 } … … 131 141 GList *s = NULL; 132 142 for (s = env->sinks; s; s = s->next) { 133 OSyncObjTypeSink *sink= s->data;134 osync_objtype_sink_set_available(sink , TRUE);143 gnokii_sinkenv *sinkenv = s->data; 144 osync_objtype_sink_set_available(sinkenv->sink, TRUE); 135 145 } 136 146 … … 222 232 223 233 env->sinks = g_list_append(env->sinks, event_sinkenv); 224 225 234 226 235 //Process the config data here and set the options on your environment
