From: <svn...@op...> - 2009-02-20 10:21:20
|
Author: bellmich Date: Fri Feb 20 11:22:12 2009 New Revision: 939 URL: http://libsyncml.opensync.org/changeset/939 Log: strcasestr is not supported on all platforms. It is a non-standard extension. Therefore it is replaced by g_ascii_strdown and strstr. Modified: trunk/libsyncml/data_sync_api/data_sync.c Modified: trunk/libsyncml/data_sync_api/data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.c Thu Feb 19 18:31:09 2009 (r938) +++ trunk/libsyncml/data_sync_api/data_sync.c Fri Feb 20 11:22:12 2009 (r939) @@ -254,6 +254,9 @@ smlTrace(TRACE_ENTRY, "%s(%p, %s, %s, %s, %p)", __func__, dsObject, VA_STRING(contentType), VA_STRING(target), VA_STRING(source), error); CHECK_ERROR_REF + char *lcCT = NULL; + char *lcSource = NULL; + SmlDataSyncDatastore *datastore = smlTryMalloc0(sizeof(SmlDataSyncDatastore), error); if (!datastore) goto error; @@ -271,7 +274,9 @@ if (dsObject->tspType == SML_TRANSPORT_OBEX_CLIENT) { - if (strstr(contentType, "vcard") && + lcCT = g_ascii_strdown(contentType, strlen(contentType)); + lcSource = g_ascii_strdown(source, strlen(source)); + if (strstr(lcCT, "vcard") && !smlTransportSetConfigOption( dsObject->tsp, SML_TRANSPORT_CONFIG_DATASTORE, @@ -280,9 +285,9 @@ { goto error; } - if (strstr(contentType, "calendar") && - ( strcasestr(source, "cal") || - strcasestr(source, "event") + if (strstr(lcCT, "calendar") && + ( strstr(lcSource, "cal") || + strstr(lcSource, "event") )&& !smlTransportSetConfigOption( dsObject->tsp, @@ -292,8 +297,8 @@ { goto error; } - if (strstr(contentType, "calendar") && - strcasestr(source, "todo") && + if (strstr(lcCT, "calendar") && + strstr(lcSource, "todo") && !smlTransportSetConfigOption( dsObject->tsp, SML_TRANSPORT_CONFIG_DATASTORE, @@ -302,7 +307,7 @@ { goto error; } - if (strstr(contentType, "text/plain") && + if (strstr(lcCT, "text/plain") && !smlTransportSetConfigOption( dsObject->tsp, SML_TRANSPORT_CONFIG_DATASTORE, @@ -311,6 +316,8 @@ { goto error; } + smlSafeCFree(&lcCT); + smlSafeCFree(&lcSource); } smlTrace(TRACE_EXIT, "%s - TRUE", __func__); @@ -318,6 +325,10 @@ error: if (datastore) smlSafeFree((gpointer *)&datastore); + if (lcCT) + smlSafeCFree(&lcCT); + if (lcSource) + smlSafeCFree(&lcSource); smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, smlErrorPrint(error)); return FALSE; } |