You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2009-03-16 15:45:52
|
Author: bellmich Date: Mon Mar 16 16:45:40 2009 New Revision: 977 URL: http://libsyncml.opensync.org/changeset/977 Log: try to fix glib bug on Solaris Modified: trunk/tests/check_libsoup.c Modified: trunk/tests/check_libsoup.c ============================================================================== --- trunk/tests/check_libsoup.c Mon Mar 16 16:35:43 2009 (r976) +++ trunk/tests/check_libsoup.c Mon Mar 16 16:45:40 2009 (r977) @@ -73,6 +73,8 @@ } else { g_atomic_int_inc(&server_errors); } + /* glib has problems if it must print NULL on Solaris */ + soup_message_set_status (msg, SOUP_STATUS_OK); smlTrace(TRACE_EXIT, "%s", __func__); } |
From: <svn...@op...> - 2009-03-16 15:35:54
|
Author: bellmich Date: Mon Mar 16 16:35:43 2009 New Revision: 976 URL: http://libsyncml.opensync.org/changeset/976 Log: Even a too short request is an error. Modified: trunk/tests/check_libsoup.c Modified: trunk/tests/check_libsoup.c ============================================================================== --- trunk/tests/check_libsoup.c Mon Mar 16 16:32:06 2009 (r975) +++ trunk/tests/check_libsoup.c Mon Mar 16 16:35:43 2009 (r976) @@ -66,9 +66,9 @@ const char *content = msg->request_body->data; size_t length = msg->request_body->length; #endif - if (length > strlen("test")) - length = strlen("test"); - if (memcmp("test", content, length) == 0) { + if (length < strlen("test")) { + g_atomic_int_inc(&server_errors); + } else if (memcmp("test", content, 4) == 0) { g_atomic_int_inc(&server_messages); } else { g_atomic_int_inc(&server_errors); |
From: <svn...@op...> - 2009-03-16 15:32:22
|
Author: bellmich Date: Mon Mar 16 16:32:06 2009 New Revision: 975 URL: http://libsyncml.opensync.org/changeset/975 Log: added some more checks to detect errors more closely Modified: trunk/tests/check_libsoup.c Modified: trunk/tests/check_libsoup.c ============================================================================== --- trunk/tests/check_libsoup.c Mon Mar 16 16:19:44 2009 (r974) +++ trunk/tests/check_libsoup.c Mon Mar 16 16:32:06 2009 (r975) @@ -56,11 +56,13 @@ gpointer data) #endif { - smlTrace(TRACE_INTERNAL, "%s", __func__); + smlTrace(TRACE_ENTRY, "%s(%p)", __func__, msg); + smlAssert(msg); #ifdef HAVE_LIBSOUP22 const char *content = msg->request.body; size_t length = msg->request.length; #else + smlAssert(msg->request_body); const char *content = msg->request_body->data; size_t length = msg->request_body->length; #endif @@ -71,6 +73,7 @@ } else { g_atomic_int_inc(&server_errors); } + smlTrace(TRACE_EXIT, "%s", __func__); } START_TEST (libsoup_async) |
From: <svn...@op...> - 2009-03-16 15:19:50
|
Author: bellmich Date: Mon Mar 16 16:19:44 2009 New Revision: 974 URL: http://libsyncml.opensync.org/changeset/974 Log: added another function name for libsooup 2.2 Modified: trunk/tests/check_libsoup.c Modified: trunk/tests/check_libsoup.c ============================================================================== --- trunk/tests/check_libsoup.c Mon Mar 16 16:12:50 2009 (r973) +++ trunk/tests/check_libsoup.c Mon Mar 16 16:19:44 2009 (r974) @@ -26,6 +26,11 @@ #include <libsoup/soup-message.h> #include <libsoup/soup-session-sync.h> +#ifdef HAVE_LIBSOUP22 +#define soup_message_headers_get soup_message_get_header +#define soup_message_headers_append soup_message_add_header +#endif + static int server_messages; static int server_errors; |
From: <svn...@op...> - 2009-03-16 15:13:07
|
Author: bellmich Date: Mon Mar 16 16:12:50 2009 New Revision: 973 URL: http://libsyncml.opensync.org/changeset/973 Log: added libsoup validation Added: trunk/tests/check_libsoup.c Modified: trunk/tests/CMakeLists.txt Modified: trunk/tests/CMakeLists.txt ============================================================================== --- trunk/tests/CMakeLists.txt Fri Mar 13 14:52:48 2009 (r972) +++ trunk/tests/CMakeLists.txt Mon Mar 16 16:12:50 2009 (r973) @@ -15,7 +15,7 @@ # include Testing Macro INCLUDE( Testing ) # include necessary headers - INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBWBXML2_INCLUDE_DIRS} ) + INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${GLIB2_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LIBWBXML2_INCLUDE_DIRS} ${LIBSOUP2_INCLUDE_DIRS} ) # add tests SET( TEST_TARGET_LIBRARIES support ) ADD_CHECK_TEST( error check_error.c ${TEST_TARGET_LIBRARIES} ) @@ -37,6 +37,7 @@ ENDIF( ENABLE_OBEX AND ENABLE_OPENOBEX_TCP ) IF ( ENABLE_HTTP ) + ADD_CHECK_TEST( libsoup check_libsoup.c ${TEST_TARGET_LIBRARIES} ) ADD_CHECK_TEST( http check_http.c ${TEST_TARGET_LIBRARIES} ) ADD_CHECK_TEST( manager check_manager.c ${TEST_TARGET_LIBRARIES} ) ENDIF ( ENABLE_HTTP ) Added: trunk/tests/check_libsoup.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/check_libsoup.c Mon Mar 16 16:12:50 2009 (r973) @@ -0,0 +1,164 @@ +/* + * libsyncml - A syncml protocol implementation + * Copyright (C) 2009 Michael Bell <mic...@op...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "support.h" + +#include <libsoup/soup-session-async.h> +#include <libsoup/soup-uri.h> +#include <libsoup/soup-server.h> +#include <libsoup/soup-message.h> +#include <libsoup/soup-session-sync.h> + +static int server_messages; +static int server_errors; + +static void init_testbed() +{ + setup_testbed(NULL); + + g_type_init(); + + server_messages = 0; + server_errors = 0; +} + +#ifdef HAVE_LIBSOUP22 +static void server_callback(SoupServerContext *context, SoupMessage *msg, gpointer data) +#else +static void server_callback( + SoupServer *server, + SoupMessage *msg, + const char *path, + GHashTable *query, + SoupClientContext *client, + gpointer data) +#endif +{ + smlTrace(TRACE_INTERNAL, "%s", __func__); +#ifdef HAVE_LIBSOUP22 + const char *content = msg->request.body; + size_t length = msg->request.length; +#else + const char *content = msg->request_body->data; + size_t length = msg->request_body->length; +#endif + if (length > strlen("test")) + length = strlen("test"); + if (memcmp("test", content, length) == 0) { + g_atomic_int_inc(&server_messages); + } else { + g_atomic_int_inc(&server_errors); + } +} + +START_TEST (libsoup_async) +{ + init_testbed(); + SmlError *error = NULL; + + /* prepare asynchronous runtime environment */ + + GMainContext *ctx = g_main_context_new(); + sml_fail_unless(ctx != NULL, NULL); + SmlThread *thread = smlThreadNew(ctx, &error); + sml_fail_unless(thread != NULL, "%s", smlErrorPrint(&error)); + + /* create async server */ + + SoupServer *server = soup_server_new (SOUP_SERVER_PORT, 13001, SOUP_SERVER_ASYNC_CONTEXT, ctx, NULL); + sml_fail_unless(server != NULL, NULL); +#ifdef HAVE_LIBSOUP22 + soup_server_add_handler (server, NULL, NULL, server_callback, NULL, NULL); +#else + soup_server_add_handler (server, NULL, server_callback, NULL, NULL); +#endif + soup_server_run_async (server); + + /* start thread */ + + smlThreadStart(thread); + + /* create synchonous client */ + + SoupSession *session = soup_session_sync_new (); + sml_fail_unless(session != NULL, NULL); + SoupMessage *msg = soup_message_new (SOUP_METHOD_GET, "http://127.0.0.1:13001/"); + soup_message_headers_append(msg->request_headers, "Accept", "text/plain"); + soup_message_set_request (msg, "text/plain", +#ifdef HAVE_LIBSOUP22 + SOUP_BUFFER_SYSTEM_OWNED, +#else + SOUP_MEMORY_TAKE, +#endif + g_memdup("test", 4), 4); + soup_session_send_message (session, msg); + + /* wait until message was received by server */ + + while (server_messages < 1 && server_errors < 1) + { + usleep(50); + } + + /* check counter */ + + sml_fail_unless(server_messages == 1, NULL); + sml_fail_unless(server_errors == 0, NULL); + + /* cleanup */ + soup_session_abort(session); + g_object_unref(session); + smlThreadStop(thread); + smlThreadFree(thread); + g_main_context_unref(ctx); + soup_server_quit(server); + g_object_unref(server); + +} +END_TEST + +Suite *http_suite(void) +{ + Suite *s = suite_create("libsoup validation"); + //Suite *s2 = suite_create("libsoup validation"); + + create_case(s, "libsoup_async", libsoup_async); + + return s; +} + +int main(void) +{ + configure_environment(); + + int nf; + + Suite *s = http_suite(); + + SRunner *sr; + sr = srunner_create(s); + srunner_run_all(sr, CK_VERBOSE); + nf = srunner_ntests_failed(sr); + srunner_free(sr); + + cleanup_environment(); + + return (nf == 0) ? 0 : 1; +} |
From: <svn...@op...> - 2009-03-13 13:52:55
|
Author: bellmich Date: Fri Mar 13 14:52:48 2009 New Revision: 972 URL: http://libsyncml.opensync.org/changeset/972 Log: added support for the case that a client sends alert 200 and receives alert 200 but needs to update to a SLOW-SYNC alert 201 because of an internal problem like wrong anchors NOTE: This code is untested because I failed to simulate this until now. Modified: trunk/libsyncml/data_sync_api/data_sync_client.c Modified: trunk/libsyncml/data_sync_api/data_sync_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_client.c Fri Mar 13 13:34:48 2009 (r971) +++ trunk/libsyncml/data_sync_api/data_sync_client.c Fri Mar 13 14:52:48 2009 (r972) @@ -101,10 +101,47 @@ &error); if (h == SML_ALERT_UNKNOWN || error) goto error; + /* There is only one situation where the callback can return + * something different than type. If the client requested an + * alert type 200, the server requested an alert type 200 too + * and after this there is a problem detected on the client + * then the returned type can be 201 SLOW-SYNC. + * + * If this happens then a new alert 201 and a status 508 must + * be send. + */ if (h != type) { - smlErrorSet(&error, SML_ERROR_GENERIC, - "It is not possible to change the alert type after an OMA DS client received the alerts from the OMA DS server."); - goto error; + if (h != SML_ALERT_SLOW_SYNC) { + smlErrorSet(&error, SML_ERROR_GENERIC, + "It is not possible to change the alert type after an OMA DS client received the alerts from the OMA DS server."); + goto error; + } else { + /* send alert 201 */ + SmlLocation *source = NULL; + source = smlLocationNew(datastore->sourceUri, NULL, &error); + if (!source) + goto error; + SmlCommand *alert = NULL; + alert = smlCommandNewAlert( + SML_ALERT_SLOW_SYNC, + smlDsSessionGetTarget(datastore->session), + source, + NULL, datastore->localNext, + NULL, &error); + if (!alert) { + smlLocationUnref(source); + goto error; + } + smlLocationUnref(source); + if (!smlSessionSendCommand(dsObject->session, alert, NULL, NULL, NULL, &error)) { + smlCommandUnref(alert); + goto error; + } + smlCommandUnref(alert); + + /* send status 508 */ + ret = FALSE; + } } } |
From: <svn...@op...> - 2009-03-13 12:38:59
|
Author: bellmich Date: Fri Mar 13 13:38:53 2009 New Revision: 5291 URL: http://www.opensync.org/changeset/5291 Log: The function disconnect can now be used to abort the synchronization. - sync_done is now a main function and not a sink function - sync_done is used to determine normal disconnects - introduced state variable waitForDisconnect - removed useless variable command and the according enum type definition OSyncPluginSyncmlDatastoreCommand - uses the new libsyncml DS API function smlDataSyncAbort Modified: plugins/syncml/src/syncml_common.c plugins/syncml/src/syncml_common.h plugins/syncml/src/syncml_ds_client.c plugins/syncml/src/syncml_ds_server.c Modified: plugins/syncml/src/syncml_common.c ============================================================================== --- plugins/syncml/src/syncml_common.c Fri Mar 13 10:25:49 2009 (r5290) +++ plugins/syncml/src/syncml_common.c Fri Mar 13 13:38:53 2009 (r5291) @@ -202,7 +202,16 @@ void sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { + osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, ctx, data); + SmlPluginEnv *env = (SmlPluginEnv *)data; + g_assert(env); + osync_context_report_success(ctx); + + /* disconnect is allowed now */ + env->waitForDisconnect = TRUE; + + osync_trace(TRACE_EXIT, "%s", __func__, ctx); } void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) @@ -211,15 +220,16 @@ SmlPluginEnv *env = (SmlPluginEnv *)data; g_assert(env); - SmlBool waiting = FALSE; + SmlBool waitForConnectDone = FALSE; if (env->databases && ((SmlDatabase *)env->databases->data)->alert_type_mutex && !((SmlDatabase *)env->databases->data)->connectCtx) { /* the datastores are waiting for the approved alert types */ - waiting = TRUE; + waitForConnectDone = TRUE; } - if (!waiting && + if (!waitForConnectDone && + env->waitForDisconnect && ( (env->state1 >= SML_DATA_SYNC_EVENT_DISCONNECT && (!env->dsObject2 || @@ -254,6 +264,23 @@ } } + if (!env->waitForDisconnect) { + /* this is an abort */ + smlTrace(TRACE_INTERNAL, "%s: abort detected", __func__); + SmlError *error = NULL; + if (env->dsObject2 && env->state2 > SML_DATA_SYNC_EVENT_CONNECT) + { + smlDataSyncAbort(env->dsObject2, &error); + } else { + smlDataSyncAbort(env->dsObject1, &error); + } + if (error != NULL) + { + OSyncError *oserror = NULL; + osync_error_set(&oserror, OSYNC_ERROR_GENERIC, "%s", smlErrorPrint(&error)); + report_error_on_context(&(env->disconnectCtx), &oserror, TRUE); + } + } } osync_trace(TRACE_EXIT, "%s", __func__); @@ -767,6 +794,7 @@ /* prepare the function list for OpenSync */ OSyncObjTypeSinkFunctions main_functions; memset(&main_functions, 0, sizeof(main_functions)); + main_functions.sync_done = sync_done; main_functions.disconnect = disconnect; /* Register main sink for connect and disconnect functions */ Modified: plugins/syncml/src/syncml_common.h ============================================================================== --- plugins/syncml/src/syncml_common.h Fri Mar 13 10:25:49 2009 (r5290) +++ plugins/syncml/src/syncml_common.h Fri Mar 13 13:38:53 2009 (r5291) @@ -78,13 +78,6 @@ #define SYNCML_PLUGIN_CONFIG_AUTH_TYPE "AuthType" -typedef enum { - OSYNC_PLUGIN_SYNCML_COMMAND_UNKNOWN, - OSYNC_PLUGIN_SYNCML_COMMAND_SEND_ALERT, - OSYNC_PLUGIN_SYNCML_COMMAND_SEND_SYNC, - OSYNC_PLUGIN_SYNCML_COMMAND_RECV_SYNC, -} OSyncPluginSyncmlDatastoreCommand; - typedef struct SmlPluginEnv { SmlDataSyncObject *dsObject1; SmlDataSyncObject *dsObject2; @@ -93,6 +86,7 @@ /* libsyncml state management */ SmlBool abort; + SmlBool waitForDisconnect; SmlDataSyncEventType state1; SmlDataSyncEventType state2; @@ -130,8 +124,6 @@ unsigned int pendingChanges; unsigned int pendingCommits; - OSyncPluginSyncmlDatastoreCommand command; - OSyncContext *connectCtx; OSyncContext *syncModeCtx; OSyncContext *getChangesCtx; Modified: plugins/syncml/src/syncml_ds_client.c ============================================================================== --- plugins/syncml/src/syncml_ds_client.c Fri Mar 13 10:25:49 2009 (r5290) +++ plugins/syncml/src/syncml_ds_client.c Fri Mar 13 13:38:53 2009 (r5291) @@ -48,7 +48,6 @@ functions.connect = syncml_connect; functions.connect_done = syncml_connect_done; functions.get_changes = ds_client_get_changeinfo; - functions.sync_done = sync_done; functions.batch_commit = ds_client_batch_commit; // Request an anchor from the framework. Modified: plugins/syncml/src/syncml_ds_server.c ============================================================================== --- plugins/syncml/src/syncml_ds_server.c Fri Mar 13 10:25:49 2009 (r5290) +++ plugins/syncml/src/syncml_ds_server.c Fri Mar 13 13:38:53 2009 (r5291) @@ -45,7 +45,6 @@ functions.connect = syncml_connect; functions.connect_done = syncml_connect_done; functions.get_changes = ds_server_get_changeinfo; - functions.sync_done = sync_done; functions.batch_commit = ds_server_batch_commit; // Request an anchor from the framework. |
From: <svn...@op...> - 2009-03-13 12:35:01
|
Author: bellmich Date: Fri Mar 13 13:34:48 2009 New Revision: 971 URL: http://libsyncml.opensync.org/changeset/971 Log: added a first implementation of the function smlDataSyncAbort Added: trunk/libsyncml/data_sync_api/data_sync_abort.c Modified: trunk/libsyncml/CMakeLists.txt trunk/libsyncml/data_sync_api/standard.h Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Fri Mar 13 10:29:53 2009 (r970) +++ trunk/libsyncml/CMakeLists.txt Fri Mar 13 13:34:48 2009 (r971) @@ -17,6 +17,7 @@ sml_support.c sml_transport.c data_sync_api/data_sync.c + data_sync_api/data_sync_abort.c data_sync_api/data_sync_callbacks.c data_sync_api/data_sync_common.c data_sync_api/data_sync_devinf.c Added: trunk/libsyncml/data_sync_api/data_sync_abort.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/data_sync_api/data_sync_abort.c Fri Mar 13 13:34:48 2009 (r971) @@ -0,0 +1,76 @@ +/* + * libsyncml - A syncml protocol implementation + * Copyright (C) 2009 Michael Bell <mic...@op...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "../syncml.h" +#include "../syncml_internals.h" +#include "../sml_error_internals.h" + +#include <libsyncml/data_sync_api/defines.h> +#include <libsyncml/data_sync_api/standard.h> +#include <libsyncml/data_sync_api/callbacks.h> + +#include "data_sync.h" + +/** + * This code is put into a separate source code file + * because potentially all internal tricks and hacks + * are used to abort the OMA DS session most carefully + * ... at minimum in the future ... + */ + +#include "../sml_session_internals.h" +#include "../sml_manager_internals.h" + +SmlBool smlDataSyncAbort( + SmlDataSyncObject *dsObject, + SmlError **error) +{ + smlTrace(TRACE_ENTRY, "%s", __func__); + + /* determine the state of the session */ + if (!dsObject->session->sending && !dsObject->session->waiting) + { + /* send abort command */ + smlTrace(TRACE_INTERNAL, "%s: A careful abort is possible.", __func__); + /* FIXME: Send a default abort command. */ + /* FIXME: Is it necessary or recommended to abort every datastore. */ + goto WORKAROUND; + } else { + /* stop transport */ +WORKAROUND: + smlTrace(TRACE_INTERNAL, "%s: A hard abort is required.", __func__); + SmlLink *link = smlManagerSessionGetLink( + dsObject->manager, + dsObject->session, + error); + if (!link && *error) + goto error; + + if (!smlTransportDisconnect(dsObject->tsp, link, error)) + goto error; + } + + smlTrace(TRACE_EXIT, "%s", __func__); + return TRUE; +error: + smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, smlErrorPrint(error)); + return FALSE; +} + Modified: trunk/libsyncml/data_sync_api/standard.h ============================================================================== --- trunk/libsyncml/data_sync_api/standard.h Fri Mar 13 10:29:53 2009 (r970) +++ trunk/libsyncml/data_sync_api/standard.h Fri Mar 13 13:34:48 2009 (r971) @@ -92,6 +92,23 @@ SmlError **error); /** + * Aborts the data synchronization in every state of the API. + * The only possible function call after this function is + * smlDataSyncObjectUnref. If you called this function then + * you can still wait for SML_DATA_SYNC_EVENT_ERROR or + * SML_DATA_SYNC_EVENT_FINISHED before you start to cleanup + * with smlDataSyncObjectUnref. + * + * @param dsObject The data sync object + * @param error The error condition + * + * @return TRUE on success. False on failure. + */ +SmlBool smlDataSyncAbort( + SmlDataSyncObject *dsObject, + SmlError **error); + +/** * Returns the identity of the remote sync peer. This is the * <Source></Source> tag. The returned reference is not owned * by the caller and must NOT be freed or unrefed by the caller. |
From: <svn...@op...> - 2009-03-13 09:29:57
|
Author: bellmich Date: Fri Mar 13 10:29:53 2009 New Revision: 970 URL: http://libsyncml.opensync.org/changeset/970 Log: - added a missing SmlDevInf reference which causes a segmentation fault if a cached SmlDevInf object is used by OpenSync's SyncML plugin - smlDataSyncObjectUnref tries to cleanup the transport now more cleanly - fixed several comments - added some trace statements Modified: trunk/libsyncml/data_sync_api/data_sync.c trunk/libsyncml/data_sync_api/data_sync.h trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/data_sync_api/standard.h trunk/libsyncml/sml_transport.c Modified: trunk/libsyncml/data_sync_api/data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.c Tue Mar 10 14:35:23 2009 (r969) +++ trunk/libsyncml/data_sync_api/data_sync.c Fri Mar 13 10:29:53 2009 (r970) @@ -61,6 +61,7 @@ dsObject->tspType = tspType; dsObject->version = SML_VERSION_11; dsObject->sentChanges = FALSE; + dsObject->isInitialized = FALSE; dsObject->useNumberOfChanges = TRUE; dsObject->useTimestampAnchor = TRUE; @@ -526,6 +527,8 @@ if (!dsObject->funcDsInit(dsObject, error)) goto error; + dsObject->isInitialized = TRUE; + smlTrace(TRACE_EXIT, "%s - TRUE", __func__); return TRUE; error: @@ -825,8 +828,20 @@ /* cleanup transport */ if ((*dsObject)->tsp) { SmlError *error = NULL; - if (!smlTransportFinalize((*dsObject)->tsp, &error)) { - g_warning("%s: %s", __func__, smlErrorPrint(&error)); + if ((*dsObject)->dsType == SML_SESSION_TYPE_CLIENT && + (*dsObject)->isConnected && + !(*dsObject)->gotDisconnect && + !smlTransportDisconnect((*dsObject)->tsp, NULL, &error)) { + /* just ignore the error */ + smlTrace(TRACE_ERROR, "%s: %s", + __func__, smlErrorPrint(&error)); + smlErrorDeref(&error); + } + /* FIXME: we have to wait here for the disconnect ... */ + if ((*dsObject)->isInitialized && + !smlTransportFinalize((*dsObject)->tsp, &error)) { + smlTrace(TRACE_ERROR, "%s: %s", + __func__, smlErrorPrint(&error)); smlErrorDeref(&error); } smlTransportFree((*dsObject)->tsp); Modified: trunk/libsyncml/data_sync_api/data_sync.h ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.h Tue Mar 10 14:35:23 2009 (r969) +++ trunk/libsyncml/data_sync_api/data_sync.h Fri Mar 13 10:29:53 2009 (r970) @@ -147,6 +147,7 @@ /* states */ + SmlBool isInitialized; SmlBool isConnected; SmlBool gotDisconnect; SmlBool tryDisconnect; Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Tue Mar 10 14:35:23 2009 (r969) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Fri Mar 13 10:29:53 2009 (r970) @@ -565,10 +565,11 @@ SmlDataSyncObject *dsObject, SmlError **error) { + smlTrace(TRACE_ENTRY, "%s(%p,%p)", __func__, dsObject, error); CHECK_ERROR_REF smlAssert(dsObject); - /* if there is already a remote devine information + /* if there is already a remote device information * then cleanup the reference. */ if (dsObject->remoteDevInf) @@ -581,18 +582,22 @@ smlDevInfRef(dsObject->remoteDevInf); _update_session_config_from_devinf(dsObject); /* DevInf caching is optional */ - if (dsObject->writeDevInfCallback) + if (dsObject->writeDevInfCallback) { + smlTrace(TRACE_EXIT, "%s - calling writeDevInfCallback", __func__); return dsObject->writeDevInfCallback( dsObject, dsObject->remoteDevInf, dsObject->writeDevInfUserdata, error); - else + } else { + smlTrace(TRACE_EXIT, "%s - remote DevInf available", __func__); return TRUE; + } } else { smlTrace(TRACE_INTERNAL, "%s: The remote DevInf was not received.", __func__); /* DevInf caching is optional */ if (dsObject->readDevInfCallback) { + smlTrace(TRACE_INTERNAL, "%s: calling read DevInf callback", __func__); SmlDevInf *devinf = dsObject->readDevInfCallback( dsObject, smlLocationGetURI(smlSessionGetTarget(dsObject->session)), @@ -602,7 +607,13 @@ if (devinf) { smlDevInfAgentSetDevInf(dsObject->agent, devinf); dsObject->remoteDevInf = smlDevInfAgentGetDevInf(dsObject->agent); + /* smlDevInfAgentSetDevInf consumes the DevInf object. + * So the reference counter must be incremented for + * remoteDevInf. + */ + smlDevInfRef(dsObject->remoteDevInf); _update_session_config_from_devinf(dsObject); + smlTrace(TRACE_EXIT, "%s - cached DevInf", __func__); return TRUE; } } @@ -615,9 +626,11 @@ dsObject->agent, dsObject->session, error); + smlTrace(TRACE_EXIT, "%s - no remote DevInf available at all", __func__); return FALSE; } error: + smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, smlErrorPrint(error)); return FALSE; } @@ -708,6 +721,7 @@ if (dsObject->writeDevInfCallback) { /* store device info */ + smlTrace(TRACE_INTERNAL, "%s: calling write DevInf callback", __func__); if (!dsObject->writeDevInfCallback( dsObject, dsObject->localDevInf, dsObject->writeDevInfUserdata, error)) Modified: trunk/libsyncml/data_sync_api/standard.h ============================================================================== --- trunk/libsyncml/data_sync_api/standard.h Tue Mar 10 14:35:23 2009 (r969) +++ trunk/libsyncml/data_sync_api/standard.h Fri Mar 13 10:29:53 2009 (r970) @@ -91,7 +91,6 @@ const char *localID, SmlError **error); - /** * Returns the identity of the remote sync peer. This is the * <Source></Source> tag. The returned reference is not owned Modified: trunk/libsyncml/sml_transport.c ============================================================================== --- trunk/libsyncml/sml_transport.c Tue Mar 10 14:35:23 2009 (r969) +++ trunk/libsyncml/sml_transport.c Fri Mar 13 10:29:53 2009 (r970) @@ -1065,7 +1065,7 @@ if (tsp->connected && !smlTransportIsServer(tsp)) { smlErrorSet(error, SML_ERROR_GENERIC, - "If the transport is connected then it cannot be finalized."); + "If a client transport is connected then it cannot be finalized."); goto error; } |
From: <svn...@op...> - 2009-03-13 09:26:03
|
Author: bellmich Date: Fri Mar 13 10:25:49 2009 New Revision: 5290 URL: http://www.opensync.org/changeset/5290 Log: fixed the management of connect and connect_done - connect must be managed on a per datastore base because of connect_done - alert_type mutex and cond were used in a wrong way (wrong locking) - handling of disconnect after connect and before connect_done - signal changes of alert type during connect - removed g_list_add (no longer used) - renamed connect_done to syncml_connect_done FIXME: If disconnect is called after connect_done because of an abort FIXME: then disconnect is not handled correctly. FIXME: The plugin hangs in this situation. Modified: plugins/syncml/src/syncml_callbacks.c plugins/syncml/src/syncml_common.c plugins/syncml/src/syncml_common.h plugins/syncml/src/syncml_ds_client.c plugins/syncml/src/syncml_ds_server.c Modified: plugins/syncml/src/syncml_callbacks.c ============================================================================== --- plugins/syncml/src/syncml_callbacks.c Thu Mar 12 20:59:40 2009 (r5289) +++ plugins/syncml/src/syncml_callbacks.c Fri Mar 13 10:25:49 2009 (r5290) @@ -1,7 +1,7 @@ /* * syncml plugin - A syncml plugin for OpenSync * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -55,9 +55,6 @@ goto error; break; case SML_DATA_SYNC_EVENT_CONNECT: - if (env->connectCtx) - report_success_on_context(&(env->connectCtx)); - break; case SML_DATA_SYNC_EVENT_DISCONNECT: break; @@ -129,9 +126,6 @@ OSyncError *oserror = NULL; osync_error_set(&oserror, OSYNC_ERROR_GENERIC, smlErrorPrint(&locerror)); - if (env->connectCtx) - report_error_on_context(&(env->connectCtx), &oserror, FALSE); - if (env->disconnectCtx) report_error_on_context(&(env->disconnectCtx), &oserror, FALSE); @@ -142,6 +136,26 @@ if (database->syncModeCtx) report_error_on_context(&(database->syncModeCtx), &oserror, FALSE); + if (database->connectCtx && database->alert_type_mutex) { + /* there was an error during connect */ + g_mutex_free(database->alert_type_mutex); + database->alert_type_mutex = NULL; + } + + if (database->connectCtx) { + report_error_on_context(&(database->connectCtx), &oserror, FALSE); + } + + if (database->alert_type_mutex) { + /* there was an error after connect + * but before the connect_done is completed. + */ + g_mutex_lock(database->alert_type_mutex); + g_cond_wait(database->alert_type_cond, database->alert_type_mutex); + g_mutex_unlock(database->alert_type_mutex); + } + + if (database->getChangesCtx) report_error_on_context(&(database->getChangesCtx), &oserror, FALSE); @@ -164,7 +178,7 @@ void *userdata, SmlError **error) { - osync_trace(TRACE_ENTRY, "%s - %s: %d", __func__, source, recvType); + osync_trace(TRACE_ENTRY, "%s: %s => %d", __func__, source, recvType); SmlPluginEnv *env = userdata; SmlAlertType sentType; @@ -177,11 +191,44 @@ */ sentType = SML_ALERT_TWO_WAY; } else { + /* get the related datastore */ SmlDatabase *database = get_database_from_source(env, source, error); if (!database) goto error; + /* locate alert type of sink */ + if (osync_objtype_sink_get_slowsync(database->sink)) + sentType = SML_ALERT_SLOW_SYNC; + else + sentType = SML_ALERT_TWO_WAY; + + /* update alert type of sink if necessary */ + if (recvType == SML_ALERT_SLOW_SYNC && + recvType != sentType) + { + osync_trace(TRACE_INTERNAL, "%s: signal SLOW-SYNC", __func__); + osync_objtype_sink_set_slowsync(database->sink, TRUE); + } + + /* signal the connect event */ + g_mutex_lock(database->alert_type_mutex); + if (database->connectCtx) + report_success_on_context(&(database->connectCtx)); + + /* wait for the signal from the connect_done callback*/ + osync_trace(TRACE_INTERNAL, "%s: waiting for approved alert type", __func__); g_cond_wait(database->alert_type_cond, database->alert_type_mutex); + osync_trace(TRACE_INTERNAL, "%s: received approval for alert type", __func__); + g_mutex_unlock(database->alert_type_mutex); + g_mutex_free(database->alert_type_mutex); + database->alert_type_mutex = NULL; + + /* if there is a disconnect context then this is an abort */ + if (database->env->disconnectCtx) { + smlErrorSet(error, SML_ERROR_GENERIC, + "A disconnect is enforced while waiting for connect_done."); + goto error; + } /* locate alert type of sink */ if (osync_objtype_sink_get_slowsync(database->sink)) Modified: plugins/syncml/src/syncml_common.c ============================================================================== --- plugins/syncml/src/syncml_common.c Thu Mar 12 20:59:40 2009 (r5289) +++ plugins/syncml/src/syncml_common.c Fri Mar 13 10:25:49 2009 (r5290) @@ -1,6 +1,7 @@ /* * syncml plugin - A syncml plugin for OpenSync * Copyright (C) 2005 Armin Bauer <arm...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,26 +29,6 @@ #include <opensync/opensync-plugin.h> #include <libsyncml/data_sync_api/callbacks.h> -GList *g_list_add(GList *databases, void *database) -{ - osync_trace(TRACE_ENTRY, "%s", __func__); - - // if we find the item in the list - // then we only return and do nothing - - if (g_list_find(databases, database) != NULL) - { - osync_trace(TRACE_EXIT, "%s - the item is an element of the list", __func__); - return databases; - } - - // add the item to the list - - GList *result = g_list_append(databases, database); - osync_trace(TRACE_EXIT, "%s - add a new list item %p", __func__, database); - return result; -} - void syncml_free_database(SmlDatabase *database) { osync_trace(TRACE_ENTRY, "%s(%p)", __func__, database); @@ -63,11 +44,15 @@ database->objformat = NULL; } - if (database->alert_type_mutex) + if (database->alert_type_mutex) { g_mutex_free(database->alert_type_mutex); + database->alert_type_mutex = NULL; + } - if (database->alert_type_cond) + if (database->alert_type_cond) { g_cond_free(database->alert_type_cond); + database->alert_type_cond = NULL; + } if (database->sink) { osync_objtype_sink_unref(database->sink); @@ -108,6 +93,11 @@ osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s - syncModeCtx context discovered on finalize", __func__); report_error_on_context(&(database->syncModeCtx), &error, TRUE); } + if (database->connectCtx) { + OSyncError *error = NULL; + osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s - connectCtx context discovered on finalize", __func__); + report_error_on_context(&(database->connectCtx), &error, TRUE); + } if (database->getChangesCtx) { OSyncError *error = NULL; osync_error_set(&error, OSYNC_ERROR_GENERIC, "%s - getChangesCtx context discovered on finalize", __func__); @@ -193,7 +183,7 @@ return OSYNC_CHANGE_TYPE_UNKNOWN; } -void connect_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +void syncml_connect_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); @@ -221,12 +211,24 @@ SmlPluginEnv *env = (SmlPluginEnv *)data; g_assert(env); - if ((env->state1 >= SML_DATA_SYNC_EVENT_DISCONNECT && - (!env->dsObject2 || - env->state2 >= SML_DATA_SYNC_EVENT_DISCONNECT || - env->state2 < SML_DATA_SYNC_EVENT_CONNECT) - ) || - env->state1 < SML_DATA_SYNC_EVENT_CONNECT) + SmlBool waiting = FALSE; + if (env->databases && + ((SmlDatabase *)env->databases->data)->alert_type_mutex && + !((SmlDatabase *)env->databases->data)->connectCtx) { + /* the datastores are waiting for the approved alert types */ + waiting = TRUE; + } + + if (!waiting && + ( + (env->state1 >= SML_DATA_SYNC_EVENT_DISCONNECT && + (!env->dsObject2 || + env->state2 >= SML_DATA_SYNC_EVENT_DISCONNECT || + env->state2 < SML_DATA_SYNC_EVENT_CONNECT) + ) || + env->state1 < SML_DATA_SYNC_EVENT_CONNECT + ) + ) { /* The disconnect already happened or * the session never existed (connect error). */ @@ -234,6 +236,24 @@ } else { env->disconnectCtx = ctx; osync_context_ref(env->disconnectCtx); + + /* If the disconnect is part of an abort and + * there is a hanging alert type callback + * then the condition must be signaled to + * abort the connection. + */ + GList *list = env->databases; + for (; list; list = list->next) { + SmlDatabase *database = list->data; + if (database->alert_type_mutex) { + osync_trace(TRACE_INTERNAL, "%s: signal alert_type approval", __func__); + g_mutex_lock(database->alert_type_mutex); + g_cond_signal(database->alert_type_cond); + g_mutex_unlock(database->alert_type_mutex); + osync_trace(TRACE_INTERNAL, "%s: signalled alert_type approval", __func__); + } + } + } osync_trace(TRACE_EXIT, "%s", __func__); @@ -284,11 +304,6 @@ /* Signal forgotten contexts */ - if (env->connectCtx) { - OSyncError *oerror = NULL; - osync_error_set(&oerror, OSYNC_ERROR_GENERIC, "%s - detected forgotten connect context", __func__); - report_error_on_context(&(env->connectCtx), &oerror, TRUE); - } if (env->disconnectCtx) { OSyncError *oerror = NULL; osync_error_set(&oerror, OSYNC_ERROR_GENERIC, "%s - detected forgotten disconnect context", __func__); @@ -409,7 +424,8 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); - SmlPluginEnv *env = (SmlPluginEnv *)data; + SmlDatabase *database = (SmlDatabase *)data; + SmlPluginEnv *env = database->env; SmlError *error = NULL; OSyncError *oserror = NULL; @@ -418,13 +434,18 @@ * then the connect context is signalled. */ - env->connectCtx = ctx; - osync_context_ref(env->connectCtx); - - if (!smlDataSyncInit(env->dsObject1, &error)) - goto error; - if (!smlDataSyncRun(env->dsObject1, &error)) - goto error; + database->connectCtx = ctx; + osync_context_ref(database->connectCtx); + if (g_atomic_int_dec_and_test(&(env->toBeConnected))) { + /* all database received the connect callback */ + smlTrace(TRACE_INTERNAL, "%s: executing connect", __func__); + if (!smlDataSyncInit(env->dsObject1, &error)) + goto error; + if (!smlDataSyncRun(env->dsObject1, &error)) + goto error; + } else { + smlTrace(TRACE_INTERNAL, "%s: just another connect", __func__); + } osync_trace(TRACE_EXIT, "%s", __func__); return; @@ -432,7 +453,7 @@ osync_error_set(&oserror, OSYNC_ERROR_GENERIC, "%s", smlErrorPrint(&error)); smlErrorDeref(&error); osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&oserror)); - report_error_on_context(&(env->connectCtx), &oserror, TRUE); + report_error_on_context(&(database->connectCtx), &oserror, TRUE); } osync_bool discover(const char *name, void *data, OSyncPluginInfo *info, OSyncError **error) @@ -746,7 +767,6 @@ /* prepare the function list for OpenSync */ OSyncObjTypeSinkFunctions main_functions; memset(&main_functions, 0, sizeof(main_functions)); - main_functions.connect = syncml_connect; main_functions.disconnect = disconnect; /* Register main sink for connect and disconnect functions */ @@ -791,6 +811,7 @@ if (sessionType == SML_SESSION_TYPE_CLIENT && !ds_client_init_databases(env, info, oerror)) goto error_free_env; + env->toBeConnected = g_list_length(env->databases); osync_trace(TRACE_EXIT, "%s: %p", __func__, env); return (void *)env; Modified: plugins/syncml/src/syncml_common.h ============================================================================== --- plugins/syncml/src/syncml_common.h Thu Mar 12 20:59:40 2009 (r5289) +++ plugins/syncml/src/syncml_common.h Fri Mar 13 10:25:49 2009 (r5290) @@ -1,6 +1,7 @@ /* * syncml plugin - A syncml plugin for OpenSync * Copyright (C) 2005 Armin Bauer <arm...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -97,7 +98,7 @@ /* opensync state management */ - OSyncContext *connectCtx; + int toBeConnected; OSyncContext *disconnectCtx; GList *databases; unsigned int gotDatabaseCommits; /* only for OMA DS server */ @@ -131,6 +132,7 @@ OSyncPluginSyncmlDatastoreCommand command; + OSyncContext *connectCtx; OSyncContext *syncModeCtx; OSyncContext *getChangesCtx; OSyncContext *commitCtx; @@ -157,7 +159,7 @@ OSyncPluginInfo *info, OSyncError **oerror); void syncml_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); -void connect_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); +void syncml_connect_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); void sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); @@ -172,11 +174,6 @@ OSyncPluginResource *res, OSyncError **error); -/* this is a helper function which adds an object to a GList */ -/* the function guarantees that an object exists only once in */ -/* this GList. No double entrees. */ -GList *g_list_add(GList *databases, void *database); - void finalize(void *data); void safe_cfree(char **address); Modified: plugins/syncml/src/syncml_ds_client.c ============================================================================== --- plugins/syncml/src/syncml_ds_client.c Thu Mar 12 20:59:40 2009 (r5289) +++ plugins/syncml/src/syncml_ds_client.c Fri Mar 13 10:25:49 2009 (r5290) @@ -1,3 +1,23 @@ +/* + * syncml plugin - A syncml plugin for OpenSync + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include "syncml_ds_client.h" #include "syncml_callbacks.h" #include "syncml_devinf.h" @@ -25,7 +45,8 @@ OSyncObjTypeSinkFunctions functions; memset(&functions, 0, sizeof(functions)); - functions.connect_done = connect_done; + functions.connect = syncml_connect; + functions.connect_done = syncml_connect_done; functions.get_changes = ds_client_get_changeinfo; functions.sync_done = sync_done; functions.batch_commit = ds_client_batch_commit; Modified: plugins/syncml/src/syncml_ds_server.c ============================================================================== --- plugins/syncml/src/syncml_ds_server.c Thu Mar 12 20:59:40 2009 (r5289) +++ plugins/syncml/src/syncml_ds_server.c Fri Mar 13 10:25:49 2009 (r5290) @@ -1,3 +1,23 @@ +/* + * syncml plugin - A syncml plugin for OpenSync + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include "syncml_ds_server.h" #include "syncml_callbacks.h" #include "syncml_devinf.h" @@ -22,7 +42,8 @@ OSyncObjTypeSinkFunctions functions; memset(&functions, 0, sizeof(functions)); - functions.connect_done = connect_done; + functions.connect = syncml_connect; + functions.connect_done = syncml_connect_done; functions.get_changes = ds_server_get_changeinfo; functions.sync_done = sync_done; functions.batch_commit = ds_server_batch_commit; |
From: <svn...@op...> - 2009-03-12 19:59:52
|
Author: henrik Date: Thu Mar 12 20:59:40 2009 New Revision: 5289 URL: http://www.opensync.org/changeset/5289 Log: Update to latest OpenSync API changes Modified: plugins/mozilla-sync/trunk/src/mozilla-config.cpp plugins/mozilla-sync/trunk/src/mozilla-sync.cpp plugins/mozilla-sync/trunk/src/mozilla-xpcom.cpp Modified: plugins/mozilla-sync/trunk/src/mozilla-config.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/mozilla-config.cpp Wed Mar 11 17:10:44 2009 (r5288) +++ plugins/mozilla-sync/trunk/src/mozilla-config.cpp Thu Mar 12 20:59:40 2009 (r5289) @@ -55,7 +55,7 @@ @return TRUE if default profile directory found; FALSE otherwise **/ static gboolean try_find_profile_directory( - char **szFoundProfileDirectory, + const char **szFoundProfileDirectory, const char* szTrySubDir, char **pSzError, void (*pLogFunction)(int level, bool sensitive, const char* szFile, int iLine, const char *szFunc, const char* szFormat, ...)) @@ -104,7 +104,7 @@ @return TRUE if default profile directory found; FALSE otherwise **/ static gboolean find_default_profile_directory( - char **szFoundProfileDirectory, + const char **szFoundProfileDirectory, char **pSzError, void (*pLogFunction)(int level, bool sensitive, const char* szFile, int iLine, const char *szFunc, const char* szFormat, ...)) { @@ -132,15 +132,15 @@ pMozillaConfig->szProfileDirectory=NULL; - OSyncPluginAdvancedOption *pOSyncPluginAdvancedOption; - - char *szProfileDir; + const char *szProfileDir; gboolean fProfileDir=FALSE; - pOSyncPluginAdvancedOption=osync_plugin_config_get_advancedoption_value_by_name(pOSyncPluginConfig, "profile-directory"); - if (pOSyncPluginAdvancedOption) { - szProfileDir=g_strdup(osync_plugin_advancedoption_get_value(pOSyncPluginAdvancedOption)); - if (*szProfileDir) fProfileDir=TRUE; - osync_plugin_advancedoption_unref(pOSyncPluginAdvancedOption); } + + + szProfileDir=osync_plugin_config_get_advancedoption_value_by_name(pOSyncPluginConfig, "profile-directory"); + if (szProfileDir) { + if (*szProfileDir) fProfileDir=TRUE; + } + if (!fProfileDir) fProfileDir=find_default_profile_directory(&szProfileDir, pSzError, pLogFunction); if (!fProfileDir) Modified: plugins/mozilla-sync/trunk/src/mozilla-sync.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Wed Mar 11 17:10:44 2009 (r5288) +++ plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Thu Mar 12 20:59:40 2009 (r5289) @@ -463,7 +463,7 @@ void *data) { LOG_ENTRY(10, "(%p, %p, %p, %d, %p)", pOSyncObjTypeSink, pOSyncPluginInfo, pOSyncContext, fSlow, data); - OSyncMozillaDatabase *pOSyncMozillaDatabase = (OSyncMozillaDatabase*) osync_objtype_sink_get_userdata(pOSyncObjTypeSink); + OSyncMozillaDatabase *pOSyncMozillaDatabase = (OSyncMozillaDatabase*) data; int i = 0; OSyncError *pError = NULL; @@ -713,7 +713,7 @@ } - OSyncMozillaDatabase *pOSyncMozillaDatabase = (OSyncMozillaDatabase*) osync_objtype_sink_get_userdata(pOSyncObjTypeSink); + OSyncMozillaDatabase *pOSyncMozillaDatabase = (OSyncMozillaDatabase*) data; OSyncHashTable *pHT = pOSyncMozillaDatabase->pOSyncHashTable; gboolean f; @@ -772,7 +772,7 @@ { LOG_ENTRY(10, "(%p, %p, %p)", pOSyncPluginInfo, pOSyncContext, data); - OSyncMozillaDatabase *db = (OSyncMozillaDatabase*) osync_objtype_sink_get_userdata(pOSyncObjTypeSink); + OSyncMozillaDatabase *db = (OSyncMozillaDatabase*) data; OSyncError *error = NULL; @@ -812,8 +812,8 @@ OSyncError *error = NULL; - OSyncMozillaDatabase *db = (OSyncMozillaDatabase*) osync_objtype_sink_get_userdata(pOSyncObjTypeSink); - OSyncMozillaEnv *env = (OSyncMozillaEnv *)data; + OSyncMozillaDatabase *db = (OSyncMozillaDatabase*) data; + OSyncMozillaEnv *env = db->pOSyncMozillaEnv; // TODO: Check the exact meaning of each timeout, and ajust accordingly osync_objtype_sink_set_getchanges_timeout(pOSyncObjTypeSink, 4*60); // 4 minutes @@ -899,7 +899,7 @@ LOG_ENTRY(10, "(%p, %p, %p, %p)", pOSyncObjTypeSink, pOSyncPluginInfo, pOSyncContext, data); OSyncMozillaEnv *env = (OSyncMozillaEnv *)data; - OSyncMozillaDatabase *db = (OSyncMozillaDatabase*) osync_objtype_sink_get_userdata(pOSyncObjTypeSink); + OSyncMozillaDatabase *db = (OSyncMozillaDatabase*) data; if (db->pOSyncHashTable) { osync_hashtable_unref(db->pOSyncHashTable); Modified: plugins/mozilla-sync/trunk/src/mozilla-xpcom.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/mozilla-xpcom.cpp Wed Mar 11 17:10:44 2009 (r5288) +++ plugins/mozilla-sync/trunk/src/mozilla-xpcom.cpp Thu Mar 12 20:59:40 2009 (r5289) @@ -166,6 +166,7 @@ MOZ_ERROR_CHECK_FALSE(rv, "GetPath"); LOG(10, "GRE path: [%s]", NS_ConvertUTF16toUTF8(s).get()); + LOG(10, "ProfileDir: [%s]", szProfileDirectory); nsCString csProfileDir; rv = NS_CStringSetData(csProfileDir, szProfileDirectory); MOZ_ERROR_CHECK_FALSE(rv, "NS_CStringSetData for szProfileDirectory"); |
From: <svn...@op...> - 2009-03-11 16:10:57
|
Author: dgollub Date: Wed Mar 11 17:10:44 2009 New Revision: 5288 URL: http://www.opensync.org/changeset/5288 Log: libsyncml anchor callback use the "mainsink". So we have to request for the mainsink as well an anchor. Instrumented the empty Anchor with assert() to find this bug in a regression more quickly. Modified: plugins/syncml/src/syncml_callbacks.c plugins/syncml/src/syncml_common.c Modified: plugins/syncml/src/syncml_callbacks.c ============================================================================== --- plugins/syncml/src/syncml_callbacks.c Tue Mar 10 12:18:28 2009 (r5287) +++ plugins/syncml/src/syncml_callbacks.c Wed Mar 11 17:10:44 2009 (r5288) @@ -216,6 +216,7 @@ OSyncObjTypeSink *sink = osync_plugin_info_get_sink(env->pluginInfo); OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); OSyncError *oerror = NULL; + osync_assert(anchor); // TODO error handling return osync_anchor_retrieve(anchor, &oerror); } @@ -231,6 +232,7 @@ OSyncObjTypeSink *sink = osync_plugin_info_get_sink(env->pluginInfo); OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); OSyncError *oerror = NULL; + osync_assert(anchor); // TODO error handling return osync_anchor_update(anchor, value, &oerror); } Modified: plugins/syncml/src/syncml_common.c ============================================================================== --- plugins/syncml/src/syncml_common.c Tue Mar 10 12:18:28 2009 (r5287) +++ plugins/syncml/src/syncml_common.c Wed Mar 11 17:10:44 2009 (r5288) @@ -755,6 +755,7 @@ goto error_free_env; osync_objtype_sink_set_functions(mainsink, main_functions, env); + osync_objtype_sink_enable_anchor(mainsink, TRUE); osync_plugin_info_set_main_sink(info, mainsink); osync_objtype_sink_unref(mainsink); |
From: <svn...@op...> - 2009-03-10 11:56:08
|
Author: bellmich Date: Tue Mar 10 12:55:55 2009 New Revision: 968 URL: http://libsyncml.opensync.org/changeset/968 Log: fixed my copyrights in the changed files Modified: trunk/libsyncml/data_sync_api/data_sync.c trunk/libsyncml/data_sync_api/data_sync.h trunk/libsyncml/data_sync_api/data_sync_callbacks.c trunk/libsyncml/data_sync_api/data_sync_client.c trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/data_sync_api/data_sync_server.c trunk/libsyncml/data_sync_api/defines.h trunk/libsyncml/data_sync_api/standard.h trunk/libsyncml/data_sync_api/transport_http_client.c trunk/libsyncml/data_sync_api/transport_http_server.c trunk/libsyncml/data_sync_api/transport_obex_client.c trunk/libsyncml/objects/sml_devinf_obj.c trunk/libsyncml/objects/sml_ds_server.c trunk/libsyncml/parser/sml_wbxml.c trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_defines.h trunk/libsyncml/sml_elements.c trunk/libsyncml/sml_elements.h trunk/libsyncml/sml_elements_internals.h trunk/libsyncml/sml_error.c trunk/libsyncml/sml_manager.c trunk/libsyncml/sml_notification.c trunk/libsyncml/sml_queue.c trunk/libsyncml/sml_transport.c trunk/libsyncml/transports/http_client.c trunk/libsyncml/transports/http_server.c trunk/libsyncml/transports/obex_client.c trunk/libsyncml/transports/obex_server.c trunk/tools/syncml-ds-tool.c Modified: trunk/libsyncml/data_sync_api/data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/data_sync.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/data_sync.h ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.h Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/data_sync.h Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/data_sync_callbacks.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_callbacks.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/data_sync_callbacks.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/data_sync_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_client.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/data_sync_client.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/data_sync_server.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_server.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/data_sync_server.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/defines.h ============================================================================== --- trunk/libsyncml/data_sync_api/defines.h Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/defines.h Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/standard.h ============================================================================== --- trunk/libsyncml/data_sync_api/standard.h Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/standard.h Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/transport_http_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/transport_http_client.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/transport_http_client.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/transport_http_server.c ============================================================================== --- trunk/libsyncml/data_sync_api/transport_http_server.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/transport_http_server.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/data_sync_api/transport_obex_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/transport_obex_client.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/data_sync_api/transport_obex_client.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,6 @@ /* * libsyncml - A syncml protocol implementation - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/objects/sml_devinf_obj.c ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/objects/sml_devinf_obj.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/objects/sml_ds_server.c ============================================================================== --- trunk/libsyncml/objects/sml_ds_server.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/objects/sml_ds_server.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/parser/sml_wbxml.c ============================================================================== --- trunk/libsyncml/parser/sml_wbxml.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/parser/sml_wbxml.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/parser/sml_xml_assm.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/parser/sml_xml_parse.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_defines.h ============================================================================== --- trunk/libsyncml/sml_defines.h Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_defines.h Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_elements.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_elements.h ============================================================================== --- trunk/libsyncml/sml_elements.h Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_elements.h Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_elements_internals.h ============================================================================== --- trunk/libsyncml/sml_elements_internals.h Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_elements_internals.h Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_error.c ============================================================================== --- trunk/libsyncml/sml_error.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_error.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_manager.c ============================================================================== --- trunk/libsyncml/sml_manager.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_manager.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_notification.c ============================================================================== --- trunk/libsyncml/sml_notification.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_notification.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_queue.c ============================================================================== --- trunk/libsyncml/sml_queue.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_queue.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,6 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> + * Copyright (C) 2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/sml_transport.c ============================================================================== --- trunk/libsyncml/sml_transport.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/sml_transport.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/transports/http_client.c ============================================================================== --- trunk/libsyncml/transports/http_client.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/transports/http_client.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/transports/http_server.c ============================================================================== --- trunk/libsyncml/transports/http_server.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/transports/http_server.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/transports/obex_client.c ============================================================================== --- trunk/libsyncml/transports/obex_client.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/transports/obex_client.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2007-2008 Michael Bell <mic...@op...> + * Copyright (C) 2007-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/libsyncml/transports/obex_server.c ============================================================================== --- trunk/libsyncml/transports/obex_server.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/libsyncml/transports/obex_server.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,7 +1,7 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2008 Michael Bell <mic...@op...> + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Mar 6 12:13:16 2009 (r967) +++ trunk/tools/syncml-ds-tool.c Tue Mar 10 12:55:55 2009 (r968) @@ -1,8 +1,8 @@ /* * libsyncml - A syncml protocol implementation * Copyright (C) 2005 Armin Bauer <arm...@op...> - * Copyright (C) 2008 Michael Bell <mic...@op...> * Copyright (C) 2008 Felix Moeller <fe...@de...> (man page) + * Copyright (C) 2008-2009 Michael Bell <mic...@op...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public |
Author: bricks Date: Tue Mar 10 12:18:28 2009 New Revision: 5287 URL: http://www.opensync.org/changeset/5287 Log: interface cleanup for osync_..._nth_... and osync_..._num_... functions now all these functions use unsigned int instead of int see ticket #973 Modified: trunk/opensync/capabilities/opensync_capability.c trunk/opensync/capabilities/opensync_capability.h trunk/opensync/client/opensync_client_proxy.c trunk/opensync/client/opensync_client_proxy_internals.h trunk/opensync/engine/opensync_engine.c trunk/opensync/engine/opensync_mapping_engine.c trunk/opensync/engine/opensync_mapping_engine.h trunk/opensync/engine/opensync_obj_engine.c trunk/opensync/format/opensync_format_env.c trunk/opensync/format/opensync_format_env.h trunk/opensync/format/opensync_format_env_internals.h trunk/opensync/group/opensync_group.c trunk/opensync/group/opensync_group.h trunk/opensync/group/opensync_group_internals.h trunk/opensync/group/opensync_updater.c trunk/opensync/group/opensync_updater_private.h trunk/opensync/mapping/opensync_mapping.c trunk/opensync/mapping/opensync_mapping.h trunk/opensync/mapping/opensync_mapping_table.c trunk/opensync/mapping/opensync_mapping_table.h trunk/opensync/plugin/opensync_plugin_env.c trunk/opensync/plugin/opensync_plugin_env.h trunk/opensync/xmlformat/opensync_xmlfield.c trunk/opensync/xmlformat/opensync_xmlfield.h trunk/tests/support.c trunk/tests/support.h Modified: trunk/opensync/capabilities/opensync_capability.c ============================================================================== --- trunk/opensync/capabilities/opensync_capability.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/capabilities/opensync_capability.c Tue Mar 10 12:18:28 2009 (r5287) @@ -228,9 +228,9 @@ return FALSE; } -int osync_capability_get_key_count(OSyncCapability *capability) +unsigned int osync_capability_get_key_count(OSyncCapability *capability) { - int count; + unsigned int count; xmlNodePtr child = NULL; osync_assert(capability); @@ -243,9 +243,9 @@ return count; } -const char *osync_capability_get_nth_key(OSyncCapability *capability, int nth) +const char *osync_capability_get_nth_key(OSyncCapability *capability, unsigned int nth) { - int count = 0; + unsigned int count = 0; xmlNodePtr child = NULL; osync_assert(capability); Modified: trunk/opensync/capabilities/opensync_capability.h ============================================================================== --- trunk/opensync/capabilities/opensync_capability.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/capabilities/opensync_capability.h Tue Mar 10 12:18:28 2009 (r5287) @@ -90,7 +90,7 @@ * @param capability The pointer to a capability object * @return The count of keys of the capability */ -OSYNC_EXPORT int osync_capability_get_key_count(OSyncCapability *capability); +OSYNC_EXPORT unsigned int osync_capability_get_key_count(OSyncCapability *capability); /** * @brief Get the name of the nth key of a capability @@ -98,7 +98,7 @@ * @param nth The number of the key * @return The name of the nth key of the capability or NULL in case of error */ -OSYNC_EXPORT const char *osync_capability_get_nth_key(OSyncCapability *capability, int nth); +OSYNC_EXPORT const char *osync_capability_get_nth_key(OSyncCapability *capability, unsigned int nth); /** * @brief Add a key to a capability Modified: trunk/opensync/client/opensync_client_proxy.c ============================================================================== --- trunk/opensync/client/opensync_client_proxy.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/client/opensync_client_proxy.c Tue Mar 10 12:18:28 2009 (r5287) @@ -1330,13 +1330,13 @@ proxy->timeout.discover = timeout; } -int osync_client_proxy_num_objtypes(OSyncClientProxy *proxy) +unsigned int osync_client_proxy_num_objtypes(OSyncClientProxy *proxy) { osync_assert(proxy); return g_list_length(proxy->objtypes); } -OSyncObjTypeSink *osync_client_proxy_nth_objtype(OSyncClientProxy *proxy, int nth) +OSyncObjTypeSink *osync_client_proxy_nth_objtype(OSyncClientProxy *proxy, unsigned int nth) { osync_assert(proxy); return g_list_nth_data(proxy->objtypes, nth); Modified: trunk/opensync/client/opensync_client_proxy_internals.h ============================================================================== --- trunk/opensync/client/opensync_client_proxy_internals.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/client/opensync_client_proxy_internals.h Tue Mar 10 12:18:28 2009 (r5287) @@ -59,8 +59,8 @@ void osync_client_proxy_set_discover_timeout(OSyncClientProxy *proxy, unsigned int timeout); unsigned int osync_client_proxy_get_discover_timeout(OSyncClientProxy *proxy); -OSYNC_TEST_EXPORT int osync_client_proxy_num_objtypes(OSyncClientProxy *proxy); -OSYNC_TEST_EXPORT OSyncObjTypeSink *osync_client_proxy_nth_objtype(OSyncClientProxy *proxy, int nth); +OSYNC_TEST_EXPORT unsigned int osync_client_proxy_num_objtypes(OSyncClientProxy *proxy); +OSYNC_TEST_EXPORT OSyncObjTypeSink *osync_client_proxy_nth_objtype(OSyncClientProxy *proxy, unsigned int nth); OSyncObjTypeSink *osync_client_proxy_find_objtype_sink(OSyncClientProxy *proxy, const char *objtype); OSYNC_TEST_EXPORT osync_bool osync_client_proxy_connect(OSyncClientProxy *proxy, connect_cb callback, void *userdata, const char *objtype, osync_bool slowsync, OSyncError **error); Modified: trunk/opensync/engine/opensync_engine.c ============================================================================== --- trunk/opensync/engine/opensync_engine.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/engine/opensync_engine.c Tue Mar 10 12:18:28 2009 (r5287) @@ -1585,7 +1585,7 @@ osync_bool prev_sync_unclean = FALSE, first_sync = FALSE; OSyncGroup *group = NULL; OSyncList *o, *supported_objtypes; - int i; + unsigned int i; osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, engine, error); if (engine->state != OSYNC_ENGINE_STATE_UNINITIALIZED) { Modified: trunk/opensync/engine/opensync_mapping_engine.c ============================================================================== --- trunk/opensync/engine/opensync_mapping_engine.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/engine/opensync_mapping_engine.c Tue Mar 10 12:18:28 2009 (r5287) @@ -161,7 +161,7 @@ OSyncMappingEntryEngine *latest_entry = NULL; OSyncChange *latest_change = NULL; time_t latest = 0; - int i; + unsigned int i; osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, engine, error); osync_trace(TRACE_INTERNAL, "mapping number: %i", osync_mapping_engine_num_changes(engine)); @@ -530,9 +530,9 @@ -int osync_mapping_engine_num_changes(OSyncMappingEngine *engine) +unsigned int osync_mapping_engine_num_changes(OSyncMappingEngine *engine) { - int num = 0; + unsigned int num = 0; OSyncList *e = NULL; osync_assert(engine); for (e = engine->entries; e; e = e->next) { @@ -544,9 +544,9 @@ return num; } -OSyncChange *osync_mapping_engine_nth_change(OSyncMappingEngine *engine, int nth) +OSyncChange *osync_mapping_engine_nth_change(OSyncMappingEngine *engine, unsigned int nth) { - int num = 0; + unsigned int num = 0; OSyncList *e = NULL; osync_assert(engine); for (e = engine->entries; e; e = e->next) { Modified: trunk/opensync/engine/opensync_mapping_engine.h ============================================================================== --- trunk/opensync/engine/opensync_mapping_engine.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/engine/opensync_mapping_engine.h Tue Mar 10 12:18:28 2009 (r5287) @@ -22,7 +22,7 @@ #ifndef OPENSYNC_MAPPING_ENGINE_H_ #define OPENSYNC_MAPPING_ENGINE_H_ -OSYNC_EXPORT int osync_mapping_engine_num_changes(OSyncMappingEngine *engine); +OSYNC_EXPORT unsigned int osync_mapping_engine_num_changes(OSyncMappingEngine *engine); /** @brief Search for the nth entry in the mapping * @@ -30,7 +30,7 @@ * @param nth The value of the position * @returns The pointer to the nth change. NULL if there isn't enough entries in the mapping. */ -OSYNC_EXPORT OSyncChange *osync_mapping_engine_nth_change(OSyncMappingEngine *engine, int nth); +OSYNC_EXPORT OSyncChange *osync_mapping_engine_nth_change(OSyncMappingEngine *engine, unsigned int nth); /** @brief Search in the mapping for the change of the member. * Modified: trunk/opensync/engine/opensync_obj_engine.c ============================================================================== --- trunk/opensync/engine/opensync_obj_engine.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/engine/opensync_obj_engine.c Tue Mar 10 12:18:28 2009 (r5287) @@ -596,7 +596,7 @@ static osync_bool _create_mapping_engines(OSyncObjEngine *engine, OSyncError **error) { - int i = 0; + unsigned int i = 0; osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, engine, error); for (i = 0; i < osync_mapping_table_num_mappings(engine->mapping_table); i++) { Modified: trunk/opensync/format/opensync_format_env.c ============================================================================== --- trunk/opensync/format/opensync_format_env.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/format/opensync_format_env.c Tue Mar 10 12:18:28 2009 (r5287) @@ -835,13 +835,13 @@ return NULL; } -int osync_format_env_num_objformats(OSyncFormatEnv *env) +unsigned int osync_format_env_num_objformats(OSyncFormatEnv *env) { osync_assert(env); return osync_list_length(env->objformats); } -OSyncObjFormat *osync_format_env_nth_objformat(OSyncFormatEnv *env, int nth) +OSyncObjFormat *osync_format_env_nth_objformat(OSyncFormatEnv *env, unsigned int nth) { osync_assert(env); return osync_list_nth_data(env->objformats, nth); @@ -933,13 +933,13 @@ osync_custom_filter_ref(filter); } -int osync_format_env_num_filters(OSyncFormatEnv *env) +unsigned int osync_format_env_num_filters(OSyncFormatEnv *env) { osync_assert(env); return osync_list_length(env->custom_filters); } -OSyncCustomFilter *osync_format_env_nth_filter(OSyncFormatEnv *env, int nth) +OSyncCustomFilter *osync_format_env_nth_filter(OSyncFormatEnv *env, unsigned int nth) { osync_assert(env); return osync_list_nth_data(env->custom_filters, nth); Modified: trunk/opensync/format/opensync_format_env.h ============================================================================== --- trunk/opensync/format/opensync_format_env.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/format/opensync_format_env.h Tue Mar 10 12:18:28 2009 (r5287) @@ -108,7 +108,7 @@ * @returns The number of object formats * */ -OSYNC_EXPORT int osync_format_env_num_objformats(OSyncFormatEnv *env); +OSYNC_EXPORT unsigned int osync_format_env_num_objformats(OSyncFormatEnv *env); /** @brief Gets the nth object format * @@ -117,7 +117,7 @@ * @returns The object format * */ -OSYNC_EXPORT OSyncObjFormat *osync_format_env_nth_objformat(OSyncFormatEnv *env, int nth); +OSYNC_EXPORT OSyncObjFormat *osync_format_env_nth_objformat(OSyncFormatEnv *env, unsigned int nth); /** @brief Registers Format Converter or Detector to Format Environment * Modified: trunk/opensync/format/opensync_format_env_internals.h ============================================================================== --- trunk/opensync/format/opensync_format_env_internals.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/format/opensync_format_env_internals.h Tue Mar 10 12:18:28 2009 (r5287) @@ -98,7 +98,7 @@ * @returns The number of filters * */ -OSYNC_TEST_EXPORT int osync_format_env_num_filters(OSyncFormatEnv *env); +OSYNC_TEST_EXPORT unsigned int osync_format_env_num_filters(OSyncFormatEnv *env); /** @brief Gets the nth filter * @@ -107,7 +107,7 @@ * @returns The filter * */ -OSYNC_TEST_EXPORT OSyncCustomFilter *osync_format_env_nth_filter(OSyncFormatEnv *env, int nth); +OSYNC_TEST_EXPORT OSyncCustomFilter *osync_format_env_nth_filter(OSyncFormatEnv *env, unsigned int nth); /** @brief Initialize all object formats of the format environment Modified: trunk/opensync/group/opensync_group.c ============================================================================== --- trunk/opensync/group/opensync_group.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/group/opensync_group.c Tue Mar 10 12:18:28 2009 (r5287) @@ -458,7 +458,7 @@ osync_bool osync_group_save(OSyncGroup *group, OSyncError **error) { char *filename = NULL; - int i; + unsigned int i; xmlDocPtr doc; char *tmstr = NULL; char *version_str = NULL; @@ -798,13 +798,13 @@ return NULL; } -OSyncMember *osync_group_nth_member(OSyncGroup *group, int nth) +OSyncMember *osync_group_nth_member(OSyncGroup *group, unsigned int nth) { osync_assert(group); return (OSyncMember *)g_list_nth_data(group->members, nth); } -int osync_group_num_members(OSyncGroup *group) +unsigned int osync_group_num_members(OSyncGroup *group) { osync_assert(group); return g_list_length(group->members); @@ -824,10 +824,10 @@ group->configdir = osync_strdup(directory); } -int osync_group_num_objtypes(OSyncGroup *group) +unsigned int osync_group_num_objtypes(OSyncGroup *group) { GList *objs = NULL; - int len = 0; + unsigned int len = 0; osync_assert(group); objs = osync_group_get_supported_objtypes(group); len = g_list_length(objs); @@ -835,7 +835,7 @@ return len; } -const char *osync_group_nth_objtype(OSyncGroup *group, int nth) +const char *osync_group_nth_objtype(OSyncGroup *group, unsigned int nth) { GList *objs = NULL; const char *objtype = NULL; @@ -916,13 +916,13 @@ osync_filter_unref(filter); } -int osync_group_num_filters(OSyncGroup *group) +unsigned int osync_group_num_filters(OSyncGroup *group) { osync_assert(group); return g_list_length(group->filters); } -OSyncFilter *osync_group_nth_filter(OSyncGroup *group, int nth) +OSyncFilter *osync_group_nth_filter(OSyncGroup *group, unsigned int nth) { osync_assert(group); return g_list_nth_data(group->filters, nth); Modified: trunk/opensync/group/opensync_group.h ============================================================================== --- trunk/opensync/group/opensync_group.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/group/opensync_group.h Tue Mar 10 12:18:28 2009 (r5287) @@ -203,7 +203,7 @@ * @returns Pointer to the member * */ -OSYNC_EXPORT OSyncMember *osync_group_nth_member(OSyncGroup *group, int nth); +OSYNC_EXPORT OSyncMember *osync_group_nth_member(OSyncGroup *group, unsigned int nth); /** @brief Counts the members of the group * @@ -213,7 +213,7 @@ * @returns Number of members * */ -OSYNC_EXPORT int osync_group_num_members(OSyncGroup *group); +OSYNC_EXPORT unsigned int osync_group_num_members(OSyncGroup *group); /** @brief Returns the configdir for the group @@ -242,7 +242,7 @@ * @returns Number of object types of the group * */ -OSYNC_EXPORT int osync_group_num_objtypes(OSyncGroup *group); +OSYNC_EXPORT unsigned int osync_group_num_objtypes(OSyncGroup *group); /** @brief Gets the nth object type of the group * @@ -251,7 +251,7 @@ * @returns Name of the nth object type of the group * */ -OSYNC_EXPORT const char *osync_group_nth_objtype(OSyncGroup *group, int nth); +OSYNC_EXPORT const char *osync_group_nth_objtype(OSyncGroup *group, unsigned int nth); /** @brief Change the status of an object type in the group. * Modified: trunk/opensync/group/opensync_group_internals.h ============================================================================== --- trunk/opensync/group/opensync_group_internals.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/group/opensync_group_internals.h Tue Mar 10 12:18:28 2009 (r5287) @@ -95,7 +95,7 @@ * @returns The number of filters * */ -OSYNC_TEST_EXPORT int osync_group_num_filters(OSyncGroup *group); +OSYNC_TEST_EXPORT unsigned int osync_group_num_filters(OSyncGroup *group); /** @brief Gets the nth filter of a group * @@ -107,7 +107,7 @@ * @returns The filter or NULL if not found * */ -OSYNC_TEST_EXPORT OSyncFilter *osync_group_nth_filter(OSyncGroup *group, int nth); +OSYNC_TEST_EXPORT OSyncFilter *osync_group_nth_filter(OSyncGroup *group, unsigned int nth); /** @brief Gets list of all supported object types in this group, including * mixed object types Modified: trunk/opensync/group/opensync_updater.c ============================================================================== --- trunk/opensync/group/opensync_updater.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/group/opensync_updater.c Tue Mar 10 12:18:28 2009 (r5287) @@ -265,7 +265,7 @@ return FALSE; } -static osync_bool osync_updater_process_member(OSyncUpdater *updater, int nthmember, OSyncError **error) +static osync_bool osync_updater_process_member(OSyncUpdater *updater, unsigned int nthmember, OSyncError **error) { OSyncMember *member = NULL; osync_assert(updater); Modified: trunk/opensync/group/opensync_updater_private.h ============================================================================== --- trunk/opensync/group/opensync_updater_private.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/group/opensync_updater_private.h Tue Mar 10 12:18:28 2009 (r5287) @@ -123,7 +123,7 @@ * @param error Pointer to OSyncError which get stacked * @returns TRUE on success, FALSE on error. */ -static osync_bool osync_updater_process_member(OSyncUpdater *updater, int nthmember, OSyncError **error); +static osync_bool osync_updater_process_member(OSyncUpdater *updater, unsigned int nthmember, OSyncError **error); /** @brief Process update on group configuration. * Modified: trunk/opensync/mapping/opensync_mapping.c ============================================================================== --- trunk/opensync/mapping/opensync_mapping.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/mapping/opensync_mapping.c Tue Mar 10 12:18:28 2009 (r5287) @@ -120,13 +120,13 @@ return NULL; } -int osync_mapping_num_entries(OSyncMapping *mapping) +unsigned int osync_mapping_num_entries(OSyncMapping *mapping) { osync_assert(mapping); return osync_list_length(mapping->entries); } -OSyncMappingEntry *osync_mapping_nth_entry(OSyncMapping *mapping, int nth) +OSyncMappingEntry *osync_mapping_nth_entry(OSyncMapping *mapping, unsigned int nth) { osync_assert(mapping); return osync_list_nth_data(mapping->entries, nth); Modified: trunk/opensync/mapping/opensync_mapping.h ============================================================================== --- trunk/opensync/mapping/opensync_mapping.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/mapping/opensync_mapping.h Tue Mar 10 12:18:28 2009 (r5287) @@ -77,7 +77,7 @@ * @param mapping Pointer to a mapping object * @returns the number of entries in the mapping */ -OSYNC_EXPORT int osync_mapping_num_entries(OSyncMapping *mapping); +OSYNC_EXPORT unsigned int osync_mapping_num_entries(OSyncMapping *mapping); /** * @brief Get the nth entry in a mapping @@ -85,7 +85,7 @@ * @param nth the index of the entry to get * @returns the nth entry in the mapping or NULL in case of error */ -OSYNC_EXPORT OSyncMappingEntry *osync_mapping_nth_entry(OSyncMapping *mapping, int nth); +OSYNC_EXPORT OSyncMappingEntry *osync_mapping_nth_entry(OSyncMapping *mapping, unsigned int nth); /** Modified: trunk/opensync/mapping/opensync_mapping_table.c ============================================================================== --- trunk/opensync/mapping/opensync_mapping_table.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/mapping/opensync_mapping_table.c Tue Mar 10 12:18:28 2009 (r5287) @@ -204,13 +204,13 @@ osync_mapping_unref(mapping); } -int osync_mapping_table_num_mappings(OSyncMappingTable *table) +unsigned int osync_mapping_table_num_mappings(OSyncMappingTable *table) { osync_assert(table); return osync_list_length(table->mappings); } -OSyncMapping *osync_mapping_table_nth_mapping(OSyncMappingTable *table, int nth) +OSyncMapping *osync_mapping_table_nth_mapping(OSyncMappingTable *table, unsigned int nth) { osync_assert(table); return osync_list_nth_data(table->mappings, nth); Modified: trunk/opensync/mapping/opensync_mapping_table.h ============================================================================== --- trunk/opensync/mapping/opensync_mapping_table.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/mapping/opensync_mapping_table.h Tue Mar 10 12:18:28 2009 (r5287) @@ -114,7 +114,7 @@ * @param table The mapping table object * @return Number of mappings */ -OSYNC_EXPORT int osync_mapping_table_num_mappings(OSyncMappingTable *table); +OSYNC_EXPORT unsigned int osync_mapping_table_num_mappings(OSyncMappingTable *table); /** * @brief Get nth mapping object from mapping table @@ -123,7 +123,7 @@ * @param nth The position of the mapping object * @return The nth mapping object from mapping table or NULL if nth position isn't available */ -OSYNC_EXPORT OSyncMapping *osync_mapping_table_nth_mapping(OSyncMappingTable *table, int nth); +OSYNC_EXPORT OSyncMapping *osync_mapping_table_nth_mapping(OSyncMappingTable *table, unsigned int nth); /** Modified: trunk/opensync/plugin/opensync_plugin_env.c ============================================================================== --- trunk/opensync/plugin/opensync_plugin_env.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/plugin/opensync_plugin_env.c Tue Mar 10 12:18:28 2009 (r5287) @@ -209,12 +209,12 @@ return NULL; } -int osync_plugin_env_num_plugins(OSyncPluginEnv *env) +unsigned int osync_plugin_env_num_plugins(OSyncPluginEnv *env) { return osync_list_length(env->plugins); } -OSyncPlugin *osync_plugin_env_nth_plugin(OSyncPluginEnv *env, int nth) +OSyncPlugin *osync_plugin_env_nth_plugin(OSyncPluginEnv *env, unsigned int nth) { return (OSyncPlugin *)osync_list_nth_data(env->plugins, nth); } Modified: trunk/opensync/plugin/opensync_plugin_env.h ============================================================================== --- trunk/opensync/plugin/opensync_plugin_env.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/plugin/opensync_plugin_env.h Tue Mar 10 12:18:28 2009 (r5287) @@ -109,7 +109,7 @@ * @returns Number of plugins * */ -OSYNC_EXPORT int osync_plugin_env_num_plugins(OSyncPluginEnv *env); +OSYNC_EXPORT unsigned int osync_plugin_env_num_plugins(OSyncPluginEnv *env); /** @brief Returns pointer to nth plugin * @@ -120,7 +120,7 @@ * @returns Pointer to plugin * */ -OSYNC_EXPORT OSyncPlugin *osync_plugin_env_nth_plugin(OSyncPluginEnv *env, int nth); +OSYNC_EXPORT OSyncPlugin *osync_plugin_env_nth_plugin(OSyncPluginEnv *env, unsigned int nth); /*@}*/ Modified: trunk/opensync/xmlformat/opensync_xmlfield.c ============================================================================== --- trunk/opensync/xmlformat/opensync_xmlfield.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/xmlformat/opensync_xmlfield.c Tue Mar 10 12:18:28 2009 (r5287) @@ -327,9 +327,9 @@ xmlSetProp(xmlfield->node, BAD_CAST attr, BAD_CAST value); } -int osync_xmlfield_get_attr_count(OSyncXMLField *xmlfield) +unsigned int osync_xmlfield_get_attr_count(OSyncXMLField *xmlfield) { - int count; + unsigned int count; xmlAttrPtr attr = NULL; osync_assert(xmlfield); @@ -341,9 +341,9 @@ return count; } -const char *osync_xmlfield_get_nth_attr_name(OSyncXMLField *xmlfield, int nth) +const char *osync_xmlfield_get_nth_attr_name(OSyncXMLField *xmlfield, unsigned int nth) { - int count; + unsigned int count; xmlAttrPtr attr = NULL; osync_assert(xmlfield); @@ -358,9 +358,9 @@ return NULL; } -const char *osync_xmlfield_get_nth_attr_value(OSyncXMLField *xmlfield, int nth) +const char *osync_xmlfield_get_nth_attr_value(OSyncXMLField *xmlfield, unsigned int nth) { - int count; + unsigned int count; xmlAttrPtr attr = NULL; osync_assert(xmlfield); @@ -436,9 +436,9 @@ xmlfield->sorted = FALSE; } -int osync_xmlfield_get_key_count(OSyncXMLField *xmlfield) +unsigned int osync_xmlfield_get_key_count(OSyncXMLField *xmlfield) { - int count; + unsigned int count; xmlNodePtr child = NULL; osync_assert(xmlfield); @@ -451,9 +451,9 @@ return count; } -const char *osync_xmlfield_get_nth_key_name(OSyncXMLField *xmlfield, int nth) +const char *osync_xmlfield_get_nth_key_name(OSyncXMLField *xmlfield, unsigned int nth) { - int count; + unsigned int count; xmlNodePtr child = NULL; osync_assert(xmlfield); @@ -468,9 +468,9 @@ return NULL; } -const char *osync_xmlfield_get_nth_key_value(OSyncXMLField *xmlfield, int nth) +const char *osync_xmlfield_get_nth_key_value(OSyncXMLField *xmlfield, unsigned int nth) { - int count; + unsigned int count; xmlNodePtr child = NULL; osync_assert(xmlfield); @@ -487,9 +487,9 @@ return NULL; } -void osync_xmlfield_set_nth_key_value(OSyncXMLField *xmlfield, int nth, const char *value) +void osync_xmlfield_set_nth_key_value(OSyncXMLField *xmlfield, unsigned int nth, const char *value) { - int count; + unsigned int count; xmlNodePtr cur = NULL; osync_assert(xmlfield); Modified: trunk/opensync/xmlformat/opensync_xmlfield.h ============================================================================== --- trunk/opensync/xmlformat/opensync_xmlfield.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/opensync/xmlformat/opensync_xmlfield.h Tue Mar 10 12:18:28 2009 (r5287) @@ -131,7 +131,7 @@ * @param xmlfield Pointer to the xmlfield object * @return The count of attributes in the xmlfield */ -OSYNC_EXPORT int osync_xmlfield_get_attr_count(OSyncXMLField *xmlfield); +OSYNC_EXPORT unsigned int osync_xmlfield_get_attr_count(OSyncXMLField *xmlfield); /** * @brief Get the name of the nth attribute of a xmlfield @@ -139,7 +139,7 @@ * @param nth The index of the attribute * @return The name of the nth attribute of the xmlfield or NULL in case of error */ -OSYNC_EXPORT const char *osync_xmlfield_get_nth_attr_name(OSyncXMLField *xmlfield, int nth); +OSYNC_EXPORT const char *osync_xmlfield_get_nth_attr_name(OSyncXMLField *xmlfield, unsigned int nth); /** * @brief Get the value of the nth attribute of a xmlfield @@ -147,7 +147,7 @@ * @param nth The index of the attribute * @return The value of the nth attribute of the xmlfield or NULL in case of error */ -OSYNC_EXPORT const char *osync_xmlfield_get_nth_attr_value(OSyncXMLField *xmlfield, int nth); +OSYNC_EXPORT const char *osync_xmlfield_get_nth_attr_value(OSyncXMLField *xmlfield, unsigned int nth); /** * @brief Get the value of a key/value pair of a xmlfield @@ -178,7 +178,7 @@ * @param xmlfield Pointer to the xmlfield object * @return The count of keys in the xmlfield */ -OSYNC_EXPORT int osync_xmlfield_get_key_count(OSyncXMLField *xmlfield); +OSYNC_EXPORT unsigned int osync_xmlfield_get_key_count(OSyncXMLField *xmlfield); /** * @brief Get the name of the nth key of a xmlfield @@ -186,7 +186,7 @@ * @param nth The index of the key * @return The name of the nth key of the xmlfield or NULL in case of error */ -OSYNC_EXPORT const char *osync_xmlfield_get_nth_key_name(OSyncXMLField *xmlfield, int nth); +OSYNC_EXPORT const char *osync_xmlfield_get_nth_key_name(OSyncXMLField *xmlfield, unsigned int nth); /** * @brief Get the value of the nth key of a xmlfield @@ -194,7 +194,7 @@ * @param nth The index of the key * @return The value of the nth key of the xmlfield or NULL in case of error */ -OSYNC_EXPORT const char *osync_xmlfield_get_nth_key_value(OSyncXMLField *xmlfield, int nth); +OSYNC_EXPORT const char *osync_xmlfield_get_nth_key_value(OSyncXMLField *xmlfield, unsigned int nth); /** * @brief Set the value of the nth key of a xmlfield @@ -203,7 +203,7 @@ * @param value The value of the key/value pair * @return The value of the nth key of the xmlfield or NULL in case of error */ -OSYNC_EXPORT void osync_xmlfield_set_nth_key_value(OSyncXMLField *xmlfield, int nth, const char *value); +OSYNC_EXPORT void osync_xmlfield_set_nth_key_value(OSyncXMLField *xmlfield, unsigned int nth, const char *value); /** * @brief Sort all key nodes of an xmlfield. This function needs to be called Modified: trunk/tests/support.c ============================================================================== --- trunk/tests/support.c Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/tests/support.c Tue Mar 10 12:18:28 2009 (r5287) @@ -214,7 +214,7 @@ tcase_add_test(tc_new, function); } -OSyncMappingTable *mappingtable_load(const char *path, const char *objtype, int num_mappings) +OSyncMappingTable *mappingtable_load(const char *path, const char *objtype, unsigned int num_mappings) { OSyncError *error = NULL; OSyncMappingTable *table = NULL; @@ -241,16 +241,16 @@ return table; } -void check_mapping(OSyncMappingTable *maptable, int memberid, int mappingid, int numentries, const char *uid) +void check_mapping(OSyncMappingTable *maptable, int memberid, int mappingid, unsigned int numentries, const char *uid) { - int i = 0; + unsigned int i = 0; osync_trace(TRACE_ENTRY, "%s(%p, %i, %i, %i, %s)", __func__, maptable, memberid, mappingid, numentries, uid); for (i = 0; i < osync_mapping_table_num_mappings(maptable); i++) { OSyncMapping *mapping = osync_mapping_table_nth_mapping(maptable, i); OSyncMappingEntry *testentry = osync_mapping_find_entry_by_member_id(mapping, memberid); if ((mappingid != -1 && osync_mapping_get_id(mapping) == mappingid) || (mappingid == -1 && !strcmp(osync_mapping_entry_get_uid(testentry), uid))) { - int n = 0; + unsigned int n = 0; fail_unless(osync_mapping_num_entries(mapping) == numentries); for (n = 0; n < osync_mapping_num_entries(mapping); n++) { OSyncMappingEntry *entry = osync_mapping_nth_entry(mapping, n); @@ -492,7 +492,7 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, mapping, user_data); num_mapping_conflicts++; - fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_INT(user_data), NULL); + fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_UINT(user_data), NULL); fail_unless(num_engine_end_conflicts == 0, NULL); change = osync_mapping_engine_member_change(mapping, 1); @@ -505,11 +505,11 @@ void conflict_handler_choose_deleted(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data) { OSyncError *error = NULL; - int i; + unsigned int i; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, mapping, user_data); num_mapping_conflicts++; - fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_INT(user_data), NULL); + fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_UINT(user_data), NULL); fail_unless(num_engine_end_conflicts == 0, NULL); for (i = 0; i < osync_mapping_engine_num_changes(mapping); i++) { @@ -528,11 +528,11 @@ void conflict_handler_choose_modified(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data) { OSyncError *error = NULL; - int i; + unsigned int i; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, mapping, user_data); num_mapping_conflicts++; - fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_INT(user_data), NULL); + fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_UINT(user_data), NULL); fail_unless(num_engine_end_conflicts == 0, NULL); for (i = 0; i < osync_mapping_engine_num_changes(mapping); i++) { @@ -552,7 +552,7 @@ OSyncError *error = NULL; num_mapping_conflicts++; if (user_data) - fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_INT(user_data), NULL); + fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_UINT(user_data), NULL); fail_unless(num_engine_end_conflicts == 0, NULL); osync_engine_mapping_ignore_conflict(engine, mapping, &error); @@ -565,7 +565,7 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, mapping, user_data); num_mapping_conflicts++; - fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_INT(user_data), NULL); + fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_UINT(user_data), NULL); fail_unless(num_engine_end_conflicts == 0, NULL); fail_unless(osync_engine_mapping_duplicate(engine, mapping, &error), NULL); @@ -578,7 +578,7 @@ OSyncError *error = NULL; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, mapping, user_data); - fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_INT(user_data), NULL); + fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_UINT(user_data), NULL); fail_unless(num_engine_end_conflicts == 0, NULL); fail_unless(osync_engine_abort(engine, &error), NULL); @@ -605,7 +605,7 @@ osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, mapping, user_data); num_mapping_conflicts++; - fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_INT(user_data), NULL); + fail_unless(osync_mapping_engine_num_changes(mapping) == GPOINTER_TO_UINT(user_data), NULL); fail_unless(num_engine_end_conflicts == 0, NULL); gengine = engine; g_thread_create ((GThreadFunc)solve_conflict, mapping, TRUE, NULL); Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Tue Mar 10 11:21:54 2009 (r5286) +++ trunk/tests/support.h Tue Mar 10 12:18:28 2009 (r5287) @@ -92,12 +92,12 @@ void conflict_handler_random(OSyncEngine *engine, OSyncMapping *mapping, void *user_data); -OSyncMappingTable *mappingtable_load(const char *path, const char *objtype, int num_mappings); +OSyncMappingTable *mappingtable_load(const char *path, const char *objtype, unsigned int num_mappings); void mappingtable_close(OSyncMappingTable *maptable); OSyncHashTable *hashtable_load(const char *path, const char *objtype, unsigned int entries); void check_hash(OSyncHashTable *table, const char *cmpuid); -void check_mapping(OSyncMappingTable *table, int memberid, int mappingid, int numentries, const char *uid); +void check_mapping(OSyncMappingTable *table, int memberid, int mappingid, unsigned int numentries, const char *uid); void create_random_file(const char *path); |
Author: bricks Date: Tue Mar 10 11:21:54 2009 New Revision: 5286 URL: http://www.opensync.org/changeset/5286 Log: fixed unsigned/signed int errors spotted by -Wsign-compare Modified: trunk/opensync/capabilities/opensync_capabilities.c trunk/opensync/common/opensync_marshal.c trunk/opensync/common/opensync_marshal.h trunk/opensync/common/opensync_marshal_private.h trunk/opensync/common/opensync_memory.c trunk/opensync/common/opensync_memory_internals.h trunk/opensync/engine/opensync_mapping_engine.c trunk/opensync/group/opensync_member.c trunk/opensync/ipc/opensync_message.c trunk/opensync/ipc/opensync_message_internals.h trunk/opensync/ipc/opensync_queue.c trunk/opensync/ipc/opensync_serializer.c trunk/opensync/xmlformat/opensync_xmlfieldlist.c trunk/opensync/xmlformat/opensync_xmlfieldlist.h trunk/opensync/xmlformat/opensync_xmlfieldlist_internals.h trunk/tests/ipc-tests/check_ipc.c trunk/tests/plugin-tests/check_plugin_config.c trunk/tests/support.c trunk/tests/support.h trunk/tools/osyncbinary.c Modified: trunk/opensync/capabilities/opensync_capabilities.c ============================================================================== --- trunk/opensync/capabilities/opensync_capabilities.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/capabilities/opensync_capabilities.c Tue Mar 10 11:21:54 2009 (r5286) @@ -205,7 +205,7 @@ void osync_capabilities_sort(OSyncCapabilities *capabilities) { - int index; + unsigned int index; OSyncCapabilitiesObjType *objtype; OSyncCapability *cur; Modified: trunk/opensync/common/opensync_marshal.c ============================================================================== --- trunk/opensync/common/opensync_marshal.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/common/opensync_marshal.c Tue Mar 10 11:21:54 2009 (r5286) @@ -154,8 +154,7 @@ marshal->buffer_read_pos += sizeof(long long int); } -/* TODO Change char** to const char ** */ -void osync_marshal_read_const_string(OSyncMarshal *marshal, char **value) +void osync_marshal_read_const_string(OSyncMarshal *marshal, const char **value) { int length = 0; osync_marshal_read_int(marshal, &length); Modified: trunk/opensync/common/opensync_marshal.h ============================================================================== --- trunk/opensync/common/opensync_marshal.h Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/common/opensync_marshal.h Tue Mar 10 11:21:54 2009 (r5286) @@ -196,7 +196,7 @@ * @param marshal The marshal object * @param value Reference to store the string pointer */ -OSYNC_EXPORT void osync_marshal_read_const_string(OSyncMarshal *marshal, char **value); +OSYNC_EXPORT void osync_marshal_read_const_string(OSyncMarshal *marshal, const char **value); /** @brief Read serialized data from marshal buffer. This increments the read * position of the marshal buffer. Caller is responsible for freeing the duplicated Modified: trunk/opensync/common/opensync_marshal_private.h ============================================================================== --- trunk/opensync/common/opensync_marshal_private.h Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/common/opensync_marshal_private.h Tue Mar 10 11:21:54 2009 (r5286) @@ -41,7 +41,7 @@ /** The pointer to the internal **/ GByteArray *buffer; /** The current read position **/ - int buffer_read_pos; + unsigned int buffer_read_pos; }; /*@}*/ Modified: trunk/opensync/common/opensync_memory.c ============================================================================== --- trunk/opensync/common/opensync_memory.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/common/opensync_memory.c Tue Mar 10 11:21:54 2009 (r5286) @@ -54,11 +54,12 @@ * * MIT HAKMEM Count, Bit counting in constant time and memory. * + * result can't be greater than 32 on 32 Bit systems or 64 on 64 Bit systems * @param u unsigned integer value to count bits * @returns The bit counting result * */ -int osync_bitcount(unsigned int u) +unsigned char osync_bitcount(unsigned int u) { unsigned int uCount = u - ((u >> 1) & 033333333333) - ((u >> 2) & 011111111111); return ((uCount + (uCount >> 3)) & 030707070707) % 63; Modified: trunk/opensync/common/opensync_memory_internals.h ============================================================================== --- trunk/opensync/common/opensync_memory_internals.h Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/common/opensync_memory_internals.h Tue Mar 10 11:21:54 2009 (r5286) @@ -21,7 +21,7 @@ #ifndef _OPENSYNC_MEMORY_INTERNALS_H #define _OPENSYNC_MEMORY_INTERNALS_H -int osync_bitcount(unsigned int u); +unsigned char osync_bitcount(unsigned int u); #endif /* _OPENSYNC_MEMORY_INTERNALS_H */ Modified: trunk/opensync/engine/opensync_mapping_engine.c ============================================================================== --- trunk/opensync/engine/opensync_mapping_engine.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/engine/opensync_mapping_engine.c Tue Mar 10 11:21:54 2009 (r5286) @@ -425,7 +425,7 @@ osync_bool osync_mapping_engine_check_conflict(OSyncMappingEngine *engine) { - int is_same = 0; + unsigned int is_same = 0; OSyncList *e = NULL; osync_trace(TRACE_ENTRY, "%s(%p)", __func__, engine); osync_assert(engine != NULL); Modified: trunk/opensync/group/opensync_member.c ============================================================================== --- trunk/opensync/group/opensync_member.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/group/opensync_member.c Tue Mar 10 11:21:54 2009 (r5286) @@ -475,7 +475,7 @@ static osync_bool _osync_member_save_sink(xmlDoc *doc, OSyncObjTypeSink *sink, OSyncError **error) { - int i = 0; + unsigned int i = 0; xmlNode *node = NULL; /* Write main sink stuff in main node. */ Modified: trunk/opensync/ipc/opensync_message.c ============================================================================== --- trunk/opensync/ipc/opensync_message.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/ipc/opensync_message.c Tue Mar 10 11:21:54 2009 (r5286) @@ -251,7 +251,7 @@ } /* TODO Change char** to const char ** */ -void osync_message_read_const_string(OSyncMessage *message, char **value) +void osync_message_read_const_string(OSyncMessage *message, const char **value) { osync_marshal_read_const_string(message->marshal, value); } Modified: trunk/opensync/ipc/opensync_message_internals.h ============================================================================== --- trunk/opensync/ipc/opensync_message_internals.h Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/ipc/opensync_message_internals.h Tue Mar 10 11:21:54 2009 (r5286) @@ -378,7 +378,7 @@ * @param message The message * @param value Reference to store the string pointer */ -OSYNC_TEST_EXPORT void osync_message_read_const_string(OSyncMessage *message, char **value); +OSYNC_TEST_EXPORT void osync_message_read_const_string(OSyncMessage *message, const char **value); /** @brief Read serialized data from message buffer. This increments the read * position of the message buffer. Caller is responsible for freeing the duplicated Modified: trunk/opensync/ipc/opensync_queue.c ============================================================================== --- trunk/opensync/ipc/opensync_queue.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/ipc/opensync_queue.c Tue Mar 10 11:21:54 2009 (r5286) @@ -524,7 +524,7 @@ osync_message_get_buffer(message, &data, &length); if (length) { - int sent = 0; + unsigned int sent = 0; do { int written = _osync_queue_write_data(queue, data + sent, length - sent, &error); if (written < 0) @@ -718,7 +718,7 @@ * have the correct size for the read */ osync_message_get_buffer(message, &buffer, NULL); if (size) { - unsigned int read = 0; + int read = 0; do { int inc = _osync_queue_read_data(queue, buffer + read, size - read, &error); Modified: trunk/opensync/ipc/opensync_serializer.c ============================================================================== --- trunk/opensync/ipc/opensync_serializer.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/ipc/opensync_serializer.c Tue Mar 10 11:21:54 2009 (r5286) @@ -278,7 +278,7 @@ osync_bool osync_marshal_objtype_sink(OSyncMessage *message, OSyncObjTypeSink *sink, OSyncError **error) { int i = 0; - unsigned int num = 0; + int num = 0; osync_assert(message); osync_assert(sink); Modified: trunk/opensync/xmlformat/opensync_xmlfieldlist.c ============================================================================== --- trunk/opensync/xmlformat/opensync_xmlfieldlist.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/xmlformat/opensync_xmlfieldlist.c Tue Mar 10 11:21:54 2009 (r5286) @@ -52,7 +52,7 @@ g_ptr_array_add(xmlfieldlist->array, xmlfield); } -void osync_xmlfieldlist_remove(OSyncXMLFieldList *xmlfieldlist, int index) +void osync_xmlfieldlist_remove(OSyncXMLFieldList *xmlfieldlist, unsigned int index) { osync_assert(xmlfieldlist); @@ -68,14 +68,14 @@ g_free(xmlfieldlist); } -int osync_xmlfieldlist_get_length(OSyncXMLFieldList *xmlfieldlist) +unsigned int osync_xmlfieldlist_get_length(OSyncXMLFieldList *xmlfieldlist) { osync_assert(xmlfieldlist); return xmlfieldlist->array->len; } -OSyncXMLField *osync_xmlfieldlist_item(OSyncXMLFieldList *xmlfieldlist, int index) +OSyncXMLField *osync_xmlfieldlist_item(OSyncXMLFieldList *xmlfieldlist, unsigned int index) { osync_assert(xmlfieldlist); Modified: trunk/opensync/xmlformat/opensync_xmlfieldlist.h ============================================================================== --- trunk/opensync/xmlformat/opensync_xmlfieldlist.h Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/xmlformat/opensync_xmlfieldlist.h Tue Mar 10 11:21:54 2009 (r5286) @@ -42,7 +42,7 @@ * @param xmlfieldlist Pointer to the xmlfieldlist object * @return The number of xmlfield items in the xmlfieldlist */ -OSYNC_EXPORT int osync_xmlfieldlist_get_length(OSyncXMLFieldList *xmlfieldlist); +OSYNC_EXPORT unsigned int osync_xmlfieldlist_get_length(OSyncXMLFieldList *xmlfieldlist); /** * @brief Get the xmlfield at the given index of an xmlfieldlist @@ -50,7 +50,7 @@ * @param index The index of the xmlfield pointer to return * @return The item at the specified index, or NULL in case of error. */ -OSYNC_EXPORT OSyncXMLField *osync_xmlfieldlist_item(OSyncXMLFieldList *xmlfieldlist, int index); +OSYNC_EXPORT OSyncXMLField *osync_xmlfieldlist_item(OSyncXMLFieldList *xmlfieldlist, unsigned int index); /*@}*/ Modified: trunk/opensync/xmlformat/opensync_xmlfieldlist_internals.h ============================================================================== --- trunk/opensync/xmlformat/opensync_xmlfieldlist_internals.h Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/opensync/xmlformat/opensync_xmlfieldlist_internals.h Tue Mar 10 11:21:54 2009 (r5286) @@ -50,7 +50,7 @@ * @param xmlfieldlist The pointer to a xmlfieldlist object * @param index The index of the xmlfield pointer to remove */ -void osync_xmlfieldlist_remove(OSyncXMLFieldList *xmlfieldlist, int index); +void osync_xmlfieldlist_remove(OSyncXMLFieldList *xmlfieldlist, unsigned int index); /*@}*/ Modified: trunk/tests/ipc-tests/check_ipc.c ============================================================================== --- trunk/tests/ipc-tests/check_ipc.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/tests/ipc-tests/check_ipc.c Tue Mar 10 11:21:54 2009 (r5286) @@ -152,7 +152,7 @@ int int1; long long int longint1; - char *string; + const char *string; void *databuf; osync_message_read_int(message, &int1); @@ -1032,7 +1032,7 @@ int int1; long long int longint1; - char *string; + const char *string; void *databuf; osync_message_read_int(message, &int1); @@ -1218,7 +1218,7 @@ int int1; long long int longint1; - char *string; + const char *string; void *databuf; osync_message_read_int(message, &int1); @@ -1395,7 +1395,7 @@ int int1; long long int longint1; - char *string; + const char *string; void *databuf; osync_message_read_int(message, &int1); @@ -1583,7 +1583,7 @@ int int1; long long int longint1; - char *string; + const char *string; void *databuf; @@ -1775,7 +1775,7 @@ int int1; long long int longint1; - char *string; + const char *string; void *databuf; osync_message_read_int(message, &int1); Modified: trunk/tests/plugin-tests/check_plugin_config.c ============================================================================== --- trunk/tests/plugin-tests/check_plugin_config.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/tests/plugin-tests/check_plugin_config.c Tue Mar 10 11:21:54 2009 (r5286) @@ -880,7 +880,7 @@ fail_unless(!strcmp(osync_plugin_authentication_get_reference(reloaded_auth), "ref"), NULL); OSyncList *r, *p, *v; - int i, j, k; + unsigned int i, j, k; for (i = 1, r = reloaded_resources; r; r = r->next, i++) { char *value = g_strdup_printf("foobar%i", i); fail_unless(!strcmp(osync_plugin_resource_get_name(r->data), value), NULL); Modified: trunk/tests/support.c ============================================================================== --- trunk/tests/support.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/tests/support.c Tue Mar 10 11:21:54 2009 (r5286) @@ -18,7 +18,7 @@ unsigned int osync_testsuite_selected(Suite *s, int argc, char **argv, struct osync_testcase_s *tc) { - unsigned int i, j, n=0; + int i, j, n=0; /* Also argv[0]! for symlink-ed calls */ for (i=0; argc > i; i++) { for (j=0; tc[j].name; j++) { @@ -268,7 +268,7 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -OSyncHashTable *hashtable_load(const char *path, const char *objtype, int entries) +OSyncHashTable *hashtable_load(const char *path, const char *objtype, unsigned int entries) { OSyncError *error = NULL; OSyncHashTable *table = osync_hashtable_new(path, objtype, &error); Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/tests/support.h Tue Mar 10 11:21:54 2009 (r5286) @@ -95,7 +95,7 @@ OSyncMappingTable *mappingtable_load(const char *path, const char *objtype, int num_mappings); void mappingtable_close(OSyncMappingTable *maptable); -OSyncHashTable *hashtable_load(const char *path, const char *objtype, int entries); +OSyncHashTable *hashtable_load(const char *path, const char *objtype, unsigned int entries); void check_hash(OSyncHashTable *table, const char *cmpuid); void check_mapping(OSyncMappingTable *table, int memberid, int mappingid, int numentries, const char *uid); Modified: trunk/tools/osyncbinary.c ============================================================================== --- trunk/tools/osyncbinary.c Mon Mar 9 11:20:29 2009 (r5285) +++ trunk/tools/osyncbinary.c Tue Mar 10 11:21:54 2009 (r5286) @@ -18,7 +18,7 @@ osync_bool convert_hex(const char *input, unsigned int inpsize, char **output, unsigned int *outsize) { - int i = 0; + unsigned int i = 0; GString *string = g_string_new(""); unsigned int character = 0; for (i = 0; i < inpsize - 1; i = i + 2) { @@ -40,7 +40,7 @@ osync_bool convert_bin(const char *input, unsigned int inpsize, char **output, unsigned int *outsize) { - int i = 0; + unsigned int i = 0; GString *string = g_string_new(""); for (i = 0; i < inpsize; i++) { |
From: <svn...@op...> - 2009-03-09 10:20:35
|
Author: bricks Date: Mon Mar 9 11:20:29 2009 New Revision: 5285 URL: http://www.opensync.org/changeset/5285 Log: ported tomboy-sync to objtype sink functions changes Modified: plugins/tomboy-sync/src/tomboy_sync.c plugins/tomboy-sync/src/tomboy_sync.h plugins/tomboy-sync/src/tomboy_sync_dbus.c plugins/tomboy-sync/src/tomboy_sync_dbus.h plugins/tomboy-sync/src/tomboy_sync_file.c plugins/tomboy-sync/src/tomboy_sync_file.h Modified: plugins/tomboy-sync/src/tomboy_sync.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync.c Mon Mar 9 10:07:52 2009 (r5284) +++ plugins/tomboy-sync/src/tomboy_sync.c Mon Mar 9 11:20:29 2009 (r5285) @@ -22,7 +22,6 @@ #include "tomboy_sync.h" -#include <opensync/file.h> #include <opensync/opensync-version.h> #include <uuid/uuid.h> @@ -113,7 +112,7 @@ retval = g_malloc0(37); /* * The uuid_unparse function converts the supplied UUID uuid from the binary representation into a 36-byte string (plus tailing ’\0’) of the form 1b4e28ba-2fa1-11d2-883f-0016d3cca427 and stores this - * value in the character string pointed to by out. + * value in the character string pointed to by out. */ uuid_unparse(uuid, retval); @@ -156,22 +155,22 @@ if (!dir) { goto error; } - + dir->env = tomboyenv; dir->sink = osync_plugin_info_nth_objtype(info, i); osync_assert(dir->sink); const char *objtype = osync_objtype_sink_get_name(dir->sink); OSyncPluginResource *res = osync_plugin_config_find_active_resource(config, objtype); /* get homedir from config. if no dir is set read homedir from the environment */ - dir->homedir_path = osync_plugin_resource_get_path(res); - if (!dir->homedir_path) { + tomboyenv->homedir_path = osync_plugin_resource_get_path(res); + if (!tomboyenv->homedir_path) { osync_trace(TRACE_INTERNAL, "tomboy-sync home directory not set. Using default."); - dir->homedir_path = g_getenv ("HOME"); - if (!dir->homedir_path) { - dir->homedir_path = g_get_home_dir(); + tomboyenv->homedir_path = g_getenv ("HOME"); + if (!tomboyenv->homedir_path) { + tomboyenv->homedir_path = g_get_home_dir(); } } - osync_trace(TRACE_INTERNAL, "tomboy-sync home directory is \"%s\".", dir->homedir_path); + osync_trace(TRACE_INTERNAL, "tomboy-sync home directory is \"%s\".", tomboyenv->homedir_path); OSyncList *s = osync_plugin_resource_get_objformat_sinks(res); OSyncObjFormatSink *fsink = s->data; // there could be only one sink @@ -197,12 +196,12 @@ } else { #endif /* ENABLE_DBUS */ - osync_trace(TRACE_INTERNAL, "using file for sync."); - functions.get_changes = osync_tomboysync_file_get_changes; - functions.commit = osync_tomboysync_file_commit_change; - functions.read = osync_tomboysync_file_read; - functions.write = osync_tomboysync_file_write; - functions.sync_done = osync_tomboysync_file_sync_done; + osync_trace(TRACE_INTERNAL, "using file for sync."); + functions.get_changes = osync_tomboysync_file_get_changes; + functions.commit = osync_tomboysync_file_commit_change; + functions.read = osync_tomboysync_file_read; + functions.write = osync_tomboysync_file_write; + functions.sync_done = osync_tomboysync_file_sync_done; #ifdef ENABLE_DBUS } #endif /* ENABLE_DBUS */ @@ -222,16 +221,20 @@ if (!osync_hashtable_load(dir->hashtable, error)) goto error; - /* eventuell den anchor ändern ??? */ - char *anchorpath = g_strdup_printf("%s/anchor.db", osync_plugin_info_get_configdir(info)); char *path_field = g_strdup_printf("path_%s", osync_objtype_sink_get_name(dir->sink)); - if (!osync_anchor_compare(anchorpath, path_field, dir->homedir_path)) + OSyncAnchor *anchor = osync_objtype_sink_get_anchor(dir->sink); + osync_bool anchormatch; + + if ( !osync_anchor_compare(anchor, tomboyenv->homedir_path, &anchormatch, error) ) { + /* anchor couldn't be compared */ + goto error; + } + if ( !anchormatch ) { + /* request slow sync */ osync_objtype_sink_set_slowsync(dir->sink, TRUE); - g_free(anchorpath); + } g_free(path_field); - tomboyenv->dir = dir; - #ifdef ENABLE_DBUS if (usedbus) { if (!osync_tomboysync_dbus_initalize(tomboyenv,error)) { @@ -268,7 +271,6 @@ osync_free(tomboyenv->connection); osync_free(tomboyenv->proxy); #endif - osync_free(tomboyenv->dir); } /* Here we actually tell opensync which sinks are available. For this plugin, we Modified: plugins/tomboy-sync/src/tomboy_sync.h ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync.h Mon Mar 9 10:07:52 2009 (r5284) +++ plugins/tomboy-sync/src/tomboy_sync.h Mon Mar 9 11:20:29 2009 (r5285) @@ -43,22 +43,23 @@ #endif /* ENABLE_DBUS */ -typedef struct OSyncTomboyDir { - OSyncObjFormat *objformat; - const char *homedir_path; - GDir *dir; - OSyncHashTable *hashtable; - OSyncObjTypeSink *sink; -} OSyncTomboyDir; - typedef struct OSyncTomboyEnv { #ifdef ENABLE_DBUS DBusGConnection *connection; DBusGProxy *proxy; #endif /* ENABLE_DBUS */ - OSyncTomboyDir *dir; + const char *homedir_path; } OSyncTomboyEnv; +typedef struct OSyncTomboyDir { + OSyncObjFormat *objformat; +// GDir *dir; + OSyncHashTable *hashtable; + OSyncObjTypeSink *sink; + OSyncTomboyEnv *env; +} OSyncTomboyDir; + + char *osync_tomboysync_generate_hash(char *data, int size); char *osync_tomboysync_generate_uuid(); osync_bool osync_tomboysync_validate_uuid(char *uuid); Modified: plugins/tomboy-sync/src/tomboy_sync_dbus.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_dbus.c Mon Mar 9 10:07:52 2009 (r5284) +++ plugins/tomboy-sync/src/tomboy_sync_dbus.c Mon Mar 9 11:20:29 2009 (r5285) @@ -35,11 +35,10 @@ return uuid; } -void osync_tomboysync_dbus_get_changes(void *userdata, OSyncPluginInfo *info, OSyncContext *ctx) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, userdata, info, ctx); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); - OSyncTomboyEnv *tomboyenv = (OSyncTomboyEnv*)userdata; +void osync_tomboysync_dbus_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *userdata) { + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + OSyncTomboyEnv *tomboyenv = dir->env; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); OSyncError *error = NULL; OSyncData *odata = NULL; @@ -51,7 +50,7 @@ int size; /* is slowsync necessary */ - if (osync_objtype_sink_get_slowsync(dir->sink)) { + if ( slow_sync ) { osync_trace(TRACE_INTERNAL, "Slow sync requested"); /* prepare hashtable for slowsync (flush entries) */ if (!osync_hashtable_slowsync(dir->hashtable, &error)) { @@ -188,19 +187,18 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -void osync_tomboysync_dbus_commit_change(void *userdata, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change) { - osync_trace(TRACE_ENTRY, "%s", __func__); +void osync_tomboysync_dbus_commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyEnv *tomboyenv = (OSyncTomboyEnv*)userdata; - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + //OSyncTomboyEnv *tomboyenv = dir->env; OSyncData *odata = NULL; int size; char *hash = NULL; char *buffer = NULL; - if (!osync_tomboysync_dbus_write(userdata, info, ctx, change)) { + if (!osync_tomboysync_dbus_write(sink, info, ctx, change,userdata)) { /*TODO report error to context? */ osync_trace(TRACE_EXIT_ERROR, "%s", __func__); return; @@ -219,43 +217,40 @@ return; } -void osync_tomboysync_dbus_sync_done(void *userdata, OSyncPluginInfo *info, OSyncContext *ctx) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, userdata, info, ctx); +void osync_tomboysync_dbus_sync_done(OSyncObjTypeSink *sink , OSyncPluginInfo *info, OSyncContext *ctx, void* userdata) { + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); OSyncError *error = NULL; - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); - OSyncTomboyEnv *tomboyenv = (OSyncTomboyEnv*)userdata; - - char *anchorpath = g_strdup_printf("%s/anchor.db", osync_plugin_info_get_configdir(info)); - char *path_field = g_strdup_printf("path_%s", osync_objtype_sink_get_name(sink)); - osync_anchor_update(anchorpath, path_field, dir->homedir_path); - g_free(anchorpath); - g_free(path_field); + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + OSyncTomboyEnv *tomboyenv = dir->env; + + OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); + if ( !osync_anchor_update(anchor, tomboyenv->homedir_path, &error) ) { + goto error; + } if (!osync_hashtable_save(dir->hashtable, &error)) goto error; osync_context_report_success(ctx); - g_object_unref(tomboyenv->proxy); + g_object_unref(dir->env->proxy); osync_trace(TRACE_EXIT, "%s", __func__); return; error: - g_object_unref(tomboyenv->proxy); + g_object_unref(dir->env->proxy); osync_context_report_osyncerror(ctx, error); osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(&error)); osync_error_unref(&error); return; } -osync_bool osync_tomboysync_dbus_write(void *userdata, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change) { +osync_bool osync_tomboysync_dbus_write(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, userdata, info, ctx, change); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); - OSyncTomboyEnv *tomboyenv = (OSyncTomboyEnv*)userdata; + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + OSyncTomboyEnv *tomboyenv = dir->env; OSyncError *error = NULL; OSyncData *odata = NULL; GError *gerror = NULL; @@ -338,11 +333,11 @@ /* called after ignore. * read a single entry and pass it to the engine */ -osync_bool osync_tomboysync_dbus_read(void *userdata, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, userdata, info, ctx, change); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); - OSyncTomboyEnv *tomboyenv = (OSyncTomboyEnv*)userdata; +osync_bool osync_tomboysync_dbus_read(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); + + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + OSyncTomboyEnv *tomboyenv = dir->env; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); OSyncError *error = NULL; OSyncData *odata = NULL; Modified: plugins/tomboy-sync/src/tomboy_sync_dbus.h ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_dbus.h Mon Mar 9 10:07:52 2009 (r5284) +++ plugins/tomboy-sync/src/tomboy_sync_dbus.h Mon Mar 9 11:20:29 2009 (r5285) @@ -27,11 +27,11 @@ #define TOMBOY_DBUS_PATH "/org/gnome/Tomboy/RemoteControl" #define TOMBOY_DBUS_INTERFACE "org.gnome.Tomboy.RemoteControl" -void osync_tomboysync_dbus_get_changes(void *data, OSyncPluginInfo *info, OSyncContext *ctx); -void osync_tomboysync_dbus_commit_change(void *data, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change); -void osync_tomboysync_dbus_sync_done(void *data, OSyncPluginInfo *info, OSyncContext *ctx); -osync_bool osync_tomboysync_dbus_write(void *data, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change); -osync_bool osync_tomboysync_dbus_read(void *userdata, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change); +void osync_tomboysync_dbus_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *userdata); +void osync_tomboysync_dbus_commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); +void osync_tomboysync_dbus_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata); +osync_bool osync_tomboysync_dbus_write(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); +osync_bool osync_tomboysync_dbus_read(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); osync_bool osync_tomboysync_dbus_initalize(OSyncTomboyEnv *tomboyenv, OSyncError **error); Modified: plugins/tomboy-sync/src/tomboy_sync_file.c ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_file.c Mon Mar 9 10:07:52 2009 (r5284) +++ plugins/tomboy-sync/src/tomboy_sync_file.c Mon Mar 9 11:20:29 2009 (r5285) @@ -36,8 +36,9 @@ osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, directory, subdir, ctx); OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); - - path = g_build_filename(directory->homedir_path,".tomboy", NULL); + OSyncTomboyEnv *tomboyenv = directory->env; + const char *homedir = tomboyenv->homedir_path; + path = g_build_filename(homedir,".tomboy", NULL); osync_trace(TRACE_INTERNAL, "path %s", path); dir = g_dir_open(path, 0, &gerror); @@ -142,16 +143,15 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -void osync_tomboysync_file_get_changes(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +void osync_tomboysync_file_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %i, %p)", __func__, sink, info, ctx, slow_sync, userdata); + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); OSyncError *error = NULL; /* is slowsync necessary */ - if (osync_objtype_sink_get_slowsync(dir->sink)) { + if ( slow_sync ) { osync_trace(TRACE_INTERNAL, "Slow sync requested"); /* prepare hashtable for slowsync (flush entries) */ if (!osync_hashtable_slowsync(dir->hashtable, &error)) @@ -211,21 +211,22 @@ /* * */ -void osync_tomboysync_file_commit_change(void *data, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change) +void osync_tomboysync_file_commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void* userdata) { - osync_trace(TRACE_ENTRY, "%s", __func__); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); + + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + OSyncTomboyEnv *tomboyenv = dir->env; char *filename = NULL; char* tomboydir = NULL; - if (!osync_tomboysync_file_write(data, info, ctx, change)) { + if (!osync_tomboysync_file_write(sink, info, ctx, change, userdata)) { osync_trace(TRACE_EXIT_ERROR, "%s", __func__); return; } - tomboydir = g_build_filename(dir->homedir_path, ".tomboy", NULL); + tomboydir = g_build_filename(tomboyenv->homedir_path, ".tomboy", NULL); filename = g_strdup_printf("%s%s%s.%s", tomboydir, G_DIR_SEPARATOR_S, osync_change_get_uid(change), "note"); char *hash = NULL; @@ -248,20 +249,20 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -void osync_tomboysync_file_sync_done(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +void osync_tomboysync_file_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void* userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); OSyncError *error = NULL; - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + OSyncTomboyEnv *tomboyenv = dir->env; + + OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); - char *anchorpath = g_strdup_printf("%s/anchor.db", osync_plugin_info_get_configdir(info)); - char *path_field = g_strdup_printf("path_%s", osync_objtype_sink_get_name(sink)); - osync_anchor_update(anchorpath, path_field, dir->homedir_path); - g_free(anchorpath); - g_free(path_field); + if( !osync_anchor_update(anchor, tomboyenv->homedir_path, &error) ) { + goto error; + } if (!osync_hashtable_save(dir->hashtable, &error)) goto error; @@ -279,12 +280,12 @@ } /* write a single entry */ -osync_bool osync_tomboysync_file_write(void *data, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change) +osync_bool osync_tomboysync_file_write(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void* userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, data, info, ctx, change); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + OSyncTomboyEnv *tomboyenv = dir->env; OSyncError *error = NULL; OSyncData *odata = NULL; char *buffer = NULL; @@ -292,7 +293,7 @@ unsigned int size = 0; uuid = (char*)osync_change_get_uid(change); - char *tomboydir = g_build_filename(dir->homedir_path, ".tomboy", NULL); + char *tomboydir = g_build_filename(tomboyenv->homedir_path, ".tomboy", NULL); char *filename = g_strdup_printf("%s%s%s.%s", tomboydir, G_DIR_SEPARATOR_S, uuid, "note"); switch (osync_change_get_changetype(change)) { @@ -353,15 +354,15 @@ /* called after ignore. * read a single entry and pass it to the engine */ -osync_bool osync_tomboysync_file_read(void *userdata, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change) +osync_bool osync_tomboysync_file_read(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, userdata, info, ctx, change); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - OSyncTomboyDir *dir = osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); + OSyncTomboyDir *dir = (OSyncTomboyDir*)userdata; + OSyncTomboyEnv *tomboyenv = dir->env; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); OSyncError *error = NULL; - char *tomboydir = g_build_filename(dir->homedir_path, ".tomboy", NULL); + char *tomboydir = g_build_filename(tomboyenv->homedir_path, ".tomboy", NULL); char *filename = g_strdup_printf("%s%s%s.%s", tomboydir, G_DIR_SEPARATOR_S, osync_change_get_uid(change), "note"); char *data; @@ -411,8 +412,8 @@ osync_bool osync_tomboysync_file_initalize(OSyncTomboyEnv *tomboyenv, OSyncError **error) { osync_assert(tomboyenv); - osync_assert(tomboyenv->dir) - char * tomboydir = g_strdup_printf("%s/.tomboy", tomboyenv->dir->homedir_path); + osync_assert(tomboyenv->homedir_path); + char * tomboydir = g_strdup_printf("%s/.tomboy", tomboyenv->homedir_path); if (!g_file_test(tomboydir, G_FILE_TEST_IS_DIR)) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s is not a directory.", tomboydir); goto error; Modified: plugins/tomboy-sync/src/tomboy_sync_file.h ============================================================================== --- plugins/tomboy-sync/src/tomboy_sync_file.h Mon Mar 9 10:07:52 2009 (r5284) +++ plugins/tomboy-sync/src/tomboy_sync_file.h Mon Mar 9 11:20:29 2009 (r5285) @@ -23,13 +23,13 @@ #include <opensync/opensync.h> -void osync_tomboysync_file_commit_change(void *data, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change); -void osync_tomboysync_file_get_changes(void *data, OSyncPluginInfo *info, OSyncContext *ctx); +void osync_tomboysync_file_commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); +void osync_tomboysync_file_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *userdata); -osync_bool osync_tomboysync_file_read(void *userdata, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change); -osync_bool osync_tomboysync_file_write(void *data, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change); +osync_bool osync_tomboysync_file_read(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); +osync_bool osync_tomboysync_file_write(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata); -void osync_tomboysync_file_sync_done(void *data, OSyncPluginInfo *info, OSyncContext *ctx); +void osync_tomboysync_file_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata); void osync_tomboysync_file_report_dir(OSyncTomboyDir *directory, OSyncPluginInfo *info, const char *subdir, OSyncContext *ctx); |
From: <svn...@op...> - 2009-03-09 09:08:01
|
Author: ianmartin Date: Mon Mar 9 10:07:52 2009 New Revision: 5284 URL: http://www.opensync.org/changeset/5284 Log: Update the plugin functions to match the API introduced in r5277 (Ticket #1018) Plugin sink parameter list has been changed changed to pass the sink userdata instead of the plugin env. Plugin updated to reflect this change Modified: plugins/evolution2/src/evolution2_ebook.c plugins/evolution2/src/evolution2_ecal.c plugins/evolution2/src/evolution2_sync.h Modified: plugins/evolution2/src/evolution2_ebook.c ============================================================================== --- plugins/evolution2/src/evolution2_ebook.c Mon Mar 9 09:49:26 2009 (r5283) +++ plugins/evolution2/src/evolution2_ebook.c Mon Mar 9 10:07:52 2009 (r5284) @@ -132,12 +132,12 @@ } -static void evo2_ebook_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void evo2_ebook_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { OSyncError *error = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); - OSyncEvoEnv *env = (OSyncEvoEnv *)data; + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); + OSyncEvoEnv *env = (OSyncEvoEnv *)userdata; osync_bool anchor_match; if (!(env->addressbook = evo2_ebook_open_book(osync_strdup(env->addressbook_path), &error))) { @@ -173,10 +173,10 @@ osync_error_unref(&error); } -static void evo2_ebook_disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void evo2_ebook_disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); - OSyncEvoEnv *env = (OSyncEvoEnv *)data; + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, userdata, info, ctx); + OSyncEvoEnv *env = (OSyncEvoEnv *)userdata; if (env->addressbook) { g_object_unref(env->addressbook); @@ -188,10 +188,10 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -static void evo2_ebook_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void evo2_ebook_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); - OSyncEvoEnv *env = (OSyncEvoEnv *)data; + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); + OSyncEvoEnv *env = (OSyncEvoEnv *)userdata; OSyncError *error = NULL; GError *gerror=NULL; @@ -331,10 +331,10 @@ osync_error_unref(&error); } -static void evo2_ebook_modify(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *data) +static void evo2_ebook_modify(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, data); - OSyncEvoEnv *env = (OSyncEvoEnv *)data; + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); + OSyncEvoEnv *env = (OSyncEvoEnv *)userdata; const char *uid = osync_change_get_uid(change); EContact *contact = NULL; @@ -457,7 +457,7 @@ env->contact_sink = osync_objtype_sink_ref(sink); - osync_objtype_sink_set_functions(sink, functions, NULL); + osync_objtype_sink_set_functions(sink, functions, env); osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; Modified: plugins/evolution2/src/evolution2_ecal.c ============================================================================== --- plugins/evolution2/src/evolution2_ecal.c Mon Mar 9 09:49:26 2009 (r5283) +++ plugins/evolution2/src/evolution2_ecal.c Mon Mar 9 10:07:52 2009 (r5284) @@ -82,12 +82,12 @@ return NULL; } -static void evo2_ecal_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void evo2_ecal_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { OSyncError *error = NULL; - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); - OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); + OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)userdata; if (!(evo_cal->calendar = evo2_ecal_open_cal(osync_strdup(evo_cal->uri), evo_cal->source_type, &error))) { goto error; @@ -122,11 +122,11 @@ osync_error_unref(&error); } -static void evo2_ecal_disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void evo2_ecal_disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, data); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); - OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)osync_objtype_sink_get_userdata(sink); + OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)userdata; if (evo_cal->calendar) { g_object_unref(evo_cal->calendar); @@ -138,14 +138,14 @@ osync_trace(TRACE_EXIT, "%s", __func__); } -static void evo2_ecal_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void evo2_ecal_sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); - OSyncEvoEnv *env = (OSyncEvoEnv *)data; + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, userdata, info, ctx); + OSyncError *error = NULL; GError *gerror = NULL; - OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)osync_objtype_sink_get_userdata(sink); + OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)userdata; OSyncAnchor *anchor = osync_objtype_sink_get_anchor(sink); if (!anchor) { @@ -156,7 +156,7 @@ goto error; GList *changes = NULL; - if (!e_cal_get_changes(evo_cal->calendar, env->change_id, &changes, &gerror)) { + if (!e_cal_get_changes(evo_cal->calendar, evo_cal->change_id, &changes, &gerror)) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "Unable to update %s ECal time of last sync: %s", evo_cal->objtype, gerror ? gerror->message : "None"); g_clear_error(&gerror); goto error; @@ -205,10 +205,9 @@ } -static void evo2_ecal_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *indata) +static void evo2_ecal_get_changes(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, sink, info, ctx, slow_sync ? "TRUE" : "FALSE", indata); - OSyncEvoEnv *env = (OSyncEvoEnv *)indata; + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %s, %p)", __func__, sink, info, ctx, slow_sync ? "TRUE" : "FALSE", userdata); OSyncError *error = NULL; GList *changes = NULL; @@ -219,15 +218,15 @@ int datasize = 0; GError *gerror = NULL; - OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)osync_objtype_sink_get_userdata(sink); + OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)userdata; if (slow_sync == FALSE) { osync_trace(TRACE_INTERNAL, "No slow_sync for %s", evo_cal->objtype); - if (!e_cal_get_changes(evo_cal->calendar, env->change_id, &changes, &gerror)) { + if (!e_cal_get_changes(evo_cal->calendar, evo_cal->change_id, &changes, &gerror)) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "Failed to open changed %s entries: %s", evo_cal->objtype, gerror ? gerror->message : "None"); goto error; } - osync_trace(TRACE_INTERNAL, "Found %i changes for change-ID %s", g_list_length(changes), env->change_id); + osync_trace(TRACE_INTERNAL, "Found %i changes for change-ID %s", g_list_length(changes), evo_cal->change_id); for (l = changes; l; l = l->next) { ecc = (ECalChange *)l->data; @@ -279,9 +278,9 @@ osync_error_unref(&error); } -static void evo2_ecal_modify(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *data) +static void evo2_ecal_modify(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, data); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __func__, sink, info, ctx, change, userdata); const char *uid = osync_change_get_uid(change); icalcomponent *icomp = NULL; @@ -291,7 +290,7 @@ OSyncData *odata = NULL; char *plain = NULL; - OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)osync_objtype_sink_get_userdata(sink); + OSyncEvoCalendar * evo_cal = (OSyncEvoCalendar *)userdata; switch (osync_change_get_changetype(change)) { case OSYNC_CHANGE_TYPE_DELETED: @@ -428,6 +427,7 @@ return FALSE; } cal->objtype = objtype; + cal->change_id = env->change_id; OSyncPluginConfig *config = osync_plugin_info_get_config(info); OSyncPluginResource *resource = osync_plugin_config_find_active_resource(config, objtype); Modified: plugins/evolution2/src/evolution2_sync.h ============================================================================== --- plugins/evolution2/src/evolution2_sync.h Mon Mar 9 09:49:26 2009 (r5283) +++ plugins/evolution2/src/evolution2_sync.h Mon Mar 9 10:07:52 2009 (r5284) @@ -17,6 +17,7 @@ typedef struct OSyncEvoCalendar { const char *uri; const char *objtype; + const char *change_id; ECalSourceType source_type; icalcomponent_kind ical_component; ECal *calendar; |
From: <svn...@op...> - 2009-03-09 08:49:40
|
Author: bricks Date: Mon Mar 9 09:49:26 2009 New Revision: 5283 URL: http://www.opensync.org/changeset/5283 Log: ported example plugins to latest api changes (objtypesink userdata pointer) Modified: trunk/docs/examples/plugins/src/plugin.c trunk/docs/examples/plugins/src/simple_plugin.c Modified: trunk/docs/examples/plugins/src/plugin.c ============================================================================== --- trunk/docs/examples/plugins/src/plugin.c Sun Mar 8 18:00:56 2009 (r5282) +++ trunk/docs/examples/plugins/src/plugin.c Mon Mar 9 09:49:26 2009 (r5283) @@ -28,12 +28,10 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); //Each time you get passed a context (which is used to track - //calls to your plugin) you can get the data your returned in - //initialize via this call: - // plugin_environment *env = (plugin_environment *)userdata; + //calls to your plugin) - //The sink specific userdata you can get with this call: - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + //cast void* userdata to the sink specific data type + sink_environment *sinkenv = (sink_environment*)userdata; OSyncError *error = NULL; @@ -89,9 +87,8 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); - //plugin_environment *env = (plugin_environment *)userdata; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; OSyncError *error = NULL; @@ -222,7 +219,7 @@ { //plugin_environment *env = (plugin_environment *)userdata; - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; /* * Here you have to add, modify or delete a object @@ -260,7 +257,7 @@ * This function will only be called if the sync was successful */ OSyncError *error = NULL; - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; //If we use anchors we have to update it now. //Now you get/calculate the current anchor of the device @@ -284,7 +281,7 @@ static void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; //Close all stuff you need to close Modified: trunk/docs/examples/plugins/src/simple_plugin.c ============================================================================== --- trunk/docs/examples/plugins/src/simple_plugin.c Sun Mar 8 18:00:56 2009 (r5282) +++ trunk/docs/examples/plugins/src/simple_plugin.c Mon Mar 9 09:49:26 2009 (r5283) @@ -35,12 +35,10 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, sink, info, ctx, userdata); //Each time you get passed a context (which is used to track - //calls to your plugin) you can get the data your returned in - //initialize via this call: - // plugin_environment *env = (plugin_environment *)userdata; + //calls to your plugin) - //The sink specific userdata you can get with this call: - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + //cast void* userdata to the sink specific data type + sink_environment *sinkenv = (sink_environment*)userdata; OSyncError *error = NULL; @@ -88,9 +86,8 @@ { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, userdata, info, ctx); - //plugin_environment *env = (plugin_environment *)userdata; OSyncFormatEnv *formatenv = osync_plugin_info_get_format_env(info); - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*) userdata; OSyncError *error = NULL; @@ -161,9 +158,7 @@ static void commit_change(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *change, void *userdata) { - //plugin_environment *env = (plugin_environment *)userdata; - - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata;; /* * Here you have to add, modify or delete a object @@ -196,7 +191,7 @@ * This function will only be called if the sync was successful */ OSyncError *error = NULL; - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; //If we use anchors we have to update it now. //Now you get/calculate the current anchor of the device @@ -213,9 +208,9 @@ return; } -static void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) +static void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - sink_environment *sinkenv = osync_objtype_sink_get_userdata(sink); + sink_environment *sinkenv = (sink_environment*)userdata; //Close all stuff you need to close |
From: <svn...@op...> - 2009-03-08 17:01:00
|
Author: mkoller Date: Sun Mar 8 18:00:56 2009 New Revision: 5282 URL: http://www.opensync.org/changeset/5282 Log: change my email address Modified: plugins/kdepim/src/kaddrbook.cpp plugins/kdepim/src/kcal.cpp plugins/kdepim/src/kdepim_sync.cpp plugins/kdepim/src/knotes.cpp Modified: plugins/kdepim/src/kaddrbook.cpp ============================================================================== --- plugins/kdepim/src/kaddrbook.cpp Sun Mar 8 18:00:40 2009 (r5281) +++ plugins/kdepim/src/kaddrbook.cpp Sun Mar 8 18:00:56 2009 (r5282) @@ -24,7 +24,7 @@ * @author Eduardo Pereira Habkost <eha...@co...> * @author Armin Bauer <arm...@op...> * @author Andrew Baumann <an...@cs...> - * @author Martin Koller <m.k...@su...> + * @author Martin Koller <ko...@ao...> */ #include "kaddrbook.h" Modified: plugins/kdepim/src/kcal.cpp ============================================================================== --- plugins/kdepim/src/kcal.cpp Sun Mar 8 18:00:40 2009 (r5281) +++ plugins/kdepim/src/kcal.cpp Sun Mar 8 18:00:56 2009 (r5282) @@ -22,7 +22,7 @@ /** * @author Eduardo Pereira Habkost <eha...@co...> * @author Andrew Baumann <an...@cs...> - * @author Martin Koller <m.k...@su...> + * @author Martin Koller <ko...@ao...> */ #include "kcal.h" Modified: plugins/kdepim/src/kdepim_sync.cpp ============================================================================== --- plugins/kdepim/src/kdepim_sync.cpp Sun Mar 8 18:00:40 2009 (r5281) +++ plugins/kdepim/src/kdepim_sync.cpp Sun Mar 8 18:00:56 2009 (r5282) @@ -22,7 +22,7 @@ /** * @autor Eduardo Pereira Habkost <eha...@co...> * edit Matthias Jahn <jah...@fr...> - * changed to 0.40 API by Martin Koller <m.k...@su...> + * changed to 0.40 API by Martin Koller <ko...@ao...> */ #include <libkcal/resourcecalendar.h> Modified: plugins/kdepim/src/knotes.cpp ============================================================================== --- plugins/kdepim/src/knotes.cpp Sun Mar 8 18:00:40 2009 (r5281) +++ plugins/kdepim/src/knotes.cpp Sun Mar 8 18:00:56 2009 (r5282) @@ -23,7 +23,7 @@ * * @author Eduardo Pereira Habkost <eha...@co...> * @author Andrew Baumann <an...@cs...> - * @author Martin Koller <m.k...@su...> + * @author Martin Koller <ko...@ao...> * * This module implements the access to the KDE 3.2 Notes, that are * stored on KGlobal::dirs()->saveLocation( "data" , "knotes/" ) + "notes.ics" |
From: <svn...@op...> - 2009-03-08 17:00:50
|
Author: mkoller Date: Sun Mar 8 18:00:40 2009 New Revision: 5281 URL: http://www.opensync.org/changeset/5281 Log: adapt to API change Modified: plugins/kdepim/src/datasource.cpp Modified: plugins/kdepim/src/datasource.cpp ============================================================================== --- plugins/kdepim/src/datasource.cpp Sun Mar 8 14:24:30 2009 (r5280) +++ plugins/kdepim/src/datasource.cpp Sun Mar 8 18:00:40 2009 (r5281) @@ -1,6 +1,6 @@ /** * @author Andrew Baumann <an...@cs...> - * changed to 0.40 API by Martin Koller <m.k...@su...> + * changed to 0.40 API by Martin Koller <ko...@ao...> */ #include <stdlib.h> @@ -11,16 +11,11 @@ extern "C" { -/* NB: the userdata passed to the sink callbacks is not the sink's userdata, as - * you might expect, but instead the plugin's userdata, which in our case is the - * KdePluginImplementation object pointer. So we need to get the sink object from - * osync_objtype_sink_get_userdata(sink) - */ static void connect_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __PRETTY_FUNCTION__, userdata, info, ctx); - OSyncDataSource *obj = (OSyncDataSource *)osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __PRETTY_FUNCTION__, sink, userdata, info, ctx); + OSyncDataSource *obj = static_cast<OSyncDataSource *>(userdata); obj->connect(info, ctx); osync_trace(TRACE_EXIT, "%s", __PRETTY_FUNCTION__); } @@ -29,8 +24,8 @@ static void disconnect_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __PRETTY_FUNCTION__, userdata, info, ctx); - OSyncDataSource *obj = (OSyncDataSource *)osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __PRETTY_FUNCTION__, sink, userdata, info, ctx); + OSyncDataSource *obj = static_cast<OSyncDataSource *>(userdata); obj->disconnect(info, ctx); osync_trace(TRACE_EXIT, "%s", __PRETTY_FUNCTION__); } @@ -40,8 +35,8 @@ static void get_changes_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync,void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __PRETTY_FUNCTION__, userdata, info, ctx); - OSyncDataSource *obj = (OSyncDataSource *)osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __PRETTY_FUNCTION__, sink, userdata, info, ctx); + OSyncDataSource *obj = static_cast<OSyncDataSource *>(userdata); obj->get_changes(info, ctx); osync_trace(TRACE_EXIT, "%s", __PRETTY_FUNCTION__); } @@ -51,8 +46,8 @@ static void commit_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncChange *chg, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __PRETTY_FUNCTION__, userdata, info, ctx, chg); - OSyncDataSource *obj = (OSyncDataSource *)osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p)", __PRETTY_FUNCTION__, sink, userdata, info, ctx, chg); + OSyncDataSource *obj = static_cast<OSyncDataSource *>(userdata); obj->commit(info, ctx, chg); osync_trace(TRACE_EXIT, "%s", __PRETTY_FUNCTION__); } @@ -61,8 +56,8 @@ static void sync_done_wrapper(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *userdata) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __PRETTY_FUNCTION__, userdata, info, ctx); - OSyncDataSource *obj = (OSyncDataSource *)osync_objtype_sink_get_userdata(sink); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __PRETTY_FUNCTION__, sink, userdata, info, ctx); + OSyncDataSource *obj = static_cast<OSyncDataSource *>(userdata); obj->sync_done(info, ctx); osync_trace(TRACE_EXIT, "%s", __PRETTY_FUNCTION__); } |
From: <svn...@op...> - 2009-03-08 13:24:42
|
Author: mkoller Date: Sun Mar 8 14:24:30 2009 New Revision: 5280 URL: http://www.opensync.org/changeset/5280 Log: adapt to changed Plugin-Sink Function parameter list Modified: plugins/syncml/src/syncml_common.c plugins/syncml/src/syncml_common.h plugins/syncml/src/syncml_ds_client.c plugins/syncml/src/syncml_ds_client.h plugins/syncml/src/syncml_ds_server.c plugins/syncml/src/syncml_ds_server.h Modified: plugins/syncml/src/syncml_common.c ============================================================================== --- plugins/syncml/src/syncml_common.c Mon Mar 2 14:10:56 2009 (r5279) +++ plugins/syncml/src/syncml_common.c Sun Mar 8 14:24:30 2009 (r5280) @@ -193,12 +193,12 @@ return OSYNC_CHANGE_TYPE_UNKNOWN; } -void connect_done(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +void connect_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); - SmlDatabase *database = get_database_from_plugin_info(info); + SmlDatabase *database = (SmlDatabase*)data; g_mutex_lock(database->alert_type_mutex); g_cond_signal(database->alert_type_cond); @@ -210,12 +210,12 @@ return; } -void sync_done(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +void sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_context_report_success(ctx); } -void disconnect(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p)", __func__, ctx); SmlPluginEnv *env = (SmlPluginEnv *)data; @@ -331,15 +331,6 @@ return num; } -SmlDatabase *get_database_from_plugin_info(OSyncPluginInfo *info) -{ - osync_trace(TRACE_ENTRY, "%s", __func__); - OSyncObjTypeSink *sink = osync_plugin_info_get_sink(info); - SmlDatabase *database = osync_objtype_sink_get_userdata(sink); - osync_trace(TRACE_EXIT, "%s - %s", __func__, database->url); - return database; -} - void safe_cfree(char **address) { safe_free((gpointer *)address); @@ -414,7 +405,7 @@ return NULL; } -void syncml_connect(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +void syncml_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); Modified: plugins/syncml/src/syncml_common.h ============================================================================== --- plugins/syncml/src/syncml_common.h Mon Mar 2 14:10:56 2009 (r5279) +++ plugins/syncml/src/syncml_common.h Sun Mar 8 14:24:30 2009 (r5280) @@ -156,10 +156,10 @@ OSyncPlugin *plugin, OSyncPluginInfo *info, OSyncError **oerror); -void syncml_connect(void *data, OSyncPluginInfo *info, OSyncContext *ctx); -void connect_done(void *data, OSyncPluginInfo *info, OSyncContext *ctx); -void sync_done(void *data, OSyncPluginInfo *info, OSyncContext *ctx); -void disconnect(void *data, OSyncPluginInfo *info, OSyncContext *ctx); +void syncml_connect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); +void connect_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); +void sync_done(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); +void disconnect(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, void *data); osync_bool parse_config( SmlTransportType tsp, @@ -172,8 +172,6 @@ OSyncPluginResource *res, OSyncError **error); -SmlDatabase *get_database_from_plugin_info(OSyncPluginInfo *info); - /* this is a helper function which adds an object to a GList */ /* the function guarantees that an object exists only once in */ /* this GList. No double entrees. */ Modified: plugins/syncml/src/syncml_ds_client.c ============================================================================== --- plugins/syncml/src/syncml_ds_client.c Mon Mar 2 14:10:56 2009 (r5279) +++ plugins/syncml/src/syncml_ds_client.c Sun Mar 8 14:24:30 2009 (r5280) @@ -85,11 +85,11 @@ return FALSE; } -void ds_client_get_changeinfo(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +void ds_client_get_changeinfo(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); - SmlDatabase *database = get_database_from_plugin_info(info); + SmlDatabase *database = (SmlDatabase*)data; SmlPluginEnv *env = database->env; if (env->state1 >= SML_DATA_SYNC_EVENT_GOT_ALL_CHANGES) { @@ -106,14 +106,14 @@ return; } -void ds_client_batch_commit(void *data, OSyncPluginInfo *info, OSyncContext *ctx, OSyncContext **contexts, OSyncChange **changes) +void ds_client_batch_commit(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncContext **contexts, OSyncChange **changes, void *data) { osync_trace(TRACE_ENTRY, "%s", __func__); g_assert(ctx); SmlError *error = NULL; OSyncError *oserror = NULL; - SmlDatabase *database = get_database_from_plugin_info(info); + SmlDatabase *database = (SmlDatabase*)data; database->commitCtx = ctx; osync_context_ref(database->commitCtx); Modified: plugins/syncml/src/syncml_ds_client.h ============================================================================== --- plugins/syncml/src/syncml_ds_client.h Mon Mar 2 14:10:56 2009 (r5279) +++ plugins/syncml/src/syncml_ds_client.h Sun Mar 8 14:24:30 2009 (r5280) @@ -4,16 +4,19 @@ #include "syncml_common.h" void ds_client_get_changeinfo( - void *data, + OSyncObjTypeSink *sink, OSyncPluginInfo *info, - OSyncContext *ctx); + OSyncContext *ctx, + osync_bool slow_sync, + void *data); void ds_client_batch_commit( - void *data, + OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncContext **contexts, - OSyncChange **changes); + OSyncChange **changes, + void *data); SmlBool ds_client_init_databases( SmlPluginEnv *env, Modified: plugins/syncml/src/syncml_ds_server.c ============================================================================== --- plugins/syncml/src/syncml_ds_server.c Mon Mar 2 14:10:56 2009 (r5279) +++ plugins/syncml/src/syncml_ds_server.c Sun Mar 8 14:24:30 2009 (r5280) @@ -76,11 +76,11 @@ return FALSE; } -void ds_server_get_changeinfo(void *data, OSyncPluginInfo *info, OSyncContext *ctx) +void ds_server_get_changeinfo(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, osync_bool slow_sync, void *data) { osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, data, info, ctx); - SmlDatabase *database = get_database_from_plugin_info(info); + SmlDatabase *database = (SmlDatabase*)data; SmlPluginEnv *env = database->env; database->getChangesCtx = ctx; @@ -92,14 +92,14 @@ return; } -void ds_server_batch_commit(void *data, OSyncPluginInfo *info, OSyncContext *ctx, OSyncContext **contexts, OSyncChange **changes) +void ds_server_batch_commit(OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncContext **contexts, OSyncChange **changes, void *data) { osync_trace(TRACE_ENTRY, "%s", __func__); g_assert(ctx); SmlError *error = NULL; OSyncError *oserror = NULL; - SmlDatabase *database = get_database_from_plugin_info(info); + SmlDatabase *database = (SmlDatabase*)data; database->env->gotDatabaseCommits++; database->pendingCommits = get_num_changes(changes); Modified: plugins/syncml/src/syncml_ds_server.h ============================================================================== --- plugins/syncml/src/syncml_ds_server.h Mon Mar 2 14:10:56 2009 (r5279) +++ plugins/syncml/src/syncml_ds_server.h Sun Mar 8 14:24:30 2009 (r5280) @@ -4,16 +4,19 @@ #include "syncml_common.h" void ds_server_get_changeinfo( - void *data, + OSyncObjTypeSink *sink, OSyncPluginInfo *info, - OSyncContext *ctx); + OSyncContext *ctx, + osync_bool slow_sync, + void *data); void ds_server_batch_commit( - void *data, + OSyncObjTypeSink *sink, OSyncPluginInfo *info, OSyncContext *ctx, OSyncContext **contexts, - OSyncChange **changes); + OSyncChange **changes, + void *data); SmlBool ds_server_init_databases( SmlPluginEnv *env, |
From: <svn...@op...> - 2009-03-06 11:13:22
|
Author: bellmich Date: Fri Mar 6 12:13:16 2009 New Revision: 967 URL: http://libsyncml.opensync.org/changeset/967 Log: reduce the lock Modified: trunk/tests/support.h Modified: trunk/tests/support.h ============================================================================== --- trunk/tests/support.h Thu Mar 5 16:56:31 2009 (r966) +++ trunk/tests/support.h Fri Mar 6 12:13:16 2009 (r967) @@ -49,8 +49,8 @@ int _result = expr;\ g_static_mutex_lock(&__libsyncml_check_mutex);\ fail_unless(_result, ## __VA_ARGS__);\ - if (!_result) smlAssertMsg(0, g_strdup_printf(__VA_ARGS__));\ g_static_mutex_unlock(&__libsyncml_check_mutex);\ + if (!_result) smlAssertMsg(0, g_strdup_printf(__VA_ARGS__));\ } |
From: <svn...@op...> - 2009-03-05 15:56:43
|
Author: bellmich Date: Thu Mar 5 16:56:31 2009 New Revision: 966 URL: http://libsyncml.opensync.org/changeset/966 Log: committed ChangeLog for libsyncml 0.5.2 Modified: trunk/ChangeLog Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Tue Mar 3 18:07:33 2009 (r965) +++ trunk/ChangeLog Thu Mar 5 16:56:31 2009 (r966) @@ -0,0 +1,71 @@ +2009-03-09 Michael Bell <mic...@we...> + * Released 0.5.2 + * Used SourceForge.net FRS for the first time + * Discovered that xmlInitParser and especially xmlCleanupParser must + be handled and called by the library user. + * Added support for automatic Bluetooth channel detection + * Added support for generic content-types + * Added automatic base64 conversion for binary data types + which are prefixed with application, audio, image, message and video + (ticket #185) + * Added IRDA support to OBEX client transport (ticket #212). + The patch was supplied by Peter Collingbourne. + * Added a test for the high level DS API + * Added automatic UTF-16 to UTF-8 conversion for wrongly embedded SMS + which is used bei Nokia S60 platform (ticket #217) + * Added OMA DS 1.2 SAN support for content-types without an OMNA WSP + number (ticket #217) + * Added support for OMA DS 1.2 SAN without any data store. Mobiles + which receive such a SAN should answer with alerts for all + configured data stores. The problem is the term ''SHOULD''. + Nokia S60 mobiles do not work this way for example. + * Fixed string representation in OMA DS 1.2 SAN implementation + (trailing NULL bytes must not be copied). + Nokia S60 platform mobiles work now with OMA DS 1.2 over OBEX. + * Fixed build environment to build correctly if OpenOBEX or libsoup + are missing (ticket #211) + * If a SAN is received then the remote location must be taken from + the SAN alert. + * DS API should only set configuration options if they are present. + * Added support for receiving SANs to DS API + * The target of an alert can now be different from the source in + the DS API (e.g. source = Contacts, target = Addressbook). + * syncml-ds-tool supports device faking. + * Fixed wrong return value for vendor detection via AT commands + (ticket #213). The patch was supplied by Frederic Brin. + * Added Samsung SGH-F480 to the list of the supported models + (ticket #214). The patch was supplied by Frederic Brin. + * Added an assertion to smlDataSyncInit which checks for a non-NULL + dsObject (ticket #215) + * Fixed code to handle specific Samsung AT commands + (ticket #216 - still open). A patch was supplied by Frederic Brin. + * Added support for SourceParent and SourceTarget in XML parser and + assembler (ticket #217 and #218) + * Added support for SupportHierarchicalSync of OMA DS 1.2 DevInf + (ticket #217 and #218) + * Added some new content-types which were registered by OMA DS WG + * Added support for authenticated OMA DS 1.2 SANs + * If an enum type will be changed in the future then the order is + critical. Hard coded values of the elements makes enums robust + against re-ordering. + * The HTTP client transport of the DS API does no longer instantiate a + link object because the HTTP client transport does not support this. + * If an error is dereferenced by smlErrorDeref then the caller can no + longer access the object. (This makes sense because otherwise the + caller should not dereference the object.) + * smlTransportSetConfigOption traces no longer PASSWORD options. + * If a link of a server is requested to be disconnected but it is + already disconnected then this is sometimes no error when a very + fast client disconnects before the server. + * If the server closes the connection before the client can do this + then the disconnect command of the client fails + but the client is disconnected. + * Fixed wrong interpretation of return value from smlTransportFinalize + in data_sync.c + * Fixed wrong handling of REPLACE command during SLOW SYNC + * Fixed wrong context free of OBEX server transport finalize. + * Fixed error handling and reference counting of smlCredNewAuth + * Fixed again several memory leaks and removed all suppressions for + libxml from valgrind.supp. + * Added some code to handle the not thread safe check library + |
From: <svn...@op...> - 2009-03-05 15:48:50
|
Author: bellmich Date: Thu Mar 5 16:48:37 2009 New Revision: 195 URL: http://libwbxml.opensync.org/changeset/195 Log: - added correct timezone handling for opaque datetime encoding - added support for inline datetime encoding (the ISO style 2001-09-12T13:09:12+02:00 is better because time zones like UTC+09:30 of Darwin in Australia are supported too) Modified: wbxml2/trunk/src/wbxml_encoder.c Modified: wbxml2/trunk/src/wbxml_encoder.c ============================================================================== --- wbxml2/trunk/src/wbxml_encoder.c Thu Mar 5 15:20:53 2009 (r194) +++ wbxml2/trunk/src/wbxml_encoder.c Thu Mar 5 16:48:37 2009 (r195) @@ -2977,9 +2977,7 @@ return wbxml_encode_wv_integer(encoder, buffer); break; case WBXML_WV_DATA_TYPE_DATE_AND_TIME: - /* Date and time can be encoded as OPAQUE data or as a string as specified in [ISO8601]. For now we - * keep the string... but if someone wants to code the Date and time encoding function :-) - */ + /* Date and time can be encoded as OPAQUE data or as a string as specified in [ISO8601]. */ return wbxml_encode_wv_datetime(encoder, buffer); break; case WBXML_WV_DATA_TYPE_BINARY: @@ -3062,9 +3060,46 @@ /** - * @brief Encode WV Date and Time content value + * @brief Encode inline WV Date and Time content value + * @param encoder The WBXML Encoder + * @param buffer The ISO 8601 Date and Time value to encode + * @return WBXML_OK if encoded, another error code otherwise + * @note [WV] - 6.6 Date and Time + * @note + * Encoded Format: + * - ISO 8601 string (see expected format) + * + * Expected Format (ISO 8601): + * 20011019T0950Z + * 20011019T095031Z + * 2001-10-19T09:50:31Z (with number seperators) + * 2001-10-19T09:50:31+01:00 (with explicit positive time zone) + * 2001-10-19T09:50:31+05:00 (with explicit negative time zone) + */ +static WBXMLError wbxml_encode_wv_datetime_inline(WBXMLEncoder *encoder, WB_UTINY *buffer) +{ + WBXMLError result = WBXML_OK; + WBXMLBuffer *tmp = NULL; + + /* Create temp Buffer */ + if ((tmp = wbxml_buffer_create_from_cstr(buffer)) == NULL) { + return WBXML_ERROR_NOT_ENOUGH_MEMORY; + } + + /* Add buffer to encoder */ + result = wbxml_encode_inline_string(encoder, tmp); + + /* Cleanup buffer */ + wbxml_buffer_destroy(tmp); + + return result; +} + + +/** + * @brief Encode opaque WV Date and Time content value * @param encoder The WBXML Encoder - * @param buffer The Date and Time value to encode + * @param buffer The ISO 8601 Date and Time value to encode * @return WBXML_OK if encoded, another error code otherwise * @note [WV] - 6.6 Date and Time * @note @@ -3082,10 +3117,14 @@ * Binary: 00 011111010001 1010 10011 01001 110010 011111 01011010 * Octets: (-------)(-------)(--------)(-------)(-------) (------) * - * Decoded Format: - * eg: 20011019T095031Z or 20011019T095031 + * Expected Format (ISO 8601): + * 20011019T0950 (missing seconds and time zone) + * 20011019T0950Z (missing seconds) + * 20011019T095031 (missing time zone) + * 20011019T095031Z + * 20011019T095031A (UTC+1) */ -static WBXMLError wbxml_encode_wv_datetime(WBXMLEncoder *encoder, WB_UTINY *buffer) +static WBXMLError wbxml_encode_wv_datetime_opaque(WBXMLEncoder *encoder, WB_UTINY *buffer) { WBXMLError error; WBXMLBuffer *tmp = NULL; @@ -3130,26 +3169,26 @@ goto error; } - /* Check position of 'Z' */ + /* Check position of time zone */ if (len == 16) { if (!wbxml_buffer_get_char(tmp, 15, &ch)) { error = WBXML_ERROR_INTERNAL; goto error; } - if (ch != 'Z') { - WBXML_ERROR((WBXML_CONV, "If the length of a WV datetime is 16 then the last character must be 'Z'.")); + if (ch < 'A' || ch == 'J' || ch > 'Z') { + WBXML_ERROR((WBXML_CONV, "If the length of a WV datetime is 16 then the last character must be the time zone.")); error = WBXML_ERROR_WV_DATETIME_FORMAT; goto error; } - /* This is an UTC format */ - is_utc = TRUE; - } + /* There is a time zone. */ + octets[5] = ch; - /* Delete 'T' and 'Z' */ - if (is_utc) + /* delete time zone */ wbxml_buffer_delete(tmp, 15, 1); + } + /* delete 'T' */ wbxml_buffer_delete(tmp, 8, 1); /* Check if you have only digits characters */ @@ -3249,9 +3288,6 @@ octets[4] <<=6; octets[4] += (WB_UTINY) (second & 0x3f); /* 6 bits */ - /* Set Time Zone */ - octets[5] = 0; - WBXML_DEBUG((WBXML_CONV, "WV datetime: %x %x %x %x %x %x", octets[5], octets[4], octets[3], octets[2], octets[1], octets[0])); /* Encode it to Opaque */ @@ -3264,6 +3300,48 @@ return error; } + +/** + * @brief Encode WV Date and Time content value + * @param encoder The WBXML Encoder + * @param buffer The ISO 8601 Date and Time value to encode + * @return WBXML_OK if encoded, another error code otherwise + * @note [WV] - 6.6 Date and Time + * @note This function only decides which kind of datetime + * encoding should be used and calls the appropriate + * function. Please see wbxml_encode_wv_datetime_opaque + * and wbxml_encode_wv_datetime_inline for more details. + * @note Both encoding mechanisms were implemented to be able + * to test the parsing of both encoding scheme. This is + * necessary because other implementations can decide by + * their own which encoding scheme they use. + */ +static WBXMLError wbxml_encode_wv_datetime(WBXMLEncoder *encoder, WB_UTINY *buffer) +{ + WB_BOOL use_inline = FALSE; + WB_ULONG len = WBXML_STRLEN(buffer); + + /* long version of ISO 8601 should be inline encoded */ + if (index(buffer, '-')) + use_inline = TRUE; + if (index(buffer, '+')) + use_inline = TRUE; + if (index(buffer, ':')) + use_inline = TRUE; + + /* timezone Z should be inline encoded */ + if (buffer[len - 1] == 'Z') + use_inline = TRUE; + + if (use_inline) { + WBXML_DEBUG((WBXML_CONV, "WV datetime conversion: INLINE")); + return wbxml_encode_wv_datetime_inline(encoder, buffer); + } else { + WBXML_DEBUG((WBXML_CONV, "WV datetime conversion: OPAQUE")); + return wbxml_encode_wv_datetime_opaque(encoder, buffer); + } +} + #endif /* WBXML_SUPPORT_WV */ |
From: <svn...@op...> - 2009-03-05 14:20:59
|
Author: bellmich Date: Thu Mar 5 15:20:53 2009 New Revision: 194 URL: http://libwbxml.opensync.org/changeset/194 Log: corrected the byte order of the WV datetime encoding Modified: wbxml2/trunk/src/wbxml_encoder.c wbxml2/trunk/src/wbxml_parser.c Modified: wbxml2/trunk/src/wbxml_encoder.c ============================================================================== --- wbxml2/trunk/src/wbxml_encoder.c Thu Mar 5 15:16:21 2009 (r193) +++ wbxml2/trunk/src/wbxml_encoder.c Thu Mar 5 15:20:53 2009 (r194) @@ -3179,8 +3179,8 @@ wbxml_buffer_delete(component, 4, 10); unsigned int year = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); - octets[5] = (WB_UTINY) ((year & 0xfc0) >> 6); /* 6 bits */ - octets[4] = (WB_UTINY) (year & 0x3f); /* 6 bits */ + octets[0] = (WB_UTINY) ((year & 0xfc0) >> 6); /* 6 bits */ + octets[1] = (WB_UTINY) (year & 0x3f); /* 6 bits */ /* Set Month */ component = wbxml_buffer_duplicate(tmp); @@ -3192,9 +3192,9 @@ wbxml_buffer_delete(component, 2, 8); unsigned int month = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); - octets[4] <<= 2; - octets[4] += (WB_UTINY) ((month & 0xc) >> 2); /* 2 bits */ - octets[3] = (WB_UTINY) (month & 0x3); /* 2 bits */ + octets[1] <<= 2; + octets[1] += (WB_UTINY) ((month & 0xc) >> 2); /* 2 bits */ + octets[2] = (WB_UTINY) (month & 0x3); /* 2 bits */ /* Set Day */ component = wbxml_buffer_duplicate(tmp); @@ -3206,8 +3206,8 @@ wbxml_buffer_delete(component, 2, 6); unsigned int day = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); - octets[3] <<= 5; - octets[3] += (WB_UTINY) (day & 0x1f); /* 5 bits */ + octets[2] <<= 5; + octets[2] += (WB_UTINY) (day & 0x1f); /* 5 bits */ /* Set Hour */ component = wbxml_buffer_duplicate(tmp); @@ -3219,9 +3219,9 @@ wbxml_buffer_delete(component, 2, 4); unsigned int hour = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); - octets[3] <<=1; - octets[3] += (WB_UTINY) ((hour & 0x10) >> 4); /* 1 bit */ - octets[2] = (WB_UTINY) (hour & 0xf); /* 4 bits */ + octets[2] <<=1; + octets[2] += (WB_UTINY) ((hour & 0x10) >> 4); /* 1 bit */ + octets[3] = (WB_UTINY) (hour & 0xf); /* 4 bits */ /* Set Minute */ component = wbxml_buffer_duplicate(tmp); @@ -3233,9 +3233,9 @@ wbxml_buffer_delete(component, 2, 2); unsigned int minute = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); - octets[2] <<=4; - octets[2] += (WB_UTINY) ((minute & 0x3c) >> 2); /* 4 bits */ - octets[1] = (WB_UTINY) (minute & 0x3); /* 2 bits */ + octets[3] <<=4; + octets[3] += (WB_UTINY) ((minute & 0x3c) >> 2); /* 4 bits */ + octets[4] = (WB_UTINY) (minute & 0x3); /* 2 bits */ /* Set Second */ component = wbxml_buffer_duplicate(tmp); @@ -3246,11 +3246,11 @@ wbxml_buffer_delete(component, 0, 12); unsigned int second = strtoull((const char *)wbxml_buffer_get_cstr(component), NULL, 10); wbxml_buffer_destroy(component); - octets[1] <<=6; - octets[1] += (WB_UTINY) (second & 0x3f); /* 6 bits */ + octets[4] <<=6; + octets[4] += (WB_UTINY) (second & 0x3f); /* 6 bits */ /* Set Time Zone */ - octets[0] = 0; + octets[5] = 0; WBXML_DEBUG((WBXML_CONV, "WV datetime: %x %x %x %x %x %x", octets[5], octets[4], octets[3], octets[2], octets[1], octets[0])); Modified: wbxml2/trunk/src/wbxml_parser.c ============================================================================== --- wbxml2/trunk/src/wbxml_parser.c Thu Mar 5 15:16:21 2009 (r193) +++ wbxml2/trunk/src/wbxml_parser.c Thu Mar 5 15:20:53 2009 (r194) @@ -2772,40 +2772,40 @@ data_ptr = wbxml_buffer_get_cstr(*data); /* Get Year */ - the_value = (WB_ULONG) (((data_ptr[5] & 0x3F) << 6) + ((data_ptr[4] >> 2) & 0x3F)); + the_value = (WB_ULONG) (((data_ptr[0] & 0x3F) << 6) + ((data_ptr[1] >> 2) & 0x3F)); sprintf(the_year, "%u", the_value); /* Get Month */ - the_value = (WB_ULONG) (((data_ptr[4] & 0x03) << 2) | ((data_ptr[3] >> 6) & 0x03)); + the_value = (WB_ULONG) (((data_ptr[1] & 0x03) << 2) | ((data_ptr[2] >> 6) & 0x03)); sprintf(the_month, "%02u", the_value); /* Get Day */ - the_value = (WB_ULONG) ((data_ptr[3] >> 1) & 0x1F); + the_value = (WB_ULONG) ((data_ptr[2] >> 1) & 0x1F); sprintf(the_date, "%02u", the_value); /* Get Hour */ - the_value = (WB_ULONG) (((data_ptr[3] & 0x01) << 4) | ((data_ptr[2] >> 4) & 0x0F)); + the_value = (WB_ULONG) (((data_ptr[2] & 0x01) << 4) | ((data_ptr[3] >> 4) & 0x0F)); sprintf(the_hour, "%02u", the_value); /* Get Minute */ - the_value = (WB_ULONG) (((data_ptr[2] & 0x0F) << 2) | ((data_ptr[1] >> 6) & 0x03)); + the_value = (WB_ULONG) (((data_ptr[3] & 0x0F) << 2) | ((data_ptr[4] >> 6) & 0x03)); sprintf(the_minute, "%02u", the_value); /* Get Second */ - the_value = (WB_ULONG) (data_ptr[1] & 0x3F); + the_value = (WB_ULONG) (data_ptr[4] & 0x3F); sprintf(the_second, "%02u", the_value); /* Get Time Zone */ - if (data_ptr[0] == 0) { + if (data_ptr[5] == 0) { /* This is a bug in the WBXML document. * If timezone UTC aka Zulu is used then a 'Z' must be set. */ sprintf((WB_TINY *) result, "%s%s%sT%s%s%sZ", the_year, the_month, the_date, the_hour, the_minute, the_value ? the_second : ""); - } else if (data_ptr[0] < 'A' || - data_ptr[0] > 'Z' || - data_ptr[0] == 'J') + } else if (data_ptr[5] < 'A' || + data_ptr[5] > 'Z' || + data_ptr[5] == 'J') { /* This is a bug in the WBXML document. * The timezone byte is set and wrong. @@ -2819,7 +2819,7 @@ else { sprintf((WB_TINY *) result, "%s%s%sT%s%s%s%c", - the_year, the_month, the_date, the_hour, the_minute, the_value ? the_second : "", data_ptr[0]); + the_year, the_month, the_date, the_hour, the_minute, the_value ? the_second : "", data_ptr[5]); } /* Reset buffer */ |