From: <svn...@op...> - 2009-04-03 19:40:03
|
Author: bellmich Date: Fri Apr 3 21:39:52 2009 New Revision: 1031 URL: http://libsyncml.opensync.org/changeset/1031 Log: fixed several warnings from the profiling build Modified: trunk/libsyncml/data_sync_api/data_sync.c trunk/libsyncml/data_sync_api/data_sync_abort.c trunk/libsyncml/data_sync_api/data_sync_callbacks.c trunk/libsyncml/data_sync_api/data_sync_loop.c trunk/libsyncml/objects/sml_devinf_obj.c trunk/libsyncml/objects/sml_devinf_obj.h 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_elements.c trunk/libsyncml/sml_manager.c trunk/libsyncml/sml_notification.c trunk/libsyncml/sml_parse.c trunk/libsyncml/sml_queue.c trunk/libsyncml/sml_session.c trunk/libsyncml/sml_support.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_client_samsung.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 Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/data_sync_api/data_sync.c Fri Apr 3 21:39:52 2009 (r1031) @@ -802,6 +802,7 @@ SmlDataSyncObject *dsObject, SmlError **error) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p)", __func__, dsObject, error); smlAssert(dsObject); return smlSessionGetTarget(dsObject->session); } Modified: trunk/libsyncml/data_sync_api/data_sync_abort.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_abort.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/data_sync_api/data_sync_abort.c Fri Apr 3 21:39:52 2009 (r1031) @@ -56,14 +56,14 @@ /* stop transport */ WORKAROUND: smlTrace(TRACE_INTERNAL, "%s: A hard abort is required.", __func__); - SmlLink *link = smlManagerSessionGetLink( + SmlLink *link_ = smlManagerSessionGetLink( dsObject->manager, dsObject->session, error); - if (!link && *error) + if (!link_ && *error) goto error; - if (!smlTransportDisconnect(dsObject->tsp, link, error)) + if (!smlTransportDisconnect(dsObject->tsp, link_, error)) goto error; } Modified: trunk/libsyncml/data_sync_api/data_sync_callbacks.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_callbacks.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/data_sync_api/data_sync_callbacks.c Fri Apr 3 21:39:52 2009 (r1031) @@ -127,17 +127,17 @@ if (dsObject->tryDisconnect == FALSE) { dsObject->tryDisconnect = TRUE; SmlError *locerror = NULL; - SmlLink *link = smlManagerSessionGetLink( + SmlLink *link_ = smlManagerSessionGetLink( dsObject->manager, dsObject->session, &locerror); - if (link || !locerror) + if (link_ || !locerror) smlTransportDisconnect( dsObject->tsp, - link, + link_, &locerror); - if (link) - smlLinkDeref(link); + if (link_) + smlLinkDeref(link_); /* error is already tracked. * So locerror can be ignored. */ @@ -294,11 +294,11 @@ case SML_MANAGER_SESSION_END: smlTrace(TRACE_INTERNAL, "%s: Session %s has ended", __func__, VA_STRING(smlSessionGetSessionID(session))); - SmlLink *link = smlManagerSessionGetLink( + SmlLink *link_ = smlManagerSessionGetLink( dsObject->manager, dsObject->session, &error); - if (!link && error) + if (!link_ && error) goto error; /* OBEX is a stateful protocol and the client should * init the disconnect. The problem is what happens @@ -307,14 +307,14 @@ * if (dsObject->tspType != SML_TRANSPORT_OBEX_SERVER && * !smlTransportDisconnect(dsObject->tsp, link, &error)) */ - if (!smlTransportDisconnect(dsObject->tsp, link, &error)) + if (!smlTransportDisconnect(dsObject->tsp, link_, &error)) { - if (link) - smlLinkDeref(link); + if (link_) + smlLinkDeref(link_); goto error; } - if (link) - smlLinkDeref(link); + if (link_) + smlLinkDeref(link_); break; case SML_MANAGER_SESSION_ERROR: if (session) @@ -644,6 +644,7 @@ SmlStatus *status, void *userdata) { + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, session, status, userdata); if (smlStatusGetClass(status) != SML_ERRORCLASS_SUCCESS) { SmlDataSyncDatastore *datastore = userdata; @@ -655,6 +656,7 @@ datastore->dsObject, SML_DATA_SYNC_EVENT_ERROR, datastore->dsObject->eventUserdata, error); } + smlTrace(TRACE_EXIT, "%s", __func__); } /* ******************************************* */ Modified: trunk/libsyncml/data_sync_api/data_sync_loop.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_loop.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/data_sync_api/data_sync_loop.c Fri Apr 3 21:39:52 2009 (r1031) @@ -25,6 +25,7 @@ static gboolean _prepare(GSource *source, gint *timeout_) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p)", __func__, source, timeout_); *timeout_ = 50; return FALSE; } @@ -46,6 +47,7 @@ static gboolean _dispatch(GSource *source, GSourceFunc callback, gpointer user_data) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p, %p)", __func__, source, callback, user_data); SmlDataSyncObject *dsObject = user_data; GList *o = dsObject->datastores; Modified: trunk/libsyncml/objects/sml_devinf_obj.c ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/objects/sml_devinf_obj.c Fri Apr 3 21:39:52 2009 (r1031) @@ -409,12 +409,14 @@ /* FIXME: DEPRECATED */ void smlDevInfAgentSetDevInf(SmlDevInfAgent *agent, SmlDevInf *devinf) { + smlTrace(TRACE_ERROR, "%s(%p, %p)", __func__, agent, devinf); smlAssertMsg(NULL, "This function is a design bug."); } /* FIXME: DEPRECATED */ SmlDevInf *smlDevInfAgentGetDevInf(SmlDevInfAgent *agent) { + smlTrace(TRACE_ERROR, "%s(%p, %p)", __func__, agent); smlAssertMsg(NULL, "This function is a design bug."); return NULL; } Modified: trunk/libsyncml/objects/sml_devinf_obj.h ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.h Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/objects/sml_devinf_obj.h Fri Apr 3 21:39:52 2009 (r1031) @@ -46,7 +46,7 @@ SmlDevInf *smlDevInfAgentGetSessionDevInf(SmlDevInfAgent *agent, SmlSession *session); /* These functions can only work in a single session environemnt. -/* This is a design bug. The functions are not removed immediately + * This is a design bug. The functions are not removed immediately * to avoid breaking applications which ignore the device information. * These functions always fire an assertion. */ Modified: trunk/libsyncml/objects/sml_ds_server.c ============================================================================== --- trunk/libsyncml/objects/sml_ds_server.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/objects/sml_ds_server.c Fri Apr 3 21:39:52 2009 (r1031) @@ -507,7 +507,7 @@ type = SML_ERROR_REQUIRE_REFRESH; dsession->recvAlertCallback = NULL; - SmlStatus *reply = smlCommandNewReply(dsession->alertCommand, type, &error); + reply = smlCommandNewReply(dsession->alertCommand, type, &error); if (!reply) goto error; @@ -541,7 +541,7 @@ SmlCommand *cmd = dsession->recvSync->data; smlTrace(TRACE_INTERNAL, "%s: answering sync command with cmdRef %i and msgRef %i", __func__, cmd->cmdID, cmd->msgID); - SmlStatus *reply = smlCommandNewReply(cmd, SML_NO_ERROR, &error); + reply = smlCommandNewReply(cmd, SML_NO_ERROR, &error); if (!reply) goto error; Modified: trunk/libsyncml/parser/sml_wbxml.c ============================================================================== --- trunk/libsyncml/parser/sml_wbxml.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/parser/sml_wbxml.c Fri Apr 3 21:39:52 2009 (r1031) @@ -148,7 +148,7 @@ if (!smlXmlAssemblerRun(assm, &buffer, &buffer_size, end, final, 0, error)) goto error; - WBXMLConvXML2WBXMLParams params = {WBXML_VERSION_12, FALSE, FALSE}; + WBXMLConvXML2WBXMLParams params = {WBXML_VERSION_12, FALSE, FALSE, FALSE}; const char *opt = smlAssemblerGetOption(assm->assembler, "USE_STRTABLE"); if (opt && atoi(opt)) params.use_strtbl = TRUE; @@ -185,7 +185,7 @@ if (!smlXmlAssemblerRunFull(assm, &buffer, &buffer_size, NULL, TRUE, FALSE, 0, error)) goto error; - WBXMLConvXML2WBXMLParams params = {WBXML_VERSION_12, FALSE, FALSE}; + WBXMLConvXML2WBXMLParams params = {WBXML_VERSION_12, FALSE, FALSE, FALSE}; const char *opt = smlAssemblerGetOption(assm->assembler, "USE_STRTABLE"); if (opt && atoi(opt)) params.use_strtbl = TRUE; Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/parser/sml_xml_assm.c Fri Apr 3 21:39:52 2009 (r1031) @@ -504,11 +504,6 @@ smlTrace(TRACE_INTERNAL, "%s: Large object: use %i, server %i, requestedSize %i", __func__, supportsLargeObjects, assm->session->sessionType == SML_SESSION_TYPE_SERVER ? 1 : 0, smlAssemblerGetRemoteMaxObjSize(assm->assembler)); - if (assm->session->sessionType == SML_SESSION_TYPE_SERVER) { - if (smlAssemblerGetRemoteMaxObjSize(assm->assembler) == -1) - supportsLargeObjects = FALSE; - } - if (supportsLargeObjects && change->size) { if (!_smlXmlAssemblerAddIDNS(assm, SML_ELEMENT_SIZE, SML_NAMESPACE_METINF, change->size, error)) goto error; @@ -2131,7 +2126,7 @@ goto error; // add values - GList *hvalue = NULL; + hvalue = NULL; for (hvalue = param->valEnums; hvalue; hvalue = hvalue->next) { char *valEnum = hvalue->data; Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/parser/sml_xml_parse.c Fri Apr 3 21:39:52 2009 (r1031) @@ -1672,12 +1672,12 @@ /* convert the whole strong to UTF-8 */ smlTrace(TRACE_INTERNAL, "%s: Converting %d bytes ...", __func__, last_utf16 - position + 1); GError *gerror = NULL; - size_t read = 0; - size_t written = 0; + size_t read_bytes = 0; + size_t written_bytes = 0; gchar *conv_string = g_convert( position, (last_utf16 - position + 1), "UTF-8", "UTF-16", - &read, &written, + &read_bytes, &written_bytes, &gerror); if (gerror != NULL) { @@ -1689,23 +1689,23 @@ smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, smlErrorPrint(error)); return FALSE; } - smlTrace(TRACE_INTERNAL, "%s: read %d --> written %d --> %d ::= %s", __func__, read, written, strlen(conv_string), conv_string); + smlTrace(TRACE_INTERNAL, "%s: read %d --> written %d --> %d ::= %s", __func__, read_bytes, written_bytes, strlen(conv_string), conv_string); /* replace the embedded string */ - char *new_data = smlTryMalloc0(*fixed_size - read + written + 1, error); + char *new_data = smlTryMalloc0(*fixed_size - read_bytes + written_bytes + 1, error); if (!new_data) { smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, smlErrorPrint(error)); return FALSE; } memcpy(new_data, *fixed_data, (size_t) position - (size_t) *fixed_data); - memcpy(new_data + (size_t) position - (size_t) *fixed_data, conv_string, written); - memcpy(new_data + (size_t) position - (size_t) *fixed_data + written, - position + read, *fixed_size - ( (size_t) position - (size_t) *fixed_data ) - read ); + memcpy(new_data + (size_t) position - (size_t) *fixed_data, conv_string, written_bytes); + memcpy(new_data + (size_t) position - (size_t) *fixed_data + written_bytes, + position + read_bytes, *fixed_size - ( (size_t) position - (size_t) *fixed_data ) - read_bytes ); /* fix pointers */ - *fixed_size = *fixed_size - read + written; - position = new_data + (position - *fixed_data) + written; + *fixed_size = *fixed_size - read_bytes + written_bytes; + position = new_data + (position - *fixed_data) + written_bytes; smlSafeCFree(fixed_data); *fixed_data = new_data; new_data = NULL; Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/sml_elements.c Fri Apr 3 21:39:52 2009 (r1031) @@ -443,11 +443,12 @@ /** Checks if the item is complete */ SmlBool smlItemCheck(SmlItem *item) { + smlAssert(xmlBufferLength(item->buffer) >= 0); smlAssert(item); if (!item->size) return TRUE; - if (xmlBufferLength(item->buffer) != item->size) + if ((unsigned int)xmlBufferLength(item->buffer) != item->size) { smlTrace(TRACE_INTERNAL, "%s: failed because size (%d != %d) does not match (%s).", __func__, item->size, Modified: trunk/libsyncml/sml_manager.c ============================================================================== --- trunk/libsyncml/sml_manager.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/sml_manager.c Fri Apr 3 21:39:52 2009 (r1031) @@ -81,6 +81,7 @@ static gboolean _manager_prepare_internal(GSource *source, gint *timeout_) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p)", __func__, source, timeout_); *timeout_ = 1; return FALSE; } @@ -99,6 +100,7 @@ static gboolean _manager_dispatch_internal(GSource *source, GSourceFunc callback, gpointer user_data) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p, %p)", __func__, source, callback, user_data); int max = 100; SmlManager *manager = user_data; @@ -193,9 +195,9 @@ /* If we return FALSE in this function, the current request will get * aborted */ -static SmlBool _smlManagerDataHandler(SmlTransport *tsp, SmlLink *link, SmlTransportEventType type, SmlTransportData *data, SmlError *error, void *userdata) +static SmlBool _smlManagerDataHandler(SmlTransport *tsp, SmlLink *link_, SmlTransportEventType type, SmlTransportData *data, SmlError *error, void *userdata) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p, %p)", __func__, tsp, link, type, data, error, userdata); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p, %p)", __func__, tsp, link_, type, data, error, userdata); smlAssert(userdata); SmlManager *manager = userdata; SmlParser *parser = NULL; @@ -265,9 +267,9 @@ header->source, header->target, header->sessionID, 1, &locerror))) goto error_free_header; - if (link) + if (link_) { - char *responseURI = smlTransportGetResponseURI(link, session, &locerror); + char *responseURI = smlTransportGetResponseURI(link_, session, &locerror); if (!responseURI && locerror) goto error_free_header; if (responseURI) @@ -280,15 +282,15 @@ smlSafeCFree(&responseURI); } } - if (!smlManagerSessionAdd(manager, session, link, &locerror)) + if (!smlManagerSessionAdd(manager, session, link_, &locerror)) goto error_free_header; smlSessionUnref(session); } else { /* SECURITY: let's check ResponseURI if supported * SECURITY: this is important to avoid replay attacks */ - if (link) { - char *responseUri = smlTransportGetResponseURI(link, session, &locerror); + if (link_) { + char *responseUri = smlTransportGetResponseURI(link_, session, &locerror); if (!responseUri && locerror) { goto error_free_header; } @@ -316,8 +318,8 @@ if (sess->session == session) { if (sess->link) smlLinkDeref(sess->link); - sess->link = link; - if (link) + sess->link = link_; + if (link_) smlLinkRef(sess->link); break; } @@ -366,7 +368,7 @@ if (session) smlSessionUnlock(session); session_error: - if (session == NULL && link && type == SML_TRANSPORT_EVENT_DATA) { + if (session == NULL && link_ && type == SML_TRANSPORT_EVENT_DATA) { /* If there is no session and a link then this means * that there is a failing server connection. * It is a good idea to close the connection because @@ -374,7 +376,7 @@ * disconnect to the link. */ SmlError *herror = NULL; - if (!smlTransportDisconnect(manager->transport, link, &herror)) { + if (!smlTransportDisconnect(manager->transport, link_, &herror)) { smlTrace(TRACE_ERROR, "%s: Disconnect on error failed. %s", smlErrorPrint(&herror)); smlErrorDeref(&herror); @@ -775,9 +777,9 @@ smlTrace(TRACE_EXIT, "%s", __func__); } -SmlBool smlManagerSessionAdd(SmlManager *manager, SmlSession *session, SmlLink *link, SmlError **error) +SmlBool smlManagerSessionAdd(SmlManager *manager, SmlSession *session, SmlLink *link_, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, manager, session, link, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, manager, session, link_, error); CHECK_ERROR_REF smlSessionRef(session); @@ -803,9 +805,9 @@ sess->session = session; sess->finalLock = 0; - if (link) { - sess->link = link; - smlLinkRef(link); + if (link_) { + sess->link = link_; + smlLinkRef(link_); } sess->transport = manager->transport; Modified: trunk/libsyncml/sml_notification.c ============================================================================== --- trunk/libsyncml/sml_notification.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/sml_notification.c Fri Apr 3 21:39:52 2009 (r1031) @@ -213,7 +213,7 @@ data += 25 + idLength; unsigned int alertLength = 25 + idLength; - int i = 0; + unsigned int i = 0; for (i = 0; i < numSync; i++) { if (size < alertLength + 5) { smlErrorSet(error, SML_ERROR_GENERIC, "Size too small3"); Modified: trunk/libsyncml/sml_parse.c ============================================================================== --- trunk/libsyncml/sml_parse.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/sml_parse.c Fri Apr 3 21:39:52 2009 (r1031) @@ -593,7 +593,7 @@ goto error_enable_item; /* Now check the size */ - unsigned int size = 0; + int size = 0; if (!(size = smlAssemblerCheckSize(assm, FALSE, error))) goto error_remove; @@ -682,7 +682,7 @@ int limit = smlAssemblerGetRemoteMaxMsgSize(assm); if (limit) { /* Now check the size */ - unsigned int size = 0; + int size = 0; if (!(size = smlAssemblerCheckSize(assm, FALSE, error))) goto error; @@ -854,7 +854,7 @@ int limit = smlAssemblerGetRemoteMaxMsgSize(assm); if (limit) { /* Now check the size */ - unsigned int size = 0; + int size = 0; if (!(size = smlAssemblerCheckSize(assm, FALSE, error))) goto error; Modified: trunk/libsyncml/sml_queue.c ============================================================================== --- trunk/libsyncml/sml_queue.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/sml_queue.c Fri Apr 3 21:39:52 2009 (r1031) @@ -29,6 +29,7 @@ static gboolean _queue_prepare(GSource *source, gint *timeout_) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p)", __func__, source, timeout_); *timeout_ = 1; return FALSE; } @@ -61,6 +62,7 @@ static gboolean _queue_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p, %p)", __func__, source, callback, user_data); SmlQueue *queue = user_data; smlAssert(queue->handler); Modified: trunk/libsyncml/sml_session.c ============================================================================== --- trunk/libsyncml/sml_session.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/sml_session.c Fri Apr 3 21:39:52 2009 (r1031) @@ -270,7 +270,6 @@ /* get original item and cleanup item list */ smlAssert(g_list_length(orig_cmd->private.change.items) == 1); - SmlItem *orig_item = orig_cmd->private.change.items->data; smlAssert(g_list_remove(orig_cmd->private.change.items, orig_item) == NULL); orig_cmd->private.change.items = NULL; @@ -361,7 +360,9 @@ /* If max obj size is not unlimited (0), and the size of the item is larger * than the max obj size, we have to return an error */ int sendingmaxobjsize = smlSessionGetRemoteMaxObjSize(session); - if ((sendingmaxobjsize > 0) && (size > sendingmaxobjsize)) { + if ((sendingmaxobjsize > 0) && + (size > (unsigned int)sendingmaxobjsize)) + { smlErrorSet(error, SML_ERROR_SIZE_MISMATCH, "Item (%ub) is larger than the limit (%db)", size, smlSessionGetRemoteMaxObjSize(session)); goto error; } @@ -376,7 +377,10 @@ item->moreData = FALSE; /* Check if item data fits into the current message */ - if (session->frag_command || (space && space < size - session->frag_size)) { + if (session->frag_command || + (space > 0 && + (unsigned int) space < size - session->frag_size)) + { smlTrace(TRACE_INTERNAL, "%s: Space %i, size %i. Fragmenting. Already added: %i", __func__, space, size - session->frag_size, session->frag_size); /* We need to fragment */ /* Store the command for processing */ @@ -1460,7 +1464,7 @@ * then this is no problem because the function is safe against * mutliple calls (the SmlManager already requires this). */ - int i = 0; + unsigned int i = 0; while (!session->waiting && smlQueueCheckPrio(session->command_queue) && i < num) { smlSessionDispatch(session); i++; @@ -2366,7 +2370,7 @@ if (remoteLimit > 0) { /* The remote peer already sent MaxObjSize */ - if (remoteLimit > limit && limit > 0) + if ((unsigned int)remoteLimit > limit && limit > 0) { /* If the limit of the remote peer is higher * than the local limit then the local limit Modified: trunk/libsyncml/sml_support.c ============================================================================== --- trunk/libsyncml/sml_support.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/sml_support.c Fri Apr 3 21:39:52 2009 (r1031) @@ -301,7 +301,7 @@ */ char *smlRandStr(int maxlength, SmlBool exact) { - char *randchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ1234567890"; + const char *randchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ1234567890"; int length; char *retchar; Modified: trunk/libsyncml/sml_transport.c ============================================================================== --- trunk/libsyncml/sml_transport.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/sml_transport.c Fri Apr 3 21:39:52 2009 (r1031) @@ -81,9 +81,9 @@ smlTrace(TRACE_EXIT, "%s", __func__); } -SmlBool smlTransportSend(SmlTransport *tsp, SmlLink *link, SmlTransportData *data, SmlError **error) +SmlBool smlTransportSend(SmlTransport *tsp, SmlLink *link_, SmlTransportData *data, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, tsp, link, data, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, tsp, link_, data, error); CHECK_ERROR_REF smlAssert(tsp); smlAssert(data); @@ -104,8 +104,8 @@ cmd->type = SML_TRANSPORT_CMD_SEND; cmd->data = data; - if (link) { - cmd->link = link; + if (link_) { + cmd->link = link_; smlLinkRef(cmd->link); } @@ -184,9 +184,9 @@ return; } -SmlBool smlTransportReceiveEvent(SmlTransport *tsp, SmlLink *link, SmlTransportEventType type, SmlTransportData *data, SmlError *error) +SmlBool smlTransportReceiveEvent(SmlTransport *tsp, SmlLink *link_, SmlTransportEventType type, SmlTransportData *data, SmlError *error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p)", __func__, tsp, link, type, data, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %i, %p, %p)", __func__, tsp, link_, type, data, error); smlAssert(tsp); SmlBool ret = TRUE; @@ -264,7 +264,7 @@ * because the link is down now. */ - if (type == SML_TRANSPORT_EVENT_CONNECT_DONE && !link) + if (type == SML_TRANSPORT_EVENT_CONNECT_DONE && !link_) { if (smlTransportIsServer(tsp)) g_error("A connect event without a link was received " \ @@ -276,7 +276,7 @@ tsp->connected = TRUE; } - if (type == SML_TRANSPORT_EVENT_DISCONNECT_DONE && !link) + if (type == SML_TRANSPORT_EVENT_DISCONNECT_DONE && !link_) { if (smlTransportIsServer(tsp)) g_error("A disconnect event without a link was received " \ @@ -288,12 +288,12 @@ tsp->connected = FALSE; } - if (type == SML_TRANSPORT_EVENT_CONNECT_DONE && link) + if (type == SML_TRANSPORT_EVENT_CONNECT_DONE && link_) { if (!smlTransportIsServer(tsp)) g_error("A connect event with a link was received " \ "but the transport layer is a server."); - if (!link->link_data) + if (!link_->link_data) g_error("A connect event with a link was received " \ "but the link does not contain the required " \ "transport environment."); @@ -303,12 +303,12 @@ g_mutex_unlock(tsp->connections_mutex); } - if (type == SML_TRANSPORT_EVENT_DISCONNECT_DONE && link) + if (type == SML_TRANSPORT_EVENT_DISCONNECT_DONE && link_) { if (!smlTransportIsServer(tsp)) g_error("A disconnect event with a link was received " \ "but the transport layer is not a server."); - if (link->link_data) + if (link_->link_data) g_error("A disconnect event with a link was received " \ "but the link still contains the " \ "transport environment."); @@ -326,7 +326,7 @@ { /* send the event */ g_atomic_int_inc(&(tsp->event_callback_ref_count)); - ret = tsp->event_callback(tsp, link, type, data, error, tsp->event_callback_userdata); + ret = tsp->event_callback(tsp, link_, type, data, error, tsp->event_callback_userdata); smlTrace(TRACE_INTERNAL, "%s: %d event callbacks", __func__, g_atomic_int_dec_and_test(&(tsp->event_callback_ref_count))); } @@ -343,6 +343,7 @@ /* FIXME: DEPRECATED */ SmlBool smlTransportRunAsync(SmlTransport *tsp, SmlError **error) { + smlTrace(TRACE_ERROR, "%s(%p,%p)", __func__, tsp, error); CHECK_ERROR_REF /* All transports run in asynchronous mode. * Therefore this function should never be called. @@ -414,9 +415,9 @@ return FALSE; } -SmlBool smlTransportDisconnect(SmlTransport *tsp, SmlLink *link, SmlError **error) +SmlBool smlTransportDisconnect(SmlTransport *tsp, SmlLink *link_, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, tsp, link, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, tsp, link_, error); CHECK_ERROR_REF smlAssert(tsp); @@ -433,7 +434,7 @@ * because every client can have only one connection. */ - if (link && !smlTransportIsServer(tsp)) + if (link_ && !smlTransportIsServer(tsp)) { smlErrorSet(error, SML_ERROR_GENERIC, "A transport client has no link " \ @@ -451,7 +452,7 @@ * This means that all links must be shut down. */ - if (link && !link->link_data) + if (link_ && !link_->link_data) { /* If there is a very fast or aggressive client * then it can happen that the client closes @@ -470,7 +471,7 @@ return TRUE; } - if (!link && smlTransportIsServer(tsp) && tsp->connections) + if (!link_ && smlTransportIsServer(tsp) && tsp->connections) { smlErrorSet(error, SML_ERROR_GENERIC, "A server shutdown is requested " \ @@ -483,22 +484,22 @@ * this is also a check for the correct registration of the link */ - if (link) + if (link_) { - if (tsp != link->tsp) + if (tsp != link_->tsp) { smlErrorSet(error, SML_ERROR_GENERIC, "The link %p is registered at another transport layer %p than this one %p.", - link, link->tsp, tsp); + link_, link_->tsp, tsp); goto error; } g_mutex_lock(tsp->links_mutex); - if (!g_hash_table_lookup(tsp->links, link)) { + if (!g_hash_table_lookup(tsp->links, link_)) { g_mutex_unlock(tsp->links_mutex); smlErrorSet(error, SML_ERROR_GENERIC, "The link %p is not registered at the transport layer %p", - link, tsp); + link_, tsp); goto error; } g_mutex_unlock(tsp->links_mutex); @@ -511,8 +512,8 @@ goto error; cmd->type = SML_TRANSPORT_CMD_DISCONNECT; - if (link) { - cmd->link = link; + if (link_) { + cmd->link = link_; smlLinkRef(cmd->link); } @@ -588,9 +589,9 @@ smlTrace(TRACE_EXIT, "%s: Freed", __func__); } -void smlTransportSetError(SmlTransport *tsp, SmlLink *link, SmlError **error) +void smlTransportSetError(SmlTransport *tsp, SmlLink *link_, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p(%p))", __func__, tsp, link, error, error ? *error : NULL); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p(%p))", __func__, tsp, link_, error, error ? *error : NULL); /* Do no use CHECK_ERROR_REF here. * SmlError **error contains an error which should be send. */ @@ -603,8 +604,8 @@ cmd->type = SML_TRANSPORT_CMD_SEND; cmd->data = NULL; - if (link) { - cmd->link = link; + if (link_) { + cmd->link = link_; smlLinkRef(cmd->link); } @@ -625,21 +626,21 @@ CHECK_ERROR_REF smlAssert(link_data); - SmlLink *link = smlTryMalloc0(sizeof(SmlLink), error); - if (!link) + SmlLink *link_ = smlTryMalloc0(sizeof(SmlLink), error); + if (!link_) goto error; - link->tsp = tsp; - link->link_data = link_data; - link->refCount = 1; + link_->tsp = tsp; + link_->link_data = link_data; + link_->refCount = 1; /* register the link at the transport */ g_mutex_lock(tsp->links_mutex); - g_hash_table_insert(tsp->links, link, GINT_TO_POINTER(1)); + g_hash_table_insert(tsp->links, link_, GINT_TO_POINTER(1)); g_mutex_unlock(tsp->links_mutex); - smlTrace(TRACE_EXIT, "%s: %p", __func__, link); - return link; + smlTrace(TRACE_EXIT, "%s: %p", __func__, link_); + return link_; error: smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); @@ -657,37 +658,37 @@ return NULL; } -SmlLink *smlLinkRef(SmlLink *link) +SmlLink *smlLinkRef(SmlLink *link_) { - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, link); - smlAssert(link); + smlTrace(TRACE_ENTRY, "%s(%p)", __func__, link_); + smlAssert(link_); - g_atomic_int_inc(&(link->refCount)); + g_atomic_int_inc(&(link_->refCount)); smlTrace(TRACE_EXIT, "%s", __func__); - return link; + return link_; } -void smlLinkDeref(SmlLink *link) +void smlLinkDeref(SmlLink *link_) { - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, link); - smlAssert(link); + smlTrace(TRACE_ENTRY, "%s(%p)", __func__, link_); + smlAssert(link_); - if (!g_atomic_int_dec_and_test(&(link->refCount))) { + if (!g_atomic_int_dec_and_test(&(link_->refCount))) { smlTrace(TRACE_EXIT, "%s: refCount > 0", __func__); return; } /* deregister the link from the transport */ - g_mutex_lock(link->tsp->links_mutex); - if (!g_hash_table_remove(link->tsp->links, link)) - g_warning("The link %p was never registered.", link); - g_mutex_unlock(link->tsp->links_mutex); + g_mutex_lock(link_->tsp->links_mutex); + if (!g_hash_table_remove(link_->tsp->links, link_)) + g_warning("The link %p was never registered.", link_); + g_mutex_unlock(link_->tsp->links_mutex); /* free the memory */ - smlSafeFree((gpointer *)&link); + smlSafeFree((gpointer *)&link_); smlTrace(TRACE_EXIT, "%s: Freed", __func__); } @@ -1142,7 +1143,7 @@ } /* give all jobs a chance to finish cleanly */ - int i = 0; + unsigned int i = 0; unsigned int queueLength = smlQueueLength(tsp->command_queue); for (; i < queueLength; i++) { if (tsp->thread) { @@ -1182,21 +1183,21 @@ return FALSE; } -char * smlTransportGetResponseURI(SmlLink *link, SmlSession *session, SmlError **error) +char * smlTransportGetResponseURI(SmlLink *link_, SmlSession *session, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, link, session, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, link_, session, error); /* Do not change the assertion to simple return FALSE stuff * because to many developers incl. me ignore returned FALSE * if it is only configuration. */ CHECK_ERROR_REF - smlAssert(link); - smlAssert(link->tsp); + smlAssert(link_); + smlAssert(link_->tsp); smlAssert(session); - if (link->tsp->functions.get_response_uri) + if (link_->tsp->functions.get_response_uri) { - char *result = link->tsp->functions.get_response_uri(link, session, error); + char *result = link_->tsp->functions.get_response_uri(link_, session, error); smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); return result; } else { Modified: trunk/libsyncml/transports/http_client.c ============================================================================== --- trunk/libsyncml/transports/http_client.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/transports/http_client.c Fri Apr 3 21:39:52 2009 (r1031) @@ -42,7 +42,7 @@ static void smlTransportHttpClientCallback(SoupSession *session, SoupMessage *msg, gpointer userdata) #endif { - smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, msg, userdata); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, session, msg, userdata); SmlTransportHttpClientEnv *env = userdata; SmlError *error = NULL; @@ -198,6 +198,7 @@ _authenticate (SoupSession *session, SoupMessage *msg, SoupAuth *auth, gboolean retrying, gpointer data) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p, %p, %d, %p)", __func__, session, msg, auth, retrying, data); SmlTransportHttpClientEnv *env = data; smlTrace(TRACE_INTERNAL, "%s: authentication via auth_type %s", __func__, VA_STRING(soup_auth_get_scheme_name(auth))); @@ -426,9 +427,9 @@ return FALSE; } -static void smlTransportHttpClientSend(void *userdata, void *link, SmlTransportData *data, SmlError *error) +static void smlTransportHttpClientSend(void *userdata, void *link_, SmlTransportData *data, SmlError *error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, userdata, link, data, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, userdata, link_, data, error); smlAssert(error || data); smlAssert(userdata); SmlTransportHttpClientEnv *env = userdata; Modified: trunk/libsyncml/transports/http_server.c ============================================================================== --- trunk/libsyncml/transports/http_server.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/transports/http_server.c Fri Apr 3 21:39:52 2009 (r1031) @@ -39,7 +39,7 @@ smlAssert(data); SmlTransportHttpServerEnv *env = data; SmlLinkHttpServerEnv *linkenv = NULL; - SmlLink *link = NULL; + SmlLink *link_ = NULL; SmlError *error = NULL; char *path = soup_uri_to_string (soup_message_get_uri(msg), TRUE); @@ -50,8 +50,8 @@ /* check that this is a registered session */ smlSafeCFree(&path); path = soup_uri_to_string (soup_message_get_uri(msg), FALSE); - link = g_hash_table_lookup(env->uriToLink, path); - if (!link) + link_ = g_hash_table_lookup(env->uriToLink, path); + if (!link_) { /* The URL was changed and there is no * key/value pair for this URL available. @@ -65,7 +65,7 @@ smlSafeCFree(&path); goto error; } - smlLinkRef(link); + smlLinkRef(link_); } smlSafeCFree(&path); @@ -99,7 +99,7 @@ } /* prepare link and linkenv */ - if (!link) + if (!link_) { /* This is a potentially new session. * It is not possible to check this here. @@ -110,20 +110,20 @@ if (!linkenv) goto error; linkenv->env = env; - link = smlLinkNew(env->tsp, linkenv, &error); - if (!link) + link_ = smlLinkNew(env->tsp, linkenv, &error); + if (!link_) goto error; linkenv->msg = msg; /* the link must be cached for disconnect signaling */ - linkenv->link = link; + linkenv->link = link_; smlLinkRef(linkenv->link); /* We think positive here and signal connect. * the link is now complete, so send the connect event */ - smlTransportReceiveEvent(env->tsp, link, SML_TRANSPORT_EVENT_CONNECT_DONE, NULL, NULL); + smlTransportReceiveEvent(env->tsp, link_, SML_TRANSPORT_EVENT_CONNECT_DONE, NULL, NULL); } else { - linkenv = link->link_data; + linkenv = link_->link_data; if (linkenv->msg) smlTrace(TRACE_INTERNAL, "%s: WARNING: ResponseURI should not be in use - test mode.", @@ -151,9 +151,9 @@ if (!tspdata) goto error_unref_msg; - smlTransportReceiveEvent(env->tsp, link, SML_TRANSPORT_EVENT_DATA, tspdata, NULL); + smlTransportReceiveEvent(env->tsp, link_, SML_TRANSPORT_EVENT_DATA, tspdata, NULL); - smlLinkDeref(link); + smlLinkDeref(link_); smlTransportDataDeref(tspdata); soup_message_io_pause(msg); @@ -162,8 +162,8 @@ return; error_unref_msg: - link->link_data = NULL; - smlLinkDeref(link); + link_->link_data = NULL; + smlLinkDeref(link_); linkenv->msg = NULL; smlSafeFree((gpointer *) &linkenv); error: @@ -188,7 +188,7 @@ smlAssert(data); SmlTransportHttpServerEnv *env = data; SmlLinkHttpServerEnv *linkenv = NULL; - SmlLink *link = NULL; + SmlLink *link_ = NULL; SmlError *error = NULL; smlTrace(TRACE_INTERNAL, "%s: %s %s HTTP/1.%d", @@ -203,8 +203,8 @@ if (g_strcasecmp(path, env->url)) { /* check that this is a registered session */ char *fullpath = soup_uri_to_string (soup_message_get_uri(msg), FALSE); - link = g_hash_table_lookup(env->uriToLink, fullpath); - if (!link) + link_ = g_hash_table_lookup(env->uriToLink, fullpath); + if (!link_) { /* The URL was changed and there is no * key/value pair for this URL available. @@ -218,7 +218,7 @@ smlSafeCFree(&fullpath); goto error; } - smlLinkRef(link); + smlLinkRef(link_); smlSafeCFree(&fullpath); } @@ -240,7 +240,7 @@ } /* prepare link and linkenv */ - if (!link) + if (!link_) { /* This is a potentially new session. * It is not possible to check this here. @@ -251,19 +251,19 @@ if (!linkenv) goto error; linkenv->env = env; - link = smlLinkNew(env->tsp, linkenv, &error); - if (!link) + link_ = smlLinkNew(env->tsp, linkenv, &error); + if (!link_) goto error; linkenv->msg = msg; /* the link must be cached for disconnect signaling */ - linkenv->link = link; + linkenv->link = link_; smlLinkRef(linkenv->link); /* We think positive here and signal connect. * the link is now complete, so send the connect event */ - smlTransportReceiveEvent(env->tsp, link, SML_TRANSPORT_EVENT_CONNECT_DONE, NULL, NULL); + smlTransportReceiveEvent(env->tsp, link_, SML_TRANSPORT_EVENT_CONNECT_DONE, NULL, NULL); } else { - linkenv = link->link_data; + linkenv = link_->link_data; if (linkenv->msg) smlTrace(TRACE_INTERNAL, "%s: WARNING: ResponseURI should not be in use - test mode.", @@ -296,11 +296,11 @@ if (!tspdata) goto error_unref_msg; - smlTransportReceiveEvent(env->tsp, link, SML_TRANSPORT_EVENT_DATA, tspdata, NULL); - smlLinkDeref(link); + smlTransportReceiveEvent(env->tsp, link_, SML_TRANSPORT_EVENT_DATA, tspdata, NULL); + smlLinkDeref(link_); /* If we activate this function call then we get segfaults */ - /* smlLinkDeref(link); */ + /* smlLinkDeref(link_); */ smlTransportDataDeref(tspdata); soup_server_pause_message(server, msg); @@ -309,7 +309,7 @@ return; error_unref_msg: - smlLinkDeref(link); + smlLinkDeref(link_); error: smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(&error)); smlErrorDeref(&error); @@ -444,18 +444,18 @@ } /* remove link from uriToLink */ - SmlLink *link = NULL; + SmlLink *link_ = NULL; smlTrace(TRACE_INTERNAL, "%s: remove link from uri/link cache", __func__); if (linkenv->url) { - link = g_hash_table_lookup(linkenv->env->uriToLink, linkenv->url); + link_ = g_hash_table_lookup(linkenv->env->uriToLink, linkenv->url); g_hash_table_remove(linkenv->env->uriToLink, linkenv->url); - smlLinkDeref(link); + smlLinkDeref(link_); smlSafeCFree(&(linkenv->url)); } /* save link for disconnect event */ - link = linkenv->link; + link_ = linkenv->link; /* signal disconnect to socket and potential client */ if (linkenv->msg) @@ -476,12 +476,12 @@ /* cleanup */ smlTrace(TRACE_INTERNAL, "%s: free memory", __func__); linkenv->env = NULL; - link->link_data = NULL; + link_->link_data = NULL; smlSafeFree((gpointer *)&linkenv); smlTrace(TRACE_INTERNAL, "%s: signal and unref link", __func__); - smlTransportReceiveEvent(env->tsp, link, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); - smlLinkDeref(link); + smlTransportReceiveEvent(env->tsp, link_, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); + smlLinkDeref(link_); smlTrace(TRACE_EXIT, "%s", __func__); } @@ -500,9 +500,9 @@ smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, key, value, user_data); // SmlTransportHttpServerEnv *env = user_data; char *uri = key; - SmlLink *link = value; + SmlLink *link_ = value; - smlLinkDeref(link); + smlLinkDeref(link_); smlSafeCFree(&uri); smlTrace(TRACE_EXIT, "%s", __func__); @@ -692,18 +692,18 @@ return; } -char * smlTransportHttpServerGetResponseURI(SmlLink *link, SmlSession *session, SmlError **error) +char * smlTransportHttpServerGetResponseURI(SmlLink *link_, SmlSession *session, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, link, session, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, link_, session, error); /* Do not change the assertion to simple return FALSE stuff * because to many developers incl. me ignore returned FALSE * if it is only configuration. */ CHECK_ERROR_REF - smlAssert(link); + smlAssert(link_); smlAssert(session); - smlAssert(link->link_data); - SmlLinkHttpServerEnv *linkenv = link->link_data; + smlAssert(link_->link_data); + SmlLinkHttpServerEnv *linkenv = link_->link_data; smlAssert(linkenv->env); SmlTransportHttpServerEnv *env = linkenv->env; char *responseURI = NULL; @@ -765,8 +765,8 @@ "A fresh random session ID is already in use."); goto error; } - smlLinkRef(link); - g_hash_table_insert(env->uriToLink, g_strdup(responseURI), link); + smlLinkRef(link_); + g_hash_table_insert(env->uriToLink, g_strdup(responseURI), link_); smlTrace(TRACE_INTERNAL, "%s: ResponseURI is %s.", __func__, VA_STRING(responseURI)); /* map session to URI */ @@ -806,7 +806,7 @@ smlSafeCFree(&soupURI); goto error; } - if (cachedLink != link) + if (cachedLink != link_) { /* SECURITY: This is an internal bug. */ smlErrorSet(error, SML_ERROR_GENERIC, Modified: trunk/libsyncml/transports/obex_client.c ============================================================================== --- trunk/libsyncml/transports/obex_client.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/transports/obex_client.c Fri Apr 3 21:39:52 2009 (r1031) @@ -56,7 +56,7 @@ static SmlBool obex_cable_at( SmlTransportObexClientEnv *userdata, - char *cmd, + const char *cmd, char *rspbuf, int rspbuflen, int timeout, @@ -73,7 +73,7 @@ char *answer = NULL; char *answer_end = NULL; - unsigned int answer_size; + int answer_size; char tmpbuf[100] = {0,}; int actual; @@ -202,6 +202,8 @@ static int smlTransportObexClientCableDisconnect(obex_t *handle, gpointer ud) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p)", __func__, handle, ud); + SmlTransportObexClientEnv *userdata = (SmlTransportObexClientEnv *) ud; if (userdata->fd >= 0) { // Send a break to get out of OBEX-mode @@ -832,7 +834,7 @@ SmlTransportObexClientEnv *env = data; int fd = 0; SmlError *error = NULL; - int obex_intf_cnt; + unsigned int obex_intf_cnt; obex_interface_t *obex_intf; env->isDisconnected = FALSE; @@ -1185,9 +1187,9 @@ smlErrorDeref(&error); } -static void smlTransportObexClientSend(void *userdata, void *link, SmlTransportData *data, SmlError *error) +static void smlTransportObexClientSend(void *userdata, void *link_, SmlTransportData *data, SmlError *error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, userdata, link, data, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, userdata, link_, data, error); smlAssert(error || data); smlAssert(userdata); SmlTransportObexClientEnv *env = userdata; Modified: trunk/libsyncml/transports/obex_client_samsung.c ============================================================================== --- trunk/libsyncml/transports/obex_client_samsung.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/transports/obex_client_samsung.c Fri Apr 3 21:39:52 2009 (r1031) @@ -83,7 +83,7 @@ * repeat with 2.+3. */ env->at_command = g_strdup_printf("AT+SyncML=%i", g_list_length(env->datastores)); - int i; + unsigned int i; for(i = 0; i < g_list_length(env->datastores); i++) { char *tmp = g_strjoin("", env->at_command, "06", NULL); Modified: trunk/libsyncml/transports/obex_server.c ============================================================================== --- trunk/libsyncml/transports/obex_server.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/libsyncml/transports/obex_server.c Fri Apr 3 21:39:52 2009 (r1031) @@ -66,8 +66,8 @@ /* preserve the link and the transport for the disconnect event */ SmlTransport *tsp = linkenv->env->tsp; - SmlLink *link = linkenv->link; - smlLinkRef(link); + SmlLink *link_ = linkenv->link; + smlLinkRef(link_); /* the environment must be cleaned up before the event is sent */ smlLinkDeref(linkenv->link); @@ -76,11 +76,11 @@ if (tsp->context) g_main_context_unref(tsp->context); smlSafeFree((gpointer *)&linkenv); - link->link_data = NULL; + link_->link_data = NULL; /* send the event */ - smlTransportReceiveEvent(tsp, link, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); - smlLinkDeref(link); + smlTransportReceiveEvent(tsp, link_, SML_TRANSPORT_EVENT_DISCONNECT_DONE, NULL, NULL); + smlLinkDeref(link_); return FALSE; } @@ -480,7 +480,8 @@ * connections */ static gboolean _fd_prepare(GSource *source, gint *timeout_) { - /* There is not need to dispatch this too fast since + smlTrace(TRACE_INTERNAL, "%s(%p, %p)", __func__, source, timeout_); + /* There is no need to dispatch this too fast since * it does not influence the transmission of data, only * the connection */ *timeout_ = 50; Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Apr 3 21:38:13 2009 (r1030) +++ trunk/tools/syncml-ds-tool.c Fri Apr 3 21:39:52 2009 (r1031) @@ -239,7 +239,6 @@ GList *datastores = NULL; -SmlError *error = NULL; char *identifier = NULL; char *target = NULL; char *username = NULL; @@ -524,7 +523,7 @@ void *userdata, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s(%s: %s)", __func__, VA_STRING(source), VA_STRING(uid)); + smlTrace(TRACE_ENTRY, "%s(%p, %s, %d, %s, %p, %d, %p, %p)", __func__, dsObject, VA_STRING(source), type, VA_STRING(uid), data, size, userdata, error); char *absolute_uid = NULL; char *absolute_status = NULL; @@ -563,17 +562,17 @@ } /* cache that the remote device knows the uid */ if (datastore->remoteHash) { - g_hash_table_insert(datastore->remoteHash, g_strdup(absolute_uid), "1"); + g_hash_table_insert(datastore->remoteHash, g_strdup(absolute_uid), (char *)"1"); } /* the directory is checked by scanArguments */ - SmlBool write = FALSE; - if (!write && !g_file_test(absolute_uid, G_FILE_TEST_EXISTS)) - write = TRUE; - if (!write && sessionType == SML_SESSION_TYPE_CLIENT) - write = TRUE; - if (!write && !localWinsConflicts) - write = TRUE; - if (!write && + SmlBool doWrite = FALSE; + if (!doWrite && !g_file_test(absolute_uid, G_FILE_TEST_EXISTS)) + doWrite = TRUE; + if (!doWrite && sessionType == SML_SESSION_TYPE_CLIENT) + doWrite = TRUE; + if (!doWrite && !localWinsConflicts) + doWrite = TRUE; + if (!doWrite && g_file_test(absolute_status, G_FILE_TEST_EXISTS)) { if (datastore->slow) @@ -608,13 +607,13 @@ goto error; } if (status.st_mtime > fdata.st_mtime) - write = TRUE; + doWrite = TRUE; } } printf("\tConflicts were checked.\n"); /* write the change */ - if (write) { + if (doWrite) { if (type == SML_CHANGE_DELETE) { g_unlink(absolute_uid); printf("\tThe item was successfully deleted.\n"); @@ -663,6 +662,7 @@ void *userdata, SmlError **error) { + smlTrace(TRACE_INTERNAL, "%s(%p, %p, %p, %p)", dsObject, devinf, userdata, error); printf("Received device information.\n"); remoteDevinf = devinf; smlDevInfRef(remoteDevinf); @@ -676,7 +676,7 @@ void *userdata, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s - %s: %d", __func__, VA_STRING(source), type); + smlTrace(TRACE_ENTRY, "%s(%p, %s, %d, %p, %p)", __func__, dsObject, VA_STRING(source), type, userdata, error); /* find the appropriate datasoure */ SmlDsToolLocationType *datastore = NULL; GList *o = datastores; @@ -1433,7 +1433,7 @@ printf("Identifier (Source): %s \n", identifier); printf("Target: %s\n", target); printf("\nDatastores:\n"); - int i = 0; + unsigned int i = 0; for (i = 0; i < smlDevInfNumDataStores(remoteDevinf); i++) { const SmlDevInfDataStore *datastore = smlDevInfGetNthDataStore(remoteDevinf, i); printf("\tLocations: %s\n", smlDevInfDataStoreGetSourceRef(datastore)); |