From: <svn...@op...> - 2009-05-14 19:39:14
|
Author: Graham Cobb Date: Thu May 14 21:38:58 2009 New Revision: 5644 URL: http://www.opensync.org/changeset/5644 Log: gpe-sync: Fix to hashtable changes Modified: plugins/gpe/ChangeLog plugins/gpe/src/contacts.c plugins/gpe/src/utils.c Modified: plugins/gpe/ChangeLog ============================================================================== --- plugins/gpe/ChangeLog Thu May 14 21:25:40 2009 (r5643) +++ plugins/gpe/ChangeLog Thu May 14 21:38:58 2009 (r5644) @@ -1,5 +1,9 @@ 2009-05-14 Graham Cobb <g+...@co...> + * src/utils.c: Add hashtable assertions + + * src/contacts.c (gpe_contacts_setup): Fix hashtable changes: request hashtable, add assertions + * src/gpe_sync.h: Bug #1082: Hashtable changes: remove hashtable pointer from sink_environment Modified: plugins/gpe/src/contacts.c ============================================================================== --- plugins/gpe/src/contacts.c Thu May 14 21:25:40 2009 (r5643) +++ plugins/gpe/src/contacts.c Thu May 14 21:38:58 2009 (r5644) @@ -43,6 +43,8 @@ gpe_assert(sinkenv == &env->contact_sink); // Check userdata is being passed correctly + gpe_assert(hashtable); + if (!gpe_assert(env->configured && env->discovered)) { osync_trace(TRACE_ERROR, "GPE plugin not initialised: configured = %d, discovered = %d", env->configured, env->discovered ); osync_context_report_error (ctx, OSYNC_ERROR_GENERIC, "GPE plugin not initialised: configured = %d, discovered = %d", env->configured, env->discovered); @@ -127,6 +129,8 @@ gpe_assert(sinkenv == &env->contact_sink); // Check userdata is being passed correctly + gpe_assert(hashtable); + if (!gpe_assert(env->configured && env->discovered)) { osync_trace(TRACE_ERROR, "GPE plugin not initialised: configured = %d, discovered = %d", env->configured, env->discovered ); osync_context_report_error (ctx, OSYNC_ERROR_GENERIC, "GPE plugin not initialised: configured = %d, discovered = %d", env->configured, env->discovered); @@ -234,6 +238,9 @@ goto exit; // No contact sink configured. Not an error. } + /* Request a hashtable from the framework. */ + osync_objtype_sink_enable_hashtable(sinkenv->sink, TRUE); + osync_objtype_sink_set_get_changes_func(sinkenv->sink, gpe_contacts_get_changes); osync_objtype_sink_set_commit_func(sinkenv->sink, gpe_contacts_commit_change); osync_objtype_sink_set_userdata(sinkenv->sink, sinkenv); Modified: plugins/gpe/src/utils.c ============================================================================== --- plugins/gpe/src/utils.c Thu May 14 21:25:40 2009 (r5643) +++ plugins/gpe/src/utils.c Thu May 14 21:38:58 2009 (r5644) @@ -84,6 +84,8 @@ OSyncError *error = NULL; OSyncHashTable *hashtable = osync_objtype_sink_get_hashtable(sinkenv->sink); + gpe_assert(hashtable); + OSyncData *data = osync_data_new(string, strlen(string)+1, sinkenv->objformat, &error); if (!data) { osync_context_report_osyncwarning(ctx, error); @@ -138,6 +140,8 @@ OSyncError *error = NULL; OSyncHashTable *hashtable = osync_objtype_sink_get_hashtable(sinkenv->sink); + gpe_assert(hashtable); + //check for deleted entries ... via hashtable int i; OSyncList *u, *uids = osync_hashtable_get_deleted(hashtable); |