From: <svn...@op...> - 2010-08-27 17:31:55
|
Author: paule Date: Fri Aug 27 19:31:46 2010 New Revision: 6105 URL: http://www.opensync.org/changeset/6105 Log: opie-sync: fix for changes to osync_error_set() API function Modified: plugins/opie-sync/src/opie_sync.c Modified: plugins/opie-sync/src/opie_sync.c ============================================================================== --- plugins/opie-sync/src/opie_sync.c Thu Aug 26 21:33:51 2010 (r6104) +++ plugins/opie-sync/src/opie_sync.c Fri Aug 27 19:31:46 2010 (r6105) @@ -168,26 +168,20 @@ env->username, env->password); if(!env->qcopconn->result) { - char *errmsg = g_strdup_printf("qcop_connect failed: %s", env->qcopconn->resultmsg); - osync_error_set(error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(error, OSYNC_ERROR_GENERIC, "qcop_connect failed: %s", env->qcopconn->resultmsg); goto error; } qcop_start_sync(env->qcopconn, &sync_cancelled); if(!env->qcopconn->result) { - char *errmsg = g_strdup_printf("qcop_start_sync_failed: %s", env->qcopconn->resultmsg); - osync_error_set(error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(error, OSYNC_ERROR_GENERIC, "qcop_start_sync_failed: %s", env->qcopconn->resultmsg); qcop_stop_sync(env->qcopconn); goto error; } env->dev_root_path = qcop_get_root(env->qcopconn); if(!env->dev_root_path) { - char *errmsg = g_strdup_printf("qcop_get_root failed: %s\n", env->qcopconn->resultmsg); - osync_error_set(error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(error, OSYNC_ERROR_GENERIC, "qcop_get_root failed: %s\n", env->qcopconn->resultmsg); qcop_stop_sync(env->qcopconn); goto error; } @@ -218,9 +212,7 @@ if(env->qcopconn) { qcop_stop_sync(env->qcopconn); if (!env->qcopconn->result) { - char *errmsg = g_strdup_printf("qcop_stop_sync_failed: %s", env->qcopconn->resultmsg); - osync_error_set(error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(error, OSYNC_ERROR_GENERIC, "qcop_stop_sync_failed: %s", env->qcopconn->resultmsg); qcop_disconnect(env->qcopconn); /* frees qcopconn */ env->qcopconn = NULL; goto error; @@ -281,9 +273,7 @@ if(env->plugin_env->use_qcop) { qcop_version_info version; if(!qcop_get_version(env->plugin_env->qcopconn, &version)) { - char *errmsg = g_strdup_printf("qcop_get_version failed: %s", env->plugin_env->qcopconn->resultmsg); - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, "qcop_get_version failed: %s", env->plugin_env->qcopconn->resultmsg); g_mutex_unlock(env->plugin_env->plugin_mutex); goto error; } @@ -320,9 +310,7 @@ /* Get hostname */ const gchar *hostname = g_get_host_name(); if(!qcop_set_peer_info(env->plugin_env->qcopconn, env->plugin_env->peer_id, hostname)) { - char *errmsg = g_strdup_printf("qcop_set_peer_info failed: %s", env->plugin_env->qcopconn->resultmsg); - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, "qcop_set_peer_info failed: %s", env->plugin_env->qcopconn->resultmsg); g_mutex_unlock(env->plugin_env->plugin_mutex); goto error; } @@ -358,10 +346,7 @@ g_mutex_unlock(env->plugin_env->plugin_mutex); if(!connected) { - char *errmsg; - errmsg = g_strdup_printf("Device not connected"); - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, "Device not connected"); goto error; } @@ -379,10 +364,7 @@ if(env->plugin_env->opie_v1_2_5 && env->plugin_env->use_qcop) { env->slow_sync_en = FALSE; if(!qcop_start_app_sync(env->plugin_env->qcopconn, env->appname, env->slow_sync_en, FALSE, &env->fastcapable, &force_slowsync)) { - char *errmsg; - errmsg = g_strdup_printf("Couldn't start application sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, "Couldn't start application sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); goto error; } if(env->fastcapable) { @@ -433,10 +415,7 @@ gboolean unused1, unused2; /* Slow-sync requested by someone else, we have to tell Opie about it */ if(!qcop_start_app_sync(env->plugin_env->qcopconn, env->appname, TRUE, FALSE, &unused1, &unused2)) { - char *errmsg; - errmsg = g_strdup_printf("Couldn't start application slow-sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, "Couldn't start application slow-sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); goto error; } env->slow_sync_en = TRUE; @@ -446,12 +425,9 @@ if(!opie_fetch_sink(env, ctx)) { /* failed */ - char *errmsg; /* FIXME this should be being done already? */ device_disconnect(env->plugin_env, &error); - errmsg = g_strdup_printf("Failed to load data from device %s", env->plugin_env->host); - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, "Failed to load data from device %s", env->plugin_env->host); goto error; } @@ -481,7 +457,7 @@ /* Retrieve and set the uid of the object */ char *uid = opie_xml_get_tagged_uid(item_node); if(!uid) { - osync_trace(TRACE_EXIT_ERROR, "%s: unable to get UID from entry"); + osync_trace(TRACE_EXIT_ERROR, "%s: unable to get UID from entry", __func__); return; } osync_change_set_uid(change, uid); @@ -712,9 +688,8 @@ if ( !opie_put_sink(env) ) { osync_trace( TRACE_INTERNAL, "opie_put_sink failed" ); - char *errmsg = g_strdup_printf( "Failed to send data to device %s", env->plugin_env->host ); /* FIXME specify which data */ - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + /* FIXME specify which data */ + osync_error_set(&error, OSYNC_ERROR_GENERIC, "Failed to send data to device %s", env->plugin_env->host); goto error; } @@ -727,10 +702,7 @@ if(env->plugin_env->opie_v1_2_5 && env->plugin_env->use_qcop) { if(!qcop_finish_app_sync(env->plugin_env->qcopconn, env->appname)) { osync_trace( TRACE_INTERNAL, "qcop_finish_app_sync failed" ); - char *errmsg; - errmsg = g_strdup_printf("Couldn't finish application sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); - osync_error_set(&error, OSYNC_ERROR_GENERIC, errmsg); - g_free(errmsg); + osync_error_set(&error, OSYNC_ERROR_GENERIC, "Couldn't finish application sync for %s: %s", env->appname, env->plugin_env->qcopconn->resultmsg); goto error; } } |