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-06-21 14:16:16
|
Author: marka Date: Sun Jun 21 16:16:08 2009 New Revision: 5675 URL: http://www.opensync.org/changeset/5675 Log: Fix build errors in the Swig wrappers due to recent API changes Modified: trunk/wrapper/opensync-format.i trunk/wrapper/opensync-group.i Modified: trunk/wrapper/opensync-format.i ============================================================================== --- trunk/wrapper/opensync-format.i Wed Jun 17 15:14:12 2009 (r5674) +++ trunk/wrapper/opensync-format.i Sun Jun 21 16:16:08 2009 (r5675) @@ -177,7 +177,9 @@ } void register_converter(FormatConverter *converter) { - osync_format_env_register_converter(self, converter); + Error *err = NULL; + osync_format_env_register_converter(self, converter, &err); + raise_exception_on_error(err); } FormatConverter *find_converter(ObjFormat *sourceformat, ObjFormat *targetformat) { Modified: trunk/wrapper/opensync-group.i ============================================================================== --- trunk/wrapper/opensync-group.i Wed Jun 17 15:14:12 2009 (r5674) +++ trunk/wrapper/opensync-group.i Sun Jun 21 16:16:08 2009 (r5675) @@ -74,7 +74,10 @@ } LockState lock() { - return osync_group_lock(self); + Error *err = NULL; + LockState lockState = osync_group_lock(self, &err); + raise_exception_on_error(err); + return lockState; } void unlock() { @@ -316,7 +319,9 @@ } void add_objformat(const char *objtype, const char *format) { - osync_member_add_objformat(self, objtype, format); + Error *err = NULL; + osync_member_add_objformat(self, objtype, format, &err); + raise_exception_on_error(err); } /* returns a list of strings */ |
From: <svn...@op...> - 2009-06-19 16:03:41
|
Author: bellmich Date: Fri Jun 19 18:03:33 2009 New Revision: 1102 URL: http://libsyncml.opensync.org/changeset/1102 Log: Fixed wrong g_object_unref call. Replaced a double unref (prop) with a forgotten unref (ctcap). Modified: trunk/tests/check_dev_inf_ctcap.c Modified: trunk/tests/check_dev_inf_ctcap.c ============================================================================== --- trunk/tests/check_dev_inf_ctcap.c Fri Jun 19 18:02:41 2009 (r1101) +++ trunk/tests/check_dev_inf_ctcap.c Fri Jun 19 18:03:33 2009 (r1102) @@ -223,7 +223,7 @@ g_object_unref(prop); prop = NULL; - g_object_unref(prop); + g_object_unref(ctcap); } END_TEST |
From: <svn...@op...> - 2009-06-19 16:02:53
|
Author: bellmich Date: Fri Jun 19 18:02:41 2009 New Revision: 1101 URL: http://libsyncml.opensync.org/changeset/1101 Log: added a missing g_type_init If GQuarks are used together with a delayed g_type_init then this causes memory leaks. Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.c Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.c Fri Jun 19 17:23:01 2009 (r1100) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.c Fri Jun 19 18:02:41 2009 (r1101) @@ -144,6 +144,8 @@ SmlDevInfCTCap* sml_dev_inf_ctcap_new (SmlDevInfContentType *ct, GError **error) { + g_type_init(); + if (ct == NULL) { *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "Every CTCap must have a content type."); return NULL; |
From: <svn...@op...> - 2009-06-19 15:23:14
|
Author: bellmich Date: Fri Jun 19 17:23:01 2009 New Revision: 1100 URL: http://libsyncml.opensync.org/changeset/1100 Log: added a small shell script which generates the GIR XML file Added: trunk/tools/syncml-gir-scanner.sh.cmake Modified: trunk/tools/CMakeLists.txt Modified: trunk/tools/CMakeLists.txt ============================================================================== --- trunk/tools/CMakeLists.txt Fri Jun 19 17:00:23 2009 (r1099) +++ trunk/tools/CMakeLists.txt Fri Jun 19 17:23:01 2009 (r1100) @@ -10,3 +10,5 @@ TARGET_LINK_LIBRARIES( syncml-ds-tool syncml ) INSTALL( TARGETS syncml-ds-tool DESTINATION ${LIBSYNCML_BIN_DIR} ) +CONFIGURE_FILE( "syncml-gir-scanner.sh.cmake" "${CMAKE_CURRENT_BINARY_DIR}/syncml-gir-scanner.sh" @ONLY) +INSTALL( PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/syncml-gir-scanner.sh" DESTINATION ${LIBSYNCML_BIN_DIR} ) Added: trunk/tools/syncml-gir-scanner.sh.cmake ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tools/syncml-gir-scanner.sh.cmake Fri Jun 19 17:23:01 2009 (r1100) @@ -0,0 +1,15 @@ +#!/bin/sh + +SML_HEADER="$SML_HEADER @LIBSYNCML_INCLUDE_DIR@/libsyncml/dev_inf_api/sml_dev_inf_content_type.h" +SML_HEADER="$SML_HEADER @LIBSYNCML_INCLUDE_DIR@/libsyncml/dev_inf_api/sml_dev_inf_prop_param.h" +SML_HEADER="$SML_HEADER @LIBSYNCML_INCLUDE_DIR@/libsyncml/dev_inf_api/sml_dev_inf_property.h" +SML_HEADER="$SML_HEADER @LIBSYNCML_INCLUDE_DIR@/libsyncml/dev_inf_api/sml_dev_inf_ctcap.h" + +g-ir-scanner \ + --namespace=Sml \ + --library=syncml \ + --add-include-path=/usr/share/gir \ + --include=GObject-2.0 --pkg=/usr/lib/pkgconfig/gobject-2.0.pc \ + -I@LIBSYNCML_INCLUDE_DIR@ \ + --no-libtool \ + $SML_HEADER |
From: <svn...@op...> - 2009-06-19 15:00:27
|
Author: bellmich Date: Fri Jun 19 17:00:23 2009 New Revision: 1099 URL: http://libsyncml.opensync.org/changeset/1099 Log: Two new functions were not tested until now: - sml_dev_inf_property_get_nth_param - sml_dev_inf_ctcap_get_nth_property Modified: trunk/tests/check_dev_inf_ctcap.c trunk/tests/check_dev_inf_property.c Modified: trunk/tests/check_dev_inf_ctcap.c ============================================================================== --- trunk/tests/check_dev_inf_ctcap.c Fri Jun 19 16:32:59 2009 (r1098) +++ trunk/tests/check_dev_inf_ctcap.c Fri Jun 19 17:00:23 2009 (r1099) @@ -200,9 +200,11 @@ SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, prop, &error) == TRUE, "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 1, NULL); + sml_fail_unless(sml_dev_inf_ctcap_get_nth_property(ctcap, 0) != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_get_nth_property(ctcap, 0) == prop, NULL); g_object_unref(prop); prop = NULL; - sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 1, NULL); sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, NULL, &error) == FALSE, "Empty properties must fail."); sml_fail_unless(error != NULL, "No GError set."); @@ -213,9 +215,13 @@ prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, prop, &error) == TRUE, "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 2, NULL); + sml_fail_unless(sml_dev_inf_ctcap_get_nth_property(ctcap, 0) != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_get_nth_property(ctcap, 0) != prop, NULL); + sml_fail_unless(sml_dev_inf_ctcap_get_nth_property(ctcap, 1) != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_get_nth_property(ctcap, 1) == prop, NULL); g_object_unref(prop); prop = NULL; - sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 2, NULL); g_object_unref(prop); } Modified: trunk/tests/check_dev_inf_property.c ============================================================================== --- trunk/tests/check_dev_inf_property.c Fri Jun 19 16:32:59 2009 (r1098) +++ trunk/tests/check_dev_inf_property.c Fri Jun 19 17:00:23 2009 (r1099) @@ -255,8 +255,10 @@ SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); sml_fail_unless(sml_dev_inf_property_add_param(prop, propParam, &error) == TRUE, "%s", error?error->message:"No GError set."); - g_object_unref(propParam); sml_fail_unless(sml_dev_inf_property_num_params(prop) == 1, NULL); + sml_fail_unless(sml_dev_inf_property_get_nth_param(prop, 0) != NULL, NULL); + sml_fail_unless(sml_dev_inf_property_get_nth_param(prop, 0) == propParam, NULL); + g_object_unref(propParam); sml_fail_unless(sml_dev_inf_property_add_param(prop, NULL, &error) == FALSE, "Empty parameters must fail.", NULL); sml_fail_unless(error != NULL, "No GError set.", NULL); @@ -267,8 +269,12 @@ propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); sml_fail_unless(sml_dev_inf_property_add_param(prop, propParam, &error) == TRUE, "%s", error?error->message:"No GError set."); - g_object_unref(propParam); sml_fail_unless(sml_dev_inf_property_num_params(prop) == 2, NULL); + sml_fail_unless(sml_dev_inf_property_get_nth_param(prop, 0) != NULL, NULL); + sml_fail_unless(sml_dev_inf_property_get_nth_param(prop, 0) != propParam, NULL); + sml_fail_unless(sml_dev_inf_property_get_nth_param(prop, 1) != NULL, NULL); + sml_fail_unless(sml_dev_inf_property_get_nth_param(prop, 1) == propParam, NULL); + g_object_unref(propParam); g_object_unref(prop); } |
From: <svn...@op...> - 2009-06-19 14:33:05
|
Author: bellmich Date: Fri Jun 19 16:32:59 2009 New Revision: 1098 URL: http://libsyncml.opensync.org/changeset/1098 Log: migrated SmlDevInfCTCap to GObject style Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.c trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.h trunk/tests/check_dev_inf_ctcap.c Modified: trunk/libsyncml/CMakeLists.txt trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_devinf.c trunk/libsyncml/sml_devinf.h trunk/libsyncml/syncml.h trunk/tests/CMakeLists.txt Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Fri Jun 19 12:59:56 2009 (r1097) +++ trunk/libsyncml/CMakeLists.txt Fri Jun 19 16:32:59 2009 (r1098) @@ -36,6 +36,7 @@ dev_inf_api/sml_dev_inf_content_type.c dev_inf_api/sml_dev_inf_prop_param.c dev_inf_api/sml_dev_inf_property.c + dev_inf_api/sml_dev_inf_ctcap.c ) IF ( ENABLE_OBEX ) @@ -99,6 +100,7 @@ dev_inf_api/sml_dev_inf_content_type.h dev_inf_api/sml_dev_inf_prop_param.h dev_inf_api/sml_dev_inf_property.h + dev_inf_api/sml_dev_inf_ctcap.h DESTINATION ${LIBSYNCML_INCLUDE_DIR}/libsyncml/dev_inf_api ) Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Fri Jun 19 12:59:56 2009 (r1097) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Fri Jun 19 16:32:59 2009 (r1098) @@ -32,22 +32,24 @@ smlAssert(ctcap); smlAssert(name); + GError *gerror = NULL; SmlDevInfProperty *prop = sml_dev_inf_property_new(); if (!prop) { smlErrorSet(error, SML_ERROR_GENERIC, "Cannot create new instance of SmlDevInfProperty - out of memory."); goto error; } - GError *gerror = NULL; - if (!sml_dev_inf_property_set_prop_name(prop, name, &gerror)) { - smlErrorSet(error, gerror->code, "%s", gerror->message); - g_error_free(gerror); + if (!sml_dev_inf_property_set_prop_name(prop, name, &gerror)) + goto error; + if (!sml_dev_inf_ctcap_add_property(ctcap, prop, &gerror)) goto error; - } - smlDevInfCTCapAddProperty(ctcap, prop); smlTrace(TRACE_EXIT, "%s", __func__); return prop; error: + if (gerror) { + smlErrorSet(error, gerror->code, "%s", gerror->message); + g_error_free(gerror); + } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); return NULL; } @@ -169,12 +171,15 @@ !strcmp(verct, "2.1")) { smlTrace(TRACE_INTERNAL, "%s: vCard 2.1 detected", __func__); - ctcap = smlDevInfNewCTCap(error); + + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD, "2.1", &gerror); + if (!ct) + goto error; + ctcap = sml_dev_inf_ctcap_new(ct, &gerror); + g_object_unref(ct); if (!ctcap) goto error; - smlDevInfCTCapSetCTType(ctcap, SML_ELEMENT_TEXT_VCARD); - smlDevInfCTCapSetVerCT(ctcap, "2.1"); _ADD_CTCAP_PROPERTY_BY_NAME("ADR") _ADD_PROPERTY_PARAM("TYPE") _ADD_PROP_PARAM_VAL_ENUM("HOME") @@ -285,12 +290,15 @@ // FIXME: this is no vCard 3.0 spec // FIXME: this is in terms of vCard 3.0 a bug smlTrace(TRACE_INTERNAL, "%s: vCard 3.0 detected", __func__); - ctcap = smlDevInfNewCTCap(error); + + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "3.0", &gerror); + if (!ct) + goto error; + ctcap = sml_dev_inf_ctcap_new(ct, &gerror); + g_object_unref(ct); if (!ctcap) goto error; - smlDevInfCTCapSetCTType(ctcap, SML_ELEMENT_TEXT_VCARD_30); - smlDevInfCTCapSetVerCT(ctcap, "3.0"); _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("BEGIN", "VCARD") _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("END", "VCARD") _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("VERSION", "3.0") @@ -329,12 +337,15 @@ !strcmp(verct, "1.0")) { smlTrace(TRACE_INTERNAL, "%s: vCalendar 1.0 detected", __func__); - ctcap = smlDevInfNewCTCap(error); + + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCAL, "1.0", &gerror); + if (!ct) + goto error; + ctcap = sml_dev_inf_ctcap_new(ct, &gerror); + g_object_unref(ct); if (!ctcap) goto error; - smlDevInfCTCapSetCTType(ctcap, SML_ELEMENT_TEXT_VCAL); - smlDevInfCTCapSetVerCT(ctcap, "1.0"); _ADD_CTCAP_PROPERTY_BY_NAME("AALARM") _ADD_CTCAP_PROPERTY_BY_NAME("ATTACH") _ADD_CTCAP_PROPERTY_BY_NAME("ATTENDEE") @@ -381,12 +392,15 @@ // FIXME: this is nearly a direct copy&paste from vCal // FIXME: this is a bug in terms of iCal smlTrace(TRACE_INTERNAL, "%s: iCalendar (vCalendar 2.0) detected", __func__); - ctcap = smlDevInfNewCTCap(error); + + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_ICAL, "2.0", &gerror); + if (!ct) + goto error; + ctcap = sml_dev_inf_ctcap_new(ct, &gerror); + g_object_unref(ct); if (!ctcap) goto error; - smlDevInfCTCapSetCTType(ctcap, SML_ELEMENT_TEXT_ICAL); - smlDevInfCTCapSetVerCT(ctcap, "2.0"); _ADD_CTCAP_PROPERTY_BY_NAME("AALARM") _ADD_CTCAP_PROPERTY_BY_NAME("ATTACH") _ADD_CTCAP_PROPERTY_BY_NAME("ATTENDEE") @@ -429,11 +443,15 @@ { /* trace the missing stuff and create a minimal CTCap */ smlTrace(TRACE_INTERNAL, "%s: unknown content type - %s %s", __func__, VA_STRING(cttype), VA_STRING(verct)); - ctcap = smlDevInfNewCTCap(error); + + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(cttype, verct, &gerror); + if (!ct) + goto error; + ctcap = sml_dev_inf_ctcap_new(ct, &gerror); + g_object_unref(ct); if (!ctcap) goto error; - smlDevInfCTCapSetCTType(ctcap, cttype); - smlDevInfCTCapSetVerCT(ctcap, verct); + smlDevInfAppendCTCap(devinf, ctcap); } Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.c Fri Jun 19 16:32:59 2009 (r1098) @@ -0,0 +1,249 @@ +/* sml_dev_inf_ctcap.c + * + * 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 Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include "sml_dev_inf_ctcap.h" +#include <libsyncml/syncml.h> + +G_DEFINE_TYPE (SmlDevInfCTCap, sml_dev_inf_ctcap, G_TYPE_OBJECT) + +enum +{ + PROP_0, + PROP_CONTENT_TYPE, + PROP_PROPERTIES +}; + +struct _SmlDevInfCTCapPrivate +{ + SmlDevInfContentType* content_type; + GList* properties; +}; + +static void +sml_dev_inf_ctcap_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_CONTENT_TYPE: + g_value_set_object (value, SML_DEV_INF_CTCAP (object)->priv->content_type); + break; + case PROP_PROPERTIES: + g_value_set_pointer (value, SML_DEV_INF_CTCAP (object)->priv->properties); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +sml_dev_inf_ctcap_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_CONTENT_TYPE: + if (SML_DEV_INF_CTCAP (object)->priv->content_type) + g_object_unref (SML_DEV_INF_CTCAP (object)->priv->content_type); + g_object_ref(SML_DEV_INF_CONTENT_TYPE (value)); + break; + SML_DEV_INF_CTCAP (object)->priv->content_type = SML_DEV_INF_CONTENT_TYPE (value); + break; + case PROP_PROPERTIES: + SML_DEV_INF_CTCAP (object)->priv->properties = (GList *) g_value_get_pointer(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +sml_dev_inf_ctcap_finalize (GObject *object) +{ + SmlDevInfCTCap *self = SML_DEV_INF_CTCAP (object); + g_object_unref(self->priv->content_type); + while(self->priv->properties) { + SmlDevInfProperty *prop = self->priv->properties->data; + self->priv->properties = g_list_remove(self->priv->properties, prop); + g_object_unref(prop); + } + G_OBJECT_CLASS (sml_dev_inf_ctcap_parent_class)->finalize (object); +} + +static void +sml_dev_inf_ctcap_class_init (SmlDevInfCTCapClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (SmlDevInfCTCapPrivate)); + + object_class->get_property = sml_dev_inf_ctcap_get_property; + object_class->set_property = sml_dev_inf_ctcap_set_property; + object_class->finalize = sml_dev_inf_ctcap_finalize; + + /** + * SmlDevInfCTCap:ContentType: + * + * The The versioned content type of the content type capabilities property. + */ + g_object_class_install_property (object_class, + PROP_CONTENT_TYPE, + g_param_spec_object ("ContentType", + "", + "The versioned content type of the content type capabilities", + G_TYPE_OBJECT, + G_PARAM_READWRITE)); + /** + * SmlDevInfCTCap:Properties: + * + * The A list of SmlDevInfProperty objects property. + */ + g_object_class_install_property (object_class, + PROP_PROPERTIES, + g_param_spec_pointer ("Properties", + "Properties", + "A list of SmlDevInfProperty objects", + G_PARAM_PRIVATE)); + +} + +static void +sml_dev_inf_ctcap_init (SmlDevInfCTCap *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + SML_TYPE_DEV_INF_CTCAP, + SmlDevInfCTCapPrivate); +} + +/** + * sml_dev_inf_ctcap_new: + * + * Creates a new instance of #SmlDevInfCTCap. + * + * Return value: the newly created #SmlDevInfCTCap instance + */ +SmlDevInfCTCap* +sml_dev_inf_ctcap_new (SmlDevInfContentType *ct, GError **error) +{ + if (ct == NULL) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "Every CTCap must have a content type."); + return NULL; + } + SmlDevInfCTCap *self = g_object_new (SML_TYPE_DEV_INF_CTCAP, NULL); + g_object_ref(ct); + self->priv->content_type = ct; + return self; +} + +/** + * sml_dev_inf_ctcap_get_content_type: + * @self: A #SmlDevInfCTCap + * + * Gets the property. + * + * Return value: + */ +SmlDevInfContentType* +sml_dev_inf_ctcap_get_content_type (SmlDevInfCTCap *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CTCAP (self), NULL); + return self->priv->content_type; +} + +/** + * sml_dev_inf_ctcap_set_content_type: + * @self: A #SmlDevInfCTCap + * @contenttype: + * + * Sets the property. + */ +gboolean +sml_dev_inf_ctcap_set_content_type (SmlDevInfCTCap *self, + SmlDevInfContentType *content_type, + GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CTCAP (self), FALSE); + + if (content_type == NULL) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The content type cannot be deleted only replace is allowed."); + return FALSE; + } + g_return_val_if_fail (SML_IS_DEV_INF_CONTENT_TYPE (content_type), FALSE); + + if (self->priv->content_type) + g_object_unref (self->priv->content_type); + self->priv->content_type = g_object_ref (content_type); + + return TRUE; +} + +/** + * sml_dev_inf_ctcap_num_properties: + * @self: A #SmlDevInfCTCap + * + * + */ +gsize +sml_dev_inf_ctcap_num_properties (SmlDevInfCTCap *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CTCAP (self), 0); + return g_list_length(self->priv->properties); +} + +/** + * sml_dev_inf_ctcap_get_nth_property: + * @self: A #SmlDevInfCTCap + * + * + */ +SmlDevInfProperty* +sml_dev_inf_ctcap_get_nth_property (SmlDevInfCTCap *self, + gsize n) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CTCAP (self), NULL); + return (SmlDevInfProperty *) g_list_nth_data(self->priv->properties, n); +} + +/** + * sml_dev_inf_ctcap_add_property: + * @self: A #SmlDevInfCTCap + * + * + */ +gboolean +sml_dev_inf_ctcap_add_property (SmlDevInfCTCap *self, + SmlDevInfProperty *property, + GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CTCAP (self), FALSE); + if (!property) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The SmlDevInfProperty object is missing."); + return FALSE; + } + g_object_ref(property); + self->priv->properties = g_list_append(self->priv->properties, property); + if (!self->priv->properties) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "Cannot add Property to Property list of CTCap."); + return FALSE; + } + return TRUE; +} Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_ctcap.h Fri Jun 19 16:32:59 2009 (r1098) @@ -0,0 +1,65 @@ +/* sml_dev_inf_ctcap.h + * + * 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 Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef __SML_DEV_INF_CTCAP_H__ +#define __SML_DEV_INF_CTCAP_H__ + +#include <glib-object.h> +#include <libsyncml/dev_inf_api/sml_dev_inf_content_type.h> +#include <libsyncml/dev_inf_api/sml_dev_inf_property.h> + +G_BEGIN_DECLS + +#define SML_TYPE_DEV_INF_CTCAP (sml_dev_inf_ctcap_get_type()) +#define SML_DEV_INF_CTCAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SML_TYPE_DEV_INF_CTCAP, SmlDevInfCTCap)) +#define SML_DEV_INF_CTCAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SML_TYPE_DEV_INF_CTCAP, SmlDevInfCTCapClass)) +#define SML_IS_DEV_INF_CTCAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SML_TYPE_DEV_INF_CTCAP)) +#define SML_IS_DEV_INF_CTCAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SML_TYPE_DEV_INF_CTCAP)) +#define SML_DEV_INF_CTCAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SML_TYPE_DEV_INF_CTCAP, SmlDevInfCTCapClass)) + +typedef struct _SmlDevInfCTCap SmlDevInfCTCap; +typedef struct _SmlDevInfCTCapClass SmlDevInfCTCapClass; +typedef struct _SmlDevInfCTCapPrivate SmlDevInfCTCapPrivate; + +struct _SmlDevInfCTCap +{ + GObject parent; + + /*< private >*/ + SmlDevInfCTCapPrivate *priv; +}; + +struct _SmlDevInfCTCapClass +{ + GObjectClass parent_class; + +}; + +GType sml_dev_inf_ctcap_get_type (void); +SmlDevInfCTCap* sml_dev_inf_ctcap_new (SmlDevInfContentType *contenttype, GError **error); +SmlDevInfContentType* sml_dev_inf_ctcap_get_content_type (SmlDevInfCTCap *self); +gboolean sml_dev_inf_ctcap_set_content_type (SmlDevInfCTCap *self, SmlDevInfContentType *content_type, GError **error); +gsize sml_dev_inf_ctcap_num_properties (SmlDevInfCTCap *self); +SmlDevInfProperty* sml_dev_inf_ctcap_get_nth_property (SmlDevInfCTCap *self, gsize n); +gboolean sml_dev_inf_ctcap_add_property (SmlDevInfCTCap *self, SmlDevInfProperty *property, GError **error); + +G_END_DECLS + +#endif /* __SML_DEV_INF_CTCAP_H__ */ Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Fri Jun 19 12:59:56 2009 (r1097) +++ trunk/libsyncml/parser/sml_xml_assm.c Fri Jun 19 16:32:59 2009 (r1098) @@ -2046,7 +2046,7 @@ static SmlBool _smlXmlDevInfDataStoreAssembleCTCap( SmlXmlAssembler *assm, - const SmlDevInfCTCap *ctcap, + SmlDevInfCTCap *ctcap, SmlBool flat, SmlError **error) { @@ -2063,7 +2063,7 @@ } // add CTType - if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_CTTYPE, sml_dev_inf_content_type_get_cttype(ctcap->ct), error)) + if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_CTTYPE, sml_dev_inf_content_type_get_cttype(sml_dev_inf_ctcap_get_content_type(ctcap)), error)) goto error; // add VerCT @@ -2071,15 +2071,16 @@ // because this info is in the VERSION property. if (!flat) { - if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VERCT, sml_dev_inf_content_type_get_verct(ctcap->ct), error)) + if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VERCT, sml_dev_inf_content_type_get_verct(sml_dev_inf_ctcap_get_content_type(ctcap)), error)) goto error; } // add properties - GList *hprop = NULL; - for (hprop = ctcap->properties; hprop; hprop = hprop->next) + gsize ctcapPropCount = sml_dev_inf_ctcap_num_properties(ctcap); + gsize n; + for (n = 0; n < ctcapPropCount; n++) { - SmlDevInfProperty *property = hprop->data; + SmlDevInfProperty *property = sml_dev_inf_ctcap_get_nth_property(ctcap, n); if (!flat) { @@ -2334,7 +2335,7 @@ GList *hct = NULL; for (hct = contentTypes; hct; hct = hct->next) { SmlDevInfContentType *ct = hct->data; - const SmlDevInfCTCap *ctcap = smlDevInfGetCTCap(devinf, ct); + SmlDevInfCTCap *ctcap = smlDevInfGetCTCap(devinf, ct); if (ctcap != NULL) { // we found a matching CTCap Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Fri Jun 19 12:59:56 2009 (r1097) +++ trunk/libsyncml/parser/sml_xml_parse.c Fri Jun 19 16:32:59 2009 (r1098) @@ -2659,6 +2659,7 @@ goto error; } + SmlDevInfContentType *ct = NULL; SmlDevInfCTCap *ctcap = NULL; SmlDevInfProperty *property = NULL; SmlDevInfPropParam *param = NULL; @@ -2707,21 +2708,27 @@ goto error; param = NULL; } - smlDevInfCTCapAddProperty(ctcap, property); + if (!sml_dev_inf_ctcap_add_property(ctcap, property, &gerror)) + goto error; property = NULL; } smlDevInfAppendCTCap(devinf, ctcap); ctcap = NULL; + g_object_unref(ct); + ct = NULL; } - ctcap = smlDevInfNewCTCap(error); + ct = sml_dev_inf_content_type_new(value, NULL, &gerror); + if (!ct) + goto error; + ctcap = sml_dev_inf_ctcap_new(ct, &gerror); if (!ctcap) goto error; - smlDevInfCTCapSetCTType(ctcap, value); break; case SML_DEVINF_CTCAP_VERCT: - if (ctcap == NULL) + if (ct == NULL) + goto error; + if (!sml_dev_inf_content_type_set_verct(ct, value, &gerror)) goto error; - smlDevInfCTCapSetVerCT(ctcap, value); break; case SML_DEVINF_CTCAP_PROPNAME: // PropName => new property @@ -2735,7 +2742,8 @@ goto error; param = NULL; } - smlDevInfCTCapAddProperty(ctcap, property); + if (!sml_dev_inf_ctcap_add_property(ctcap, property, &gerror)) + goto error; property = NULL; } property = sml_dev_inf_property_new(); @@ -2829,10 +2837,12 @@ } if (param != NULL && !sml_dev_inf_property_add_param(property, param, &gerror)) goto error; - if (property != NULL) - smlDevInfCTCapAddProperty(ctcap, property); + if (property != NULL && !sml_dev_inf_ctcap_add_property(ctcap, property, &gerror)) + goto error; if (ctcap != NULL) smlDevInfAppendCTCap(devinf, ctcap); + if (ct != NULL) + g_object_unref(ct); smlTrace(TRACE_EXIT, "%s", __func__); return TRUE; @@ -3060,6 +3070,11 @@ smlAssert(parser); smlAssert(devinf); + GError *gerror = NULL; + SmlDevInfContentType *ct = NULL; + SmlDevInfProperty *property = NULL; + SmlDevInfCTCap *ctcap = NULL; + /* This function was designed to parse one CTCap section */ /* which can include only one CTCap definition */ @@ -3068,11 +3083,13 @@ goto error; } - SmlDevInfCTCap *ctcap = smlDevInfNewCTCap(error); + ct = sml_dev_inf_content_type_new(NULL, NULL, &gerror); + if (!ct) + goto error; + ctcap = sml_dev_inf_ctcap_new(ct, &gerror); if (!ctcap) goto error; - SmlDevInfProperty *property; char *value = NULL; while (1) { @@ -3108,16 +3125,21 @@ switch(type) { case SML_DEVINF_CTCAP_CTTYPE: - smlDevInfCTCapSetCTType(ctcap, value); + if (!sml_dev_inf_content_type_set_cttype(ct, value, &gerror)) + goto error; break; case SML_DEVINF_CTCAP_VERCT: - smlDevInfCTCapSetVerCT(ctcap, value); + if (!sml_dev_inf_content_type_set_verct(ct, value, &gerror)) + goto error; break; case SML_DEVINF_CTCAP_PROPERTY: property = _smlXmlDevInfDataStoreParseCTCap12Property(parser, error); if (!property) goto error; - smlDevInfCTCapAddProperty(ctcap, property); + if (!sml_dev_inf_ctcap_add_property(ctcap, property, &gerror)) + goto error; + g_object_unref(property); + property = NULL; break; default: smlErrorSet(error, SML_ERROR_GENERIC, "Unknown CTCapType for CTCap: %s", elem_name); @@ -3130,12 +3152,23 @@ goto error; } } + g_object_unref(ct); smlDevInfAppendCTCap(devinf, ctcap); smlTrace(TRACE_EXIT, "%s", __func__); return TRUE; error: + if (gerror) { + smlErrorSet(error, gerror->code, "%s", gerror->message); + g_error_free(gerror); + } + if (ct) + g_object_unref(ct); + if (ctcap) + g_object_unref(ctcap); + if (property) + g_object_unref(ctcap); smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); if (value != NULL) smlSafeCFree(&value); Modified: trunk/libsyncml/sml_devinf.c ============================================================================== --- trunk/libsyncml/sml_devinf.c Fri Jun 19 12:59:56 2009 (r1097) +++ trunk/libsyncml/sml_devinf.c Fri Jun 19 16:32:59 2009 (r1098) @@ -146,18 +146,7 @@ while (devinf->ctcaps) { SmlDevInfCTCap *ctcap = devinf->ctcaps->data; devinf->ctcaps = g_list_remove(devinf->ctcaps, ctcap); - //smlSafeCFree(&(ctcap->ct->cttype)); - //if (ctcap->ct->verct) - // smlSafeCFree(&(ctcap->ct->verct)); - //smlSafeFree((gpointer *)&(ctcap->ct)); - g_object_unref(ctcap->ct); - while (ctcap->properties) { - SmlDevInfProperty *prop = ctcap->properties->data; - ctcap->properties = g_list_remove(ctcap->properties, prop); - g_object_unref(prop); - } - /* don't use ctcap here because the list must be cleaned up */ - smlSafeFree((gpointer *)&ctcap); + g_object_unref(ctcap); } smlSafeFree((gpointer *)&devinf); @@ -805,97 +794,6 @@ return NULL; } -/* CTCap stuff */ - -SmlDevInfCTCap *smlDevInfNewCTCap(SmlError **error) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, error); - CHECK_ERROR_REF - - SmlDevInfCTCap *ctcap = smlTryMalloc0(sizeof(SmlDevInfCTCap), error); - if (!ctcap) { - smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); - return NULL; - } - - GError *gerror = NULL; - ctcap->ct = sml_dev_inf_content_type_new(NULL, NULL, &gerror); - if (!ctcap->ct) { - smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, gerror->message); - smlErrorSet(error, gerror->code, "%s", gerror->message); - g_error_free(gerror); - smlSafeFree((gpointer *)&ctcap); - return NULL; - } - ctcap->properties = NULL; - - smlTrace(TRACE_EXIT, "%s", __func__); - return ctcap; -} - -void smlDevInfCTCapSetCTType( - SmlDevInfCTCap *ctcap, - const char *cttype) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, ctcap, VA_STRING(cttype)); - smlAssert(ctcap); - smlAssert(cttype); - - GError *gerror = NULL; - sml_dev_inf_content_type_set_cttype(ctcap->ct, cttype, &gerror); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfCTCapSetVerCT( - SmlDevInfCTCap *ctcap, - const char *verct) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, ctcap, VA_STRING(verct)); - smlAssert(ctcap); - smlAssert(verct); - - GError *gerror = NULL; - sml_dev_inf_content_type_set_verct(ctcap->ct, verct, &gerror); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -char *smlDevInfCTCapGetCTType(const SmlDevInfCTCap *ctcap) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, ctcap); - smlAssert(ctcap); - char *cttype; - - cttype = g_strdup(sml_dev_inf_content_type_get_cttype(ctcap->ct)); - - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(cttype)); - return cttype; -} - -char *smlDevInfCTCapGetVerCT(const SmlDevInfCTCap *ctcap) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, ctcap); - smlAssert(ctcap); - char *verct; - - verct = g_strdup(sml_dev_inf_content_type_get_verct(ctcap->ct)); - - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(verct)); - return verct; -} - -void smlDevInfCTCapAddProperty( - SmlDevInfCTCap *ctcap, - SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, ctcap, property); - smlAssert(ctcap); - smlAssert(property); - ctcap->properties = g_list_append(ctcap->properties, property); - smlTrace(TRACE_EXIT, "%s", __func__); -} - void smlDevInfAppendCTCap(SmlDevInf *devinf, SmlDevInfCTCap *ctcap) { smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, devinf, ctcap); @@ -921,9 +819,9 @@ SmlDevInfCTCap *ctcap = h->data; // check that CTType matches if (!strcmp(sml_dev_inf_content_type_get_cttype(ct), - sml_dev_inf_content_type_get_cttype(ctcap->ct)) && + sml_dev_inf_content_type_get_cttype(sml_dev_inf_ctcap_get_content_type(ctcap))) && !strcmp(sml_dev_inf_content_type_get_verct(ct), - sml_dev_inf_content_type_get_verct(ctcap->ct))) + sml_dev_inf_content_type_get_verct(sml_dev_inf_ctcap_get_content_type(ctcap)))) { smlTrace(TRACE_EXIT, "%s - succeeded", __func__); return ctcap; @@ -953,26 +851,6 @@ return ctcap; } -unsigned int smlDevInfCTCapNumProperties(const SmlDevInfCTCap *ctcap) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, ctcap); - smlAssert(ctcap); - unsigned int num = g_list_length(ctcap->properties); - smlTrace(TRACE_EXIT, "%s - %d", __func__, num); - return num; -} - -const SmlDevInfProperty *smlDevInfCTCapGetNthProperty( - const SmlDevInfCTCap *ctcap, - unsigned int n) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %d)", __func__, ctcap, n); - smlAssert(ctcap); - SmlDevInfProperty *property = g_list_nth_data(ctcap->properties, n); - smlTrace(TRACE_EXIT, "%s - %p", __func__, property); - return property; -} - SmlDevInfSyncCap smlDevInfSyncCapConvert(unsigned int id, SmlError **error) { smlTrace(TRACE_ENTRY, "%s(%u, %p)", __func__, id, error); Modified: trunk/libsyncml/sml_devinf.h ============================================================================== --- trunk/libsyncml/sml_devinf.h Fri Jun 19 12:59:56 2009 (r1097) +++ trunk/libsyncml/sml_devinf.h Fri Jun 19 16:32:59 2009 (r1098) @@ -33,6 +33,7 @@ #include <libsyncml/dev_inf_api/sml_dev_inf_content_type.h> #include <libsyncml/dev_inf_api/sml_dev_inf_prop_param.h> #include <libsyncml/dev_inf_api/sml_dev_inf_property.h> +#include <libsyncml/dev_inf_api/sml_dev_inf_ctcap.h> SmlDevInfDevTyp smlDevInfDevTypeFromString(const char *name, SmlError **error); const char *smlDevInfDevTypeToString(SmlDevInfDevTyp type, SmlError **error); @@ -112,20 +113,8 @@ /* so we can generate SyncML 1.0, 1.1 and 1.2 devinf from this structure */ /* the CTCap will be assigned to a datastore if CTType and VerCT match */ -/* CTCap stuff */ +/* DevInf */ -SmlDevInfCTCap *smlDevInfNewCTCap(SmlError **error); -void smlDevInfCTCapSetCTType( - SmlDevInfCTCap *ctcap, - const char *cttype); // REQUIRED => NOT NULL -void smlDevInfCTCapSetVerCT( - SmlDevInfCTCap *ctcap, - const char *verct); // REQUIRED => NOT NULL -char *smlDevInfCTCapGetCTType(const SmlDevInfCTCap *ctcap); -char *smlDevInfCTCapGetVerCT(const SmlDevInfCTCap *ctcap); -void smlDevInfCTCapAddProperty( - SmlDevInfCTCap *ctcap, - SmlDevInfProperty *property); void smlDevInfAppendCTCap(SmlDevInf *devinf, SmlDevInfCTCap *ctcap); const SmlDevInfCTCap *smlDevInfGetCTCap( @@ -135,10 +124,6 @@ const SmlDevInfCTCap *smlDevInfGetNthCTCap( const SmlDevInf *devinf, unsigned int n); -unsigned int smlDevInfCTCapNumProperties(const SmlDevInfCTCap *ctcap); -const SmlDevInfProperty *smlDevInfCTCapGetNthProperty( - const SmlDevInfCTCap *ctcap, - unsigned int n); #endif //_SML_DEVINF_H_ Modified: trunk/libsyncml/syncml.h ============================================================================== --- trunk/libsyncml/syncml.h Fri Jun 19 12:59:56 2009 (r1097) +++ trunk/libsyncml/syncml.h Fri Jun 19 16:32:59 2009 (r1098) @@ -78,7 +78,7 @@ typedef struct SmlDevInf SmlDevInf; typedef struct SmlDevInfDataStore SmlDevInfDataStore; //typedef struct SmlDevInfContentType SmlDevInfContentType; -typedef struct SmlDevInfCTCap SmlDevInfCTCap; +//typedef struct SmlDevInfCTCap SmlDevInfCTCap; //typedef struct SmlDevInfProperty SmlDevInfProperty; //typedef struct SmlDevInfPropParam SmlDevInfPropParam; typedef struct SmlNotification SmlNotification; Modified: trunk/tests/CMakeLists.txt ============================================================================== --- trunk/tests/CMakeLists.txt Fri Jun 19 12:59:56 2009 (r1097) +++ trunk/tests/CMakeLists.txt Fri Jun 19 16:32:59 2009 (r1098) @@ -287,6 +287,15 @@ SML_ADD_TESTCASE( dev_inf_property_references ) SML_END_TEST() + SML_START_TEST( "DevInfCTCap" dev_inf_ctcap check_dev_inf_ctcap.c ${TEST_TARGET_LIBRARIES} ) + SML_ADD_TESTCASE( dev_inf_ctcap_create ) + SML_ADD_TESTCASE( dev_inf_ctcap_empty_set ) + SML_ADD_TESTCASE( dev_inf_ctcap_empty_get ) + SML_ADD_TESTCASE( dev_inf_ctcap_filled_set ) + SML_ADD_TESTCASE( dev_inf_ctcap_filled_get ) + SML_ADD_TESTCASE( dev_inf_ctcap_references ) + SML_END_TEST() + SML_START_TEST( "Sync" sync check_sync.c ${TEST_TARGET_LIBRARIES} ) IF ( ENABLE_HTTP ) SML_ADD_TESTCASE( sync_multi_start ) Added: trunk/tests/check_dev_inf_ctcap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/check_dev_inf_ctcap.c Fri Jun 19 16:32:59 2009 (r1098) @@ -0,0 +1,249 @@ +/* + * 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 "tests/support.h" + +#include <libsyncml/dev_inf_api/sml_dev_inf_ctcap.h> + +START_TEST (dev_inf_ctcap_create) +{ + GError *error = NULL; + + SmlDevInfCTCap *ctcap = sml_dev_inf_ctcap_new(NULL, &error); + sml_fail_unless(ctcap == NULL, NULL); + sml_fail_unless(error != NULL, "No GError set."); + g_error_free(error); + error = NULL; + + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + + ctcap = sml_dev_inf_ctcap_new(ct, &error); + sml_fail_unless(ctcap != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + g_object_unref(ct); + g_object_unref(ctcap); +} +END_TEST + +START_TEST (dev_inf_ctcap_empty_set) +{ + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + SmlDevInfCTCap *ctcap = sml_dev_inf_ctcap_new(ct, &error); + sml_fail_unless(ctcap != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + g_object_unref(ct); + ct = NULL; + + /* test enforcement of content type */ + + sml_fail_unless(sml_dev_inf_ctcap_set_content_type(ctcap, NULL, &error) == FALSE, NULL); + sml_fail_unless(error != NULL, "No GError set."); + g_error_free(error); + error = NULL; + + /* property checks must be a little bit more careful */ + + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, NULL, &error) == FALSE, "Empty properties must fail."); + sml_fail_unless(error != NULL, "No GError set."); + g_error_free(error); + error = NULL; + + SmlDevInfProperty *prop = sml_dev_inf_property_new(); + sml_fail_unless(prop != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, prop, &error) == TRUE, "%s", error?error->message:"No GError set."); + g_object_unref(prop); + prop = NULL; + + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, NULL, &error) == FALSE, "Empty properties must fail."); + sml_fail_unless(error != NULL, "No GError set."); + g_error_free(error); + error = NULL; + + g_object_unref(ctcap); +} +END_TEST + +START_TEST (dev_inf_ctcap_empty_get) +{ + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + SmlDevInfCTCap *ctcap = sml_dev_inf_ctcap_new(ct, &error); + sml_fail_unless(ctcap != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + + /* test enforcement of content type */ + + sml_fail_unless(sml_dev_inf_ctcap_set_content_type(ctcap, NULL, &error) == FALSE, NULL); + sml_fail_unless(error != NULL, "No GError set."); + g_error_free(error); + error = NULL; + sml_fail_unless(sml_dev_inf_ctcap_get_content_type(ctcap) == ct, "The original content type was replaced."); + g_object_unref(ct); + ct = NULL; + + /* property checks must be a little bit more careful */ + + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, NULL, &error) == FALSE, "Empty properties must fail."); + sml_fail_unless(error != NULL, "No GError set."); + g_error_free(error); + error = NULL; + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 0, NULL); + + SmlDevInfProperty *prop = sml_dev_inf_property_new(); + sml_fail_unless(prop != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, prop, &error) == TRUE, "%s", error?error->message:"No GError set."); + g_object_unref(prop); + prop = NULL; + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 1, NULL); + + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, NULL, &error) == FALSE, "Empty properties must fail."); + sml_fail_unless(error != NULL, "No GError set."); + g_error_free(error); + error = NULL; + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 1, NULL); + + g_object_unref(ctcap); +} +END_TEST + +START_TEST (dev_inf_ctcap_filled_set) +{ + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + SmlDevInfCTCap *ctcap = sml_dev_inf_ctcap_new(ct, &error); + sml_fail_unless(ctcap != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + g_object_unref(ct); + ct = NULL; + + /* content type related tests */ + + ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_ctcap_set_content_type(ctcap, ct, &error), "%s", error?error->message:"No GError set."); + + g_object_unref(ct); + ct = NULL; + + /* property related tests */ + + SmlDevInfProperty *prop = sml_dev_inf_property_new(); + sml_fail_unless(prop != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, prop, &error) == TRUE, "%s", error?error->message:"No GError set."); + g_object_unref(prop); + prop = NULL; + + prop = sml_dev_inf_property_new(); + sml_fail_unless(prop != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, prop, &error) == TRUE, "%s", error?error->message:"No GError set."); + g_object_unref(prop); + prop = NULL; + + g_object_unref(ctcap); +} +END_TEST + +START_TEST (dev_inf_ctcap_filled_get) +{ + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + SmlDevInfCTCap *ctcap = sml_dev_inf_ctcap_new(ct, &error); + sml_fail_unless(ctcap != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + + /* content type related tests */ + + sml_fail_unless(sml_dev_inf_ctcap_get_content_type(ctcap) == ct, "The original content type is missing."); + g_object_unref(ct); + ct = NULL; + + ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_ctcap_set_content_type(ctcap, ct, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_ctcap_get_content_type(ctcap) != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_get_content_type(ctcap) == ct, NULL); + g_object_unref(ct); + ct = NULL; + + /* property related tests */ + + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 0, NULL); + + SmlDevInfProperty *prop = sml_dev_inf_property_new(); + sml_fail_unless(prop != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, prop, &error) == TRUE, "%s", error?error->message:"No GError set."); + g_object_unref(prop); + prop = NULL; + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 1, NULL); + + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, NULL, &error) == FALSE, "Empty properties must fail."); + sml_fail_unless(error != NULL, "No GError set."); + g_error_free(error); + error = NULL; + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 1, NULL); + + prop = sml_dev_inf_property_new(); + sml_fail_unless(prop != NULL, NULL); + sml_fail_unless(sml_dev_inf_ctcap_add_property(ctcap, prop, &error) == TRUE, "%s", error?error->message:"No GError set."); + g_object_unref(prop); + prop = NULL; + sml_fail_unless(sml_dev_inf_ctcap_num_properties(ctcap) == 2, NULL); + + g_object_unref(prop); +} +END_TEST + +START_TEST (dev_inf_ctcap_references) +{ + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + SmlDevInfCTCap *ctcap = sml_dev_inf_ctcap_new(ct, &error); + sml_fail_unless(ctcap != NULL, "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, "%s", error?error->message:"No GError set."); + g_object_unref(ct); + ct = NULL; + + g_object_ref(ctcap); + + sml_fail_unless(sml_dev_inf_ctcap_get_content_type(ctcap) != NULL, "The content type was not set."); + + g_object_unref(ctcap); + + sml_fail_unless(sml_dev_inf_ctcap_get_content_type(ctcap) != NULL, "The content type is already cleaned up."); + + g_object_unref(ctcap); +} +END_TEST + +@SML_TESTCASE_CODE@ + |
From: <svn...@op...> - 2009-06-19 11:00:07
|
Author: bellmich Date: Fri Jun 19 12:59:56 2009 New Revision: 1097 URL: http://libsyncml.opensync.org/changeset/1097 Log: content type must have a type and version in SyncML Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Fri Jun 19 12:05:52 2009 (r1096) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Fri Jun 19 12:59:56 2009 (r1097) @@ -19,6 +19,7 @@ */ #include "sml_dev_inf_content_type.h" +#include <libsyncml/syncml.h> G_DEFINE_TYPE (SmlDevInfContentType, sml_dev_inf_content_type, G_TYPE_OBJECT) @@ -98,7 +99,7 @@ g_param_spec_string ("CTType", "", "", - NULL, + "text/plain", G_PARAM_READABLE)); /** * SmlDevInfContentType:VerCT: @@ -110,7 +111,7 @@ g_param_spec_string ("VerCT", "", "", - NULL, + "1.0", G_PARAM_READABLE)); } @@ -136,9 +137,14 @@ GError **error) { g_type_init(); + SmlDevInfContentType* self = g_object_new (SML_TYPE_DEV_INF_CONTENT_TYPE, NULL); - self->priv->cttype = g_strdup(cttype); - self->priv->verct = g_strdup(verct); + if (cttype != NULL) { + self->priv->cttype = g_strdup(cttype); + } + if (verct != NULL) { + self->priv->verct = g_strdup(verct); + } return self; } @@ -186,6 +192,10 @@ sml_dev_inf_content_type_set_cttype (SmlDevInfContentType *self, const gchar* cttype, GError **error) { g_return_val_if_fail (SML_IS_DEV_INF_CONTENT_TYPE (self), FALSE); + if (cttype == NULL) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The CTType must always be set for a SmlDevInfContentType object."); + return FALSE; + } if (self->priv->cttype) { g_free(self->priv->cttype); self->priv->cttype = NULL; @@ -208,6 +218,10 @@ sml_dev_inf_content_type_set_verct (SmlDevInfContentType *self, const gchar* verct, GError **error) { g_return_val_if_fail (SML_IS_DEV_INF_CONTENT_TYPE (self), FALSE); + if (verct == NULL) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The VerCT must always be set for a SmlDevInfContentType object."); + return FALSE; + } if (self->priv->verct) { g_free(self->priv->verct); self->priv->verct = NULL; |
From: <svn...@op...> - 2009-06-19 10:05:57
|
Author: bellmich Date: Fri Jun 19 12:05:52 2009 New Revision: 1096 URL: http://libsyncml.opensync.org/changeset/1096 Log: fixed several flaws introduced during the GObject migration - g_type_init should be called internally - GError->message must not be used as format for printf functions - wrong error check (sml_dev_inf_function instead of !sml_dev_inf_function) - the variable length was overwritten in sml_xml_assm.c - a for loop declaration was followed by a semicolon - GError was received but not copied to SmlError - GError->code was ignored (not copied to SmlError->code) Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_devinf.c trunk/tests/check_dev_inf_content_type.c trunk/tests/check_dev_inf_prop_param.c trunk/tests/check_dev_inf_property.c Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Fri Jun 19 12:05:52 2009 (r1096) @@ -39,7 +39,7 @@ } GError *gerror = NULL; if (!sml_dev_inf_property_set_prop_name(prop, name, &gerror)) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } @@ -75,7 +75,7 @@ return prop; error: if (gerror) { - smlErrorSet(error, gerror->code, gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); @@ -108,7 +108,7 @@ return param; error: if (gerror) { - smlErrorSet(error, gerror->code, gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); @@ -116,14 +116,14 @@ } #define _ADD_PROPERTY_VAL_ENUM(text) \ - if (sml_dev_inf_property_add_val_enum(prop, text, &gerror)) \ + if (!sml_dev_inf_property_add_val_enum(prop, text, &gerror)) \ goto error; #define _ADD_PROPERTY_PARAM(text) \ param = _add_property_param(prop, text, error); \ if (!param) \ goto error; #define _ADD_PROP_PARAM_VAL_ENUM(text) \ - if (sml_dev_inf_prop_param_add_val_enum(param, text, &gerror)) \ + if (!sml_dev_inf_prop_param_add_val_enum(param, text, &gerror)) \ goto error; #define _ADD_CTCAP_PROPERTY_BY_NAME(text) \ prop = _add_ctcap_property_by_name(ctcap, text, error); \ @@ -441,7 +441,7 @@ return TRUE; error: if (gerror) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); @@ -496,14 +496,14 @@ // because the most cellphones support it ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "3.0", &gerror); if (!ctype) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } smlDevInfDataStoreAddRx(ds, ctype); ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "3.0", &gerror); if (!ctype) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } @@ -519,14 +519,14 @@ { ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "2.1", &gerror); if (!ctype) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } smlDevInfDataStoreAddRx(ds, ctype); ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "2.1", &gerror); if (!ctype) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } @@ -542,14 +542,14 @@ { ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_ICAL, "2.0", &gerror); if (!ctype) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } smlDevInfDataStoreAddRx(ds, ctype); ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_ICAL, "2.0", &gerror); if (!ctype) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } @@ -565,14 +565,14 @@ { ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCAL, "1.0", &gerror); if (!ctype) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } smlDevInfDataStoreAddRx(ds, ctype); ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCAL, "1.0", &gerror); if (!ctype) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error; } Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Fri Jun 19 12:05:52 2009 (r1096) @@ -135,6 +135,7 @@ const gchar* verct, GError **error) { + g_type_init(); SmlDevInfContentType* self = g_object_new (SML_TYPE_DEV_INF_CONTENT_TYPE, NULL); self->priv->cttype = g_strdup(cttype); self->priv->verct = g_strdup(verct); Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c Fri Jun 19 12:05:52 2009 (r1096) @@ -186,6 +186,7 @@ SmlDevInfPropParam* sml_dev_inf_prop_param_new (void) { + g_type_init(); return g_object_new (SML_TYPE_DEV_INF_PROP_PARAM, NULL); } Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c Fri Jun 19 12:05:52 2009 (r1096) @@ -295,6 +295,7 @@ SmlDevInfProperty* sml_dev_inf_property_new (void) { + g_type_init(); return g_object_new (SML_TYPE_DEV_INF_PROPERTY, NULL); } Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/libsyncml/parser/sml_xml_assm.c Fri Jun 19 12:05:52 2009 (r1096) @@ -2138,9 +2138,9 @@ goto error; // add values - guint length = sml_dev_inf_property_num_val_enums(property); + gsize propValEnumCount = sml_dev_inf_property_num_val_enums(property); guint n; - for (n = 0; n < length; n++) + for (n = 0; n < propValEnumCount; n++) { const char *valEnum = sml_dev_inf_property_get_nth_val_enum(property, n); @@ -2151,10 +2151,13 @@ } // end values for loop // add parameters - length = sml_dev_inf_property_num_params(property); - for (n = 0; n < length; n++); + gsize propParamCount = sml_dev_inf_property_num_params(property); + smlTrace(TRACE_INTERNAL, "%s: property params ::= %d", __func__, propParamCount); + for (n = 0; n < propParamCount; n++) { + smlTrace(TRACE_INTERNAL, "%s: property param ::= %d", __func__, n); SmlDevInfPropParam *param = sml_dev_inf_property_get_nth_param(property, n); + smlAssert(param); if (!flat) { @@ -2179,9 +2182,9 @@ goto error; // add values - guint length = sml_dev_inf_prop_param_num_val_enums(param); + gsize propParamValEnumCount = sml_dev_inf_prop_param_num_val_enums(param); guint nn; - for (nn=0; nn < length; nn++) + for (nn=0; nn < propParamValEnumCount; nn++) { const char *valEnum = sml_dev_inf_prop_param_get_nth_val_enum(param, nn); Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/libsyncml/parser/sml_xml_parse.c Fri Jun 19 12:05:52 2009 (r1096) @@ -2827,7 +2827,7 @@ goto error; } } - if (param != NULL && sml_dev_inf_property_add_param(property, param, &gerror)) + if (param != NULL && !sml_dev_inf_property_add_param(property, param, &gerror)) goto error; if (property != NULL) smlDevInfCTCapAddProperty(ctcap, property); @@ -2839,7 +2839,7 @@ error: if (gerror) { - smlErrorSet(error, gerror->code, gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); @@ -3042,7 +3042,7 @@ error: if (gerror) { - smlErrorSet(error, gerror->code, gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); @@ -3285,7 +3285,7 @@ if (verct) smlSafeCFree(&verct); if (!ct) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error_free_datastore; } @@ -3304,7 +3304,7 @@ if (verct) smlSafeCFree(&verct); if (!ct) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); g_error_free(gerror); goto error_free_datastore; } Modified: trunk/libsyncml/sml_devinf.c ============================================================================== --- trunk/libsyncml/sml_devinf.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/libsyncml/sml_devinf.c Fri Jun 19 12:05:52 2009 (r1096) @@ -822,6 +822,8 @@ ctcap->ct = sml_dev_inf_content_type_new(NULL, NULL, &gerror); if (!ctcap->ct) { smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, gerror->message); + smlErrorSet(error, gerror->code, "%s", gerror->message); + g_error_free(gerror); smlSafeFree((gpointer *)&ctcap); return NULL; } Modified: trunk/tests/check_dev_inf_content_type.c ============================================================================== --- trunk/tests/check_dev_inf_content_type.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/tests/check_dev_inf_content_type.c Fri Jun 19 12:05:52 2009 (r1096) @@ -24,8 +24,6 @@ START_TEST (dev_inf_content_type_create) { - g_type_init(); - GError *error = NULL; SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); @@ -47,8 +45,6 @@ START_TEST (dev_inf_content_type_empty_get) { - g_type_init(); - GError *error = NULL; SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); @@ -62,8 +58,6 @@ START_TEST (dev_inf_content_type_filled_get) { - g_type_init(); - GError *error = NULL; SmlDevInfContentType *ct = sml_dev_inf_content_type_new("text/x-vCalendar", "1.0", &error); sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); @@ -77,8 +71,6 @@ START_TEST (dev_inf_content_type_references) { - g_type_init(); - GError *error = NULL; SmlDevInfContentType *ct = sml_dev_inf_content_type_new("text/x-vCalendar", "1.0", &error); sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); Modified: trunk/tests/check_dev_inf_prop_param.c ============================================================================== --- trunk/tests/check_dev_inf_prop_param.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/tests/check_dev_inf_prop_param.c Fri Jun 19 12:05:52 2009 (r1096) @@ -24,8 +24,6 @@ START_TEST (dev_inf_prop_param_create) { - g_type_init(); - SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); g_object_unref(propParam); @@ -34,8 +32,6 @@ START_TEST (dev_inf_prop_param_empty_set) { - g_type_init(); - GError *error = NULL; SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); @@ -62,8 +58,6 @@ START_TEST (dev_inf_prop_param_empty_get) { - g_type_init(); - GError *error = NULL; SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); @@ -94,8 +88,6 @@ START_TEST (dev_inf_prop_param_filled_set) { - g_type_init(); - GError *error = NULL; SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); @@ -112,8 +104,6 @@ START_TEST (dev_inf_prop_param_filled_get) { - g_type_init(); - GError *error = NULL; SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); @@ -153,8 +143,6 @@ START_TEST (dev_inf_prop_param_references) { - g_type_init(); - GError *error = NULL; SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, "Cannot create SmlDevInfPropParam."); Modified: trunk/tests/check_dev_inf_property.c ============================================================================== --- trunk/tests/check_dev_inf_property.c Fri Jun 19 10:22:12 2009 (r1095) +++ trunk/tests/check_dev_inf_property.c Fri Jun 19 12:05:52 2009 (r1096) @@ -24,8 +24,6 @@ START_TEST (dev_inf_property_create) { - g_type_init(); - SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); g_object_unref(prop); @@ -34,8 +32,6 @@ START_TEST (dev_inf_property_empty_set) { - g_type_init(); - GError *error = NULL; SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); @@ -78,8 +74,6 @@ START_TEST (dev_inf_property_empty_get) { - g_type_init(); - GError *error = NULL; SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); @@ -132,8 +126,6 @@ START_TEST (dev_inf_property_size_integrity) { - g_type_init(); - GError *error = NULL; SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); @@ -169,8 +161,6 @@ START_TEST (dev_inf_property_filled_set) { - g_type_init(); - GError *error = NULL; SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); @@ -207,8 +197,6 @@ START_TEST (dev_inf_property_filled_get) { - g_type_init(); - GError *error = NULL; SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); @@ -288,8 +276,6 @@ START_TEST (dev_inf_property_references) { - g_type_init(); - GError *error = NULL; SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, "Cannot create SmlDevInfProperty."); |
From: <svn...@op...> - 2009-06-19 08:22:16
|
Author: bellmich Date: Fri Jun 19 10:22:12 2009 New Revision: 1095 URL: http://libsyncml.opensync.org/changeset/1095 Log: fixed some warnings in the tests Modified: trunk/tests/check_dev_inf_prop_param.c trunk/tests/check_dev_inf_property.c Modified: trunk/tests/check_dev_inf_prop_param.c ============================================================================== --- trunk/tests/check_dev_inf_prop_param.c Fri Jun 19 10:20:50 2009 (r1094) +++ trunk/tests/check_dev_inf_prop_param.c Fri Jun 19 10:22:12 2009 (r1095) @@ -26,7 +26,6 @@ { g_type_init(); - GError *error = NULL; SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); g_object_unref(propParam); Modified: trunk/tests/check_dev_inf_property.c ============================================================================== --- trunk/tests/check_dev_inf_property.c Fri Jun 19 10:20:50 2009 (r1094) +++ trunk/tests/check_dev_inf_property.c Fri Jun 19 10:22:12 2009 (r1095) @@ -26,7 +26,6 @@ { g_type_init(); - GError *error = NULL; SmlDevInfProperty *prop = sml_dev_inf_property_new(); sml_fail_unless(prop != NULL, NULL); g_object_unref(prop); |
From: <svn...@op...> - 2009-06-19 08:20:57
|
Author: bellmich Date: Fri Jun 19 10:20:50 2009 New Revision: 1094 URL: http://libsyncml.opensync.org/changeset/1094 Log: fixed size_t related handling API: uint => gsize internal: gsize => uint64 The problem is that G_TYPE_SIZE does not exist as normal property. Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c trunk/libsyncml/dev_inf_api/sml_dev_inf_property.h Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c Fri Jun 19 10:09:09 2009 (r1093) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c Fri Jun 19 10:20:50 2009 (r1094) @@ -294,7 +294,7 @@ * * */ -guint +gsize sml_dev_inf_prop_param_num_val_enums (SmlDevInfPropParam *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), 0); @@ -309,7 +309,7 @@ */ G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_nth_val_enum (SmlDevInfPropParam *self, - guint n) + gsize n) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); return (gchar *)g_list_nth_data(self->priv->val_enums, n); Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c Fri Jun 19 10:09:09 2009 (r1093) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c Fri Jun 19 10:20:50 2009 (r1094) @@ -41,10 +41,10 @@ struct _SmlDevInfPropertyPrivate { gchar* prop_name; - guint size; + gsize size; gchar* data_type; - guint max_occur; - guint max_size; + gsize max_occur; + gsize max_size; gboolean no_truncate; gchar* display_name; GList* val_enums; @@ -182,13 +182,13 @@ */ g_object_class_install_property (object_class, PROP_SIZE, - g_param_spec_uint ("Size", - "", - "", - 0, - G_MAXUINT, - 0, - G_PARAM_READWRITE)); + g_param_spec_uint64 ("Size", + "", + "", + 0, + G_MAXUINT64, + 0, + G_PARAM_READWRITE)); /** * SmlDevInfProperty:DataType: * @@ -208,13 +208,13 @@ */ g_object_class_install_property (object_class, PROP_MAX_OCCUR, - g_param_spec_uint ("MaxOccur", - "", - "", - 0, - G_MAXUINT, - 0, - G_PARAM_READWRITE)); + g_param_spec_uint64 ("MaxOccur", + "", + "", + 0, + G_MAXUINT64, + 0, + G_PARAM_READWRITE)); /** * SmlDevInfProperty:MaxSize: * @@ -222,13 +222,13 @@ */ g_object_class_install_property (object_class, PROP_MAX_SIZE, - g_param_spec_uint ("MaxSize", - "", - "", - 0, - G_MAXUINT, - 0, - G_PARAM_READWRITE)); + g_param_spec_uint64 ("MaxSize", + "", + "", + 0, + G_MAXUINT64, + 0, + G_PARAM_READWRITE)); /** * SmlDevInfProperty:NoTruncate: * @@ -325,7 +325,7 @@ const gchar* prop_name, GError **error) { - g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), FALSE); g_free (self->priv->prop_name); self->priv->prop_name = g_strdup (prop_name); return TRUE; @@ -339,7 +339,7 @@ * * Return value: */ -guint +gsize sml_dev_inf_property_get_size (SmlDevInfProperty *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); @@ -355,10 +355,10 @@ */ gboolean sml_dev_inf_property_set_size (SmlDevInfProperty *self, - guint size, + gsize size, GError **error) { - g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), FALSE); if (0 < self->priv->max_size && self->priv->max_size < size) { *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The size must be lower than the maximum size."); return FALSE; @@ -394,7 +394,7 @@ const gchar* data_type, GError **error) { - g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), FALSE); g_free (self->priv->data_type); self->priv->data_type = g_strdup (data_type); return TRUE; @@ -408,7 +408,7 @@ * * Return value: */ -guint +gsize sml_dev_inf_property_get_max_occur (SmlDevInfProperty *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); @@ -424,7 +424,7 @@ */ void sml_dev_inf_property_set_max_occur (SmlDevInfProperty *self, - guint max_occur) + gsize max_occur) { g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); self->priv->max_occur = max_occur; @@ -438,7 +438,7 @@ * * Return value: */ -guint +gsize sml_dev_inf_property_get_max_size (SmlDevInfProperty *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); @@ -454,10 +454,10 @@ */ gboolean sml_dev_inf_property_set_max_size (SmlDevInfProperty *self, - guint max_size, + gsize max_size, GError **error) { - g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), FALSE); if (0 < max_size && max_size < self->priv->size) { *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The maximum size must be greater than the size."); return FALSE; @@ -523,7 +523,7 @@ const gchar* display_name, GError **error) { - g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), FALSE); g_free (self->priv->display_name); self->priv->display_name = g_strdup (display_name); return TRUE; @@ -535,7 +535,7 @@ * * */ -guint +gsize sml_dev_inf_property_num_val_enums (SmlDevInfProperty *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); @@ -550,7 +550,7 @@ */ const gchar* sml_dev_inf_property_get_nth_val_enum (SmlDevInfProperty *self, - guint n) + gsize n) { g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), NULL); return (gchar *)g_list_nth_data(self->priv->val_enums, n); @@ -582,7 +582,7 @@ * * */ -guint +gsize sml_dev_inf_property_num_params (SmlDevInfProperty *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); @@ -597,7 +597,7 @@ */ SmlDevInfPropParam* sml_dev_inf_property_get_nth_param (SmlDevInfProperty *self, - guint n) + gsize n) { g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), NULL); return (SmlDevInfPropParam *)g_list_nth_data(self->priv->params, n); Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_property.h ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_property.h Fri Jun 19 10:09:09 2009 (r1093) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_property.h Fri Jun 19 10:20:50 2009 (r1094) @@ -56,23 +56,23 @@ SmlDevInfProperty* sml_dev_inf_property_new (void); G_CONST_RETURN gchar* sml_dev_inf_property_get_prop_name (SmlDevInfProperty *self); gboolean sml_dev_inf_property_set_prop_name (SmlDevInfProperty *self, const gchar* prop_name, GError **error); -guint sml_dev_inf_property_get_size (SmlDevInfProperty *self); -gboolean sml_dev_inf_property_set_size (SmlDevInfProperty *self, guint size, GError **error); +gsize sml_dev_inf_property_get_size (SmlDevInfProperty *self); +gboolean sml_dev_inf_property_set_size (SmlDevInfProperty *self, gsize size, GError **error); G_CONST_RETURN gchar* sml_dev_inf_property_get_data_type (SmlDevInfProperty *self); gboolean sml_dev_inf_property_set_data_type (SmlDevInfProperty *self, const gchar* data_type, GError **error); -guint sml_dev_inf_property_get_max_occur (SmlDevInfProperty *self); -void sml_dev_inf_property_set_max_occur (SmlDevInfProperty *self, guint max_occur); -guint sml_dev_inf_property_get_max_size (SmlDevInfProperty *self); -gboolean sml_dev_inf_property_set_max_size (SmlDevInfProperty *self, guint max_size, GError **error); +gsize sml_dev_inf_property_get_max_occur (SmlDevInfProperty *self); +void sml_dev_inf_property_set_max_occur (SmlDevInfProperty *self, gsize max_occur); +gsize sml_dev_inf_property_get_max_size (SmlDevInfProperty *self); +gboolean sml_dev_inf_property_set_max_size (SmlDevInfProperty *self, gsize max_size, GError **error); gboolean sml_dev_inf_property_get_no_truncate (SmlDevInfProperty *self); void sml_dev_inf_property_set_no_truncate (SmlDevInfProperty *self, gboolean no_truncate); G_CONST_RETURN gchar* sml_dev_inf_property_get_display_name (SmlDevInfProperty *self); gboolean sml_dev_inf_property_set_display_name (SmlDevInfProperty *self, const gchar* display_name, GError **error); -guint sml_dev_inf_property_num_val_enums (SmlDevInfProperty *self); -G_CONST_RETURN gchar* sml_dev_inf_property_get_nth_val_enum (SmlDevInfProperty *self, guint n); +gsize sml_dev_inf_property_num_val_enums (SmlDevInfProperty *self); +G_CONST_RETURN gchar* sml_dev_inf_property_get_nth_val_enum (SmlDevInfProperty *self, gsize n); gboolean sml_dev_inf_property_add_val_enum (SmlDevInfProperty *self, const gchar* val_enum, GError **error); -guint sml_dev_inf_property_num_params (SmlDevInfProperty *self); -SmlDevInfPropParam* sml_dev_inf_property_get_nth_param (SmlDevInfProperty *self, guint n); +gsize sml_dev_inf_property_num_params (SmlDevInfProperty *self); +SmlDevInfPropParam* sml_dev_inf_property_get_nth_param (SmlDevInfProperty *self, gsize n); gboolean sml_dev_inf_property_add_param (SmlDevInfProperty *self, SmlDevInfPropParam *param, GError **error); G_END_DECLS |
From: <svn...@op...> - 2009-06-19 08:09:17
|
Author: bellmich Date: Fri Jun 19 10:09:09 2009 New Revision: 1093 URL: http://libsyncml.opensync.org/changeset/1093 Log: migrated SmlDevInfProperty to GObject style Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c trunk/libsyncml/dev_inf_api/sml_dev_inf_property.h trunk/tests/check_dev_inf_property.c Modified: trunk/libsyncml/CMakeLists.txt trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_devinf.c trunk/libsyncml/sml_devinf.h trunk/libsyncml/syncml.h trunk/tests/CMakeLists.txt trunk/tests/check_dev_inf_prop_param.c Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Thu Jun 18 11:16:28 2009 (r1092) +++ trunk/libsyncml/CMakeLists.txt Fri Jun 19 10:09:09 2009 (r1093) @@ -33,8 +33,9 @@ parser/sml_wbxml.c parser/sml_xml_assm.c parser/sml_xml_parse.c - dev_inf_api/sml_dev_inf_prop_param.c dev_inf_api/sml_dev_inf_content_type.c + dev_inf_api/sml_dev_inf_prop_param.c + dev_inf_api/sml_dev_inf_property.c ) IF ( ENABLE_OBEX ) @@ -97,6 +98,7 @@ INSTALL( FILES dev_inf_api/sml_dev_inf_content_type.h dev_inf_api/sml_dev_inf_prop_param.h + dev_inf_api/sml_dev_inf_property.h DESTINATION ${LIBSYNCML_INCLUDE_DIR}/libsyncml/dev_inf_api ) Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Thu Jun 18 11:16:28 2009 (r1092) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Fri Jun 19 10:09:09 2009 (r1093) @@ -32,10 +32,17 @@ smlAssert(ctcap); smlAssert(name); - SmlDevInfProperty *prop = smlDevInfNewProperty(error); - if (!prop) + SmlDevInfProperty *prop = sml_dev_inf_property_new(); + if (!prop) { + smlErrorSet(error, SML_ERROR_GENERIC, "Cannot create new instance of SmlDevInfProperty - out of memory."); + goto error; + } + GError *gerror = NULL; + if (!sml_dev_inf_property_set_prop_name(prop, name, &gerror)) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; - smlDevInfPropertySetPropName(prop, name); + } smlDevInfCTCapAddProperty(ctcap, prop); smlTrace(TRACE_EXIT, "%s", __func__); @@ -57,14 +64,20 @@ smlAssert(name); smlAssert(value); + GError *gerror = NULL; SmlDevInfProperty *prop = _add_ctcap_property_by_name(ctcap, name, error); if (!prop) goto error; - smlDevInfPropertyAddValEnum(prop, value); + if (!sml_dev_inf_property_add_val_enum(prop, value, &gerror)) + goto error; smlTrace(TRACE_EXIT, "%s", __func__); return prop; error: + if (gerror) { + smlErrorSet(error, gerror->code, gerror->message); + g_error_free(gerror); + } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); return NULL; } @@ -79,28 +92,39 @@ smlAssert(prop); smlAssert(name); + GError *gerror = NULL; SmlDevInfPropParam *param = sml_dev_inf_prop_param_new(); if (!param) { smlErrorSet(error, SML_ERROR_GENERIC, "Cannot create new PropParam for SyncML device information."); goto error; } - /* FIXME: missing error handling */ - GError *gerror = NULL; - sml_dev_inf_prop_param_set_param_name(param, name, &gerror); - smlDevInfPropertyAddPropParam(prop, param); + if (!sml_dev_inf_prop_param_set_param_name(param, name, &gerror)) + goto error; + if (!sml_dev_inf_property_add_param(prop, param, &gerror)) + goto error; smlTrace(TRACE_EXIT, "%s", __func__); return param; error: + if (gerror) { + smlErrorSet(error, gerror->code, gerror->message); + g_error_free(gerror); + } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); return NULL; } +#define _ADD_PROPERTY_VAL_ENUM(text) \ + if (sml_dev_inf_property_add_val_enum(prop, text, &gerror)) \ + goto error; #define _ADD_PROPERTY_PARAM(text) \ param = _add_property_param(prop, text, error); \ if (!param) \ goto error; +#define _ADD_PROP_PARAM_VAL_ENUM(text) \ + if (sml_dev_inf_prop_param_add_val_enum(param, text, &gerror)) \ + goto error; #define _ADD_CTCAP_PROPERTY_BY_NAME(text) \ prop = _add_ctcap_property_by_name(ctcap, text, error); \ if (!prop) \ @@ -153,12 +177,12 @@ smlDevInfCTCapSetVerCT(ctcap, "2.1"); _ADD_CTCAP_PROPERTY_BY_NAME("ADR") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "PARCEL", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "POSTAL", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "INTL", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "DOM", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("HOME") + _ADD_PROP_PARAM_VAL_ENUM("WORK") + _ADD_PROP_PARAM_VAL_ENUM("PARCEL") + _ADD_PROP_PARAM_VAL_ENUM("POSTAL") + _ADD_PROP_PARAM_VAL_ENUM("INTL") + _ADD_PROP_PARAM_VAL_ENUM("DOM") _ADD_PROPERTY_PARAM("HOME"); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("PARCEL"); @@ -171,24 +195,24 @@ _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("END","VCARD") _ADD_CTCAP_PROPERTY_BY_NAME("EMAIL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "INTERNET", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("INTERNET") _ADD_PROPERTY_PARAM("INTERNET"); _ADD_CTCAP_PROPERTY_BY_NAME("FN") _ADD_CTCAP_PROPERTY_BY_NAME("GEO") _ADD_CTCAP_PROPERTY_BY_NAME("KEY") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "X509", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "PGP", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("X509") + _ADD_PROP_PARAM_VAL_ENUM("PGP") _ADD_PROPERTY_PARAM("X509"); _ADD_PROPERTY_PARAM("PGP"); _ADD_CTCAP_PROPERTY_BY_NAME("LABEL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "PARCEL", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "POSTAL", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "INTL", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "DOM", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("HOME") + _ADD_PROP_PARAM_VAL_ENUM("WORK") + _ADD_PROP_PARAM_VAL_ENUM("PARCEL") + _ADD_PROP_PARAM_VAL_ENUM("POSTAL") + _ADD_PROP_PARAM_VAL_ENUM("INTL") + _ADD_PROP_PARAM_VAL_ENUM("DOM") _ADD_PROPERTY_PARAM("HOME"); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("PARCEL"); @@ -197,7 +221,7 @@ _ADD_PROPERTY_PARAM("DOM"); _ADD_CTCAP_PROPERTY_BY_NAME("LOGO") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "JPEG", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("JPEG") _ADD_PROPERTY_PARAM("JPEG"); _ADD_CTCAP_PROPERTY_BY_NAME("MAILER") _ADD_CTCAP_PROPERTY_BY_NAME("N") @@ -205,32 +229,32 @@ _ADD_CTCAP_PROPERTY_BY_NAME("ORG") _ADD_CTCAP_PROPERTY_BY_NAME("PHOTO") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "JPEG", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("JPEG") _ADD_PROPERTY_PARAM("JPEG"); _ADD_CTCAP_PROPERTY_BY_NAME("REV") _ADD_CTCAP_PROPERTY_BY_NAME("ROLE") _ADD_CTCAP_PROPERTY_BY_NAME("SOUND") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "AIFF", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "PCM", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "WAVE", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("AIFF") + _ADD_PROP_PARAM_VAL_ENUM("PCM") + _ADD_PROP_PARAM_VAL_ENUM("WAVE") _ADD_PROPERTY_PARAM("AIFF"); _ADD_PROPERTY_PARAM("PCM"); _ADD_PROPERTY_PARAM("WAVE"); _ADD_CTCAP_PROPERTY_BY_NAME("TEL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "VOICE", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "PREF", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "PAGER", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "MSG", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "MODEM", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "ISDN", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "FAX", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "CELL", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "CAR", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "BBS", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("WORK") + _ADD_PROP_PARAM_VAL_ENUM("VOICE") + _ADD_PROP_PARAM_VAL_ENUM("PREF") + _ADD_PROP_PARAM_VAL_ENUM("PAGER") + _ADD_PROP_PARAM_VAL_ENUM("MSG") + _ADD_PROP_PARAM_VAL_ENUM("MODEM") + _ADD_PROP_PARAM_VAL_ENUM("ISDN") + _ADD_PROP_PARAM_VAL_ENUM("HOME") + _ADD_PROP_PARAM_VAL_ENUM("FAX") + _ADD_PROP_PARAM_VAL_ENUM("CELL") + _ADD_PROP_PARAM_VAL_ENUM("CAR") + _ADD_PROP_PARAM_VAL_ENUM("BBS") _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("VOICE"); _ADD_PROPERTY_PARAM("PREF"); @@ -248,8 +272,8 @@ _ADD_CTCAP_PROPERTY_BY_NAME("UID") _ADD_CTCAP_PROPERTY_BY_NAME("URL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("WORK") + _ADD_PROP_PARAM_VAL_ENUM("HOME") _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("HOME"); _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("VERSION", "2.1") @@ -280,16 +304,16 @@ _ADD_CTCAP_PROPERTY_BY_NAME("URL") _ADD_CTCAP_PROPERTY_BY_NAME("TEL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "CELL", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "FAX", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "MODEM", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "VOICE", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("CELL") + _ADD_PROP_PARAM_VAL_ENUM("HOME") + _ADD_PROP_PARAM_VAL_ENUM("WORK") + _ADD_PROP_PARAM_VAL_ENUM("FAX") + _ADD_PROP_PARAM_VAL_ENUM("MODEM") + _ADD_PROP_PARAM_VAL_ENUM("VOICE") _ADD_CTCAP_PROPERTY_BY_NAME("ADR") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); + _ADD_PROP_PARAM_VAL_ENUM("HOME") + _ADD_PROP_PARAM_VAL_ENUM("WORK") _ADD_CTCAP_PROPERTY_BY_NAME("BDAY") _ADD_CTCAP_PROPERTY_BY_NAME("NOTE") _ADD_CTCAP_PROPERTY_BY_NAME("PHOTO") @@ -319,15 +343,15 @@ _ADD_PROPERTY_PARAM("STATUS") _ADD_PROPERTY_PARAM("ROLE") _ADD_CTCAP_PROPERTY_BY_NAME("BEGIN") - smlDevInfPropertyAddValEnum(prop, "VCALENDAR"); - smlDevInfPropertyAddValEnum(prop, "VEVENT"); - smlDevInfPropertyAddValEnum(prop, "VTODO"); + _ADD_PROPERTY_VAL_ENUM("VCALENDAR") + _ADD_PROPERTY_VAL_ENUM("VEVENT") + _ADD_PROPERTY_VAL_ENUM("VTODO") _ADD_CTCAP_PROPERTY_BY_NAME("CATEGORIES") _ADD_CTCAP_PROPERTY_BY_NAME("COMPLETED") _ADD_CTCAP_PROPERTY_BY_NAME("CLASS") - smlDevInfPropertyAddValEnum(prop, "PUBLIC"); - smlDevInfPropertyAddValEnum(prop, "PRIVATE"); - smlDevInfPropertyAddValEnum(prop, "CONFIDENTIAL"); + _ADD_PROPERTY_VAL_ENUM("PUBLIC") + _ADD_PROPERTY_VAL_ENUM("PRIVATE") + _ADD_PROPERTY_VAL_ENUM("CONFIDENTIAL") _ADD_CTCAP_PROPERTY_BY_NAME("DALARM") _ADD_CTCAP_PROPERTY_BY_NAME("DAYLIGHT") _ADD_CTCAP_PROPERTY_BY_NAME("DCREATED") @@ -336,9 +360,9 @@ _ADD_CTCAP_PROPERTY_BY_NAME("DTEND") _ADD_CTCAP_PROPERTY_BY_NAME("DUE") _ADD_CTCAP_PROPERTY_BY_NAME("END") - smlDevInfPropertyAddValEnum(prop, "VCALENDAR"); - smlDevInfPropertyAddValEnum(prop, "VEVENT"); - smlDevInfPropertyAddValEnum(prop, "VTODO"); + _ADD_PROPERTY_VAL_ENUM("VCALENDAR") + _ADD_PROPERTY_VAL_ENUM("VEVENT") + _ADD_PROPERTY_VAL_ENUM("VTODO") _ADD_CTCAP_PROPERTY_BY_NAME("EXDATE") _ADD_CTCAP_PROPERTY_BY_NAME("LAST-MODIFIED") _ADD_CTCAP_PROPERTY_BY_NAME("LOCATION") @@ -370,15 +394,15 @@ _ADD_PROPERTY_PARAM("PARTSTAT") _ADD_PROPERTY_PARAM("ROLE") _ADD_CTCAP_PROPERTY_BY_NAME("BEGIN") - smlDevInfPropertyAddValEnum(prop, "VCALENDAR"); - smlDevInfPropertyAddValEnum(prop, "VEVENT"); - smlDevInfPropertyAddValEnum(prop, "VTODO"); + _ADD_PROPERTY_VAL_ENUM("VCALENDAR") + _ADD_PROPERTY_VAL_ENUM("VEVENT") + _ADD_PROPERTY_VAL_ENUM("VTODO") _ADD_CTCAP_PROPERTY_BY_NAME("CATEGORIES") _ADD_CTCAP_PROPERTY_BY_NAME("COMPLETED") _ADD_CTCAP_PROPERTY_BY_NAME("CLASS") - smlDevInfPropertyAddValEnum(prop, "PUBLIC"); - smlDevInfPropertyAddValEnum(prop, "PRIVATE"); - smlDevInfPropertyAddValEnum(prop, "CONFIDENTIAL"); + _ADD_PROPERTY_VAL_ENUM("PUBLIC") + _ADD_PROPERTY_VAL_ENUM("PRIVATE") + _ADD_PROPERTY_VAL_ENUM("CONFIDENTIAL") _ADD_CTCAP_PROPERTY_BY_NAME("DALARM") _ADD_CTCAP_PROPERTY_BY_NAME("DAYLIGHT") _ADD_CTCAP_PROPERTY_BY_NAME("DCREATED") @@ -387,9 +411,9 @@ _ADD_CTCAP_PROPERTY_BY_NAME("DTEND") _ADD_CTCAP_PROPERTY_BY_NAME("DUE") _ADD_CTCAP_PROPERTY_BY_NAME("END") - smlDevInfPropertyAddValEnum(prop, "VCALENDAR"); - smlDevInfPropertyAddValEnum(prop, "VEVENT"); - smlDevInfPropertyAddValEnum(prop, "VTODO"); + _ADD_PROPERTY_VAL_ENUM("VCALENDAR") + _ADD_PROPERTY_VAL_ENUM("VEVENT") + _ADD_PROPERTY_VAL_ENUM("VTODO") _ADD_CTCAP_PROPERTY_BY_NAME("EXDATE") _ADD_CTCAP_PROPERTY_BY_NAME("LAST-MODIFIED") _ADD_CTCAP_PROPERTY_BY_NAME("LOCATION") Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_property.c Fri Jun 19 10:09:09 2009 (r1093) @@ -0,0 +1,636 @@ +/* sml_dev_inf_property.c + * + * 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 Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + + +#include "sml_dev_inf_property.h" +#include <libsyncml/syncml.h> + +G_DEFINE_TYPE (SmlDevInfProperty, sml_dev_inf_property, G_TYPE_OBJECT) + +enum +{ + PROP_0, + PROP_PROP_NAME, + PROP_SIZE, + PROP_DATA_TYPE, + PROP_MAX_OCCUR, + PROP_MAX_SIZE, + PROP_NO_TRUNCATE, + PROP_DISPLAY_NAME, + PROP_VAL_ENUMS, + PROP_PARAMS +}; + +struct _SmlDevInfPropertyPrivate +{ + gchar* prop_name; + guint size; + gchar* data_type; + guint max_occur; + guint max_size; + gboolean no_truncate; + gchar* display_name; + GList* val_enums; + GList* params; +}; + +static void +sml_dev_inf_property_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_PROP_NAME: + g_value_set_string (value, SML_DEV_INF_PROPERTY (object)->priv->prop_name); + break; + case PROP_SIZE: + g_value_set_uint (value, SML_DEV_INF_PROPERTY (object)->priv->size); + break; + case PROP_DATA_TYPE: + g_value_set_string (value, SML_DEV_INF_PROPERTY (object)->priv->data_type); + break; + case PROP_MAX_OCCUR: + g_value_set_uint (value, SML_DEV_INF_PROPERTY (object)->priv->max_occur); + break; + case PROP_MAX_SIZE: + g_value_set_uint (value, SML_DEV_INF_PROPERTY (object)->priv->max_size); + break; + case PROP_NO_TRUNCATE: + g_value_set_boolean (value, SML_DEV_INF_PROPERTY (object)->priv->no_truncate); + break; + case PROP_DISPLAY_NAME: + g_value_set_string (value, SML_DEV_INF_PROPERTY (object)->priv->display_name); + break; + case PROP_VAL_ENUMS: + g_value_set_pointer (value, SML_DEV_INF_PROPERTY (object)->priv->val_enums); + break; + case PROP_PARAMS: + g_value_set_pointer (value, SML_DEV_INF_PROPERTY (object)->priv->params); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +sml_dev_inf_property_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_PROP_NAME: + g_free (SML_DEV_INF_PROPERTY (object)->priv->prop_name); + SML_DEV_INF_PROPERTY (object)->priv->prop_name = g_strdup (g_value_get_string (value)); + break; + case PROP_SIZE: + SML_DEV_INF_PROPERTY (object)->priv->size = g_value_get_uint (value); + break; + case PROP_DATA_TYPE: + g_free (SML_DEV_INF_PROPERTY (object)->priv->data_type); + SML_DEV_INF_PROPERTY (object)->priv->data_type = g_strdup (g_value_get_string (value)); + break; + case PROP_MAX_OCCUR: + SML_DEV_INF_PROPERTY (object)->priv->max_occur = g_value_get_uint (value); + break; + case PROP_MAX_SIZE: + SML_DEV_INF_PROPERTY (object)->priv->max_size = g_value_get_uint (value); + break; + case PROP_NO_TRUNCATE: + SML_DEV_INF_PROPERTY (object)->priv->no_truncate = g_value_get_boolean (value); + break; + case PROP_DISPLAY_NAME: + g_free (SML_DEV_INF_PROPERTY (object)->priv->display_name); + SML_DEV_INF_PROPERTY (object)->priv->display_name = g_strdup (g_value_get_string (value)); + break; + case PROP_VAL_ENUMS: + SML_DEV_INF_PROPERTY (object)->priv->val_enums = (GList *) g_value_get_pointer(value); + break; + case PROP_PARAMS: + SML_DEV_INF_PROPERTY (object)->priv->params = (GList *) g_value_get_pointer(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +sml_dev_inf_property_finalize (GObject *object) +{ + SmlDevInfProperty *self = (SmlDevInfProperty *) object; + g_free(self->priv->prop_name); + g_free(self->priv->data_type); + g_free(self->priv->display_name); + while(self->priv->val_enums) { + gchar *val_enum = self->priv->val_enums->data; + self->priv->val_enums = g_list_remove(self->priv->val_enums, val_enum); + g_free(val_enum); + } + while(self->priv->params) { + SmlDevInfPropParam *param = self->priv->params->data; + self->priv->params = g_list_remove(self->priv->params, param); + g_object_unref(param); + } + G_OBJECT_CLASS (sml_dev_inf_property_parent_class)->finalize (object); +} + +static void +sml_dev_inf_property_class_init (SmlDevInfPropertyClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (SmlDevInfPropertyPrivate)); + + object_class->get_property = sml_dev_inf_property_get_property; + object_class->set_property = sml_dev_inf_property_set_property; + object_class->finalize = sml_dev_inf_property_finalize; + + /** + * SmlDevInfProperty:PropName: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_PROP_NAME, + g_param_spec_string ("PropName", + "", + "", + NULL, + G_PARAM_READWRITE)); + /** + * SmlDevInfProperty:Size: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_SIZE, + g_param_spec_uint ("Size", + "", + "", + 0, + G_MAXUINT, + 0, + G_PARAM_READWRITE)); + /** + * SmlDevInfProperty:DataType: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_DATA_TYPE, + g_param_spec_string ("DataType", + "", + "", + NULL, + G_PARAM_READWRITE)); + /** + * SmlDevInfProperty:MaxOccur: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_MAX_OCCUR, + g_param_spec_uint ("MaxOccur", + "", + "", + 0, + G_MAXUINT, + 0, + G_PARAM_READWRITE)); + /** + * SmlDevInfProperty:MaxSize: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_MAX_SIZE, + g_param_spec_uint ("MaxSize", + "", + "", + 0, + G_MAXUINT, + 0, + G_PARAM_READWRITE)); + /** + * SmlDevInfProperty:NoTruncate: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_NO_TRUNCATE, + g_param_spec_boolean ("NoTruncate", + "", + "", + FALSE, + G_PARAM_READWRITE)); + /** + * SmlDevInfProperty:DisplayName: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_DISPLAY_NAME, + g_param_spec_string ("DisplayName", + "", + "", + NULL, + G_PARAM_READWRITE)); + /** + * SmlDevInfProperty:ValEnums: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_VAL_ENUMS, + g_param_spec_pointer ("ValEnums", + "ValEnums", + "", + G_PARAM_PRIVATE)); + /** + * SmlDevInfProperty:PropParams: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_PARAMS, + g_param_spec_pointer ("Params", + "Params", + "", + G_PARAM_PRIVATE)); +} + +static void +sml_dev_inf_property_init (SmlDevInfProperty *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + SML_TYPE_DEV_INF_PROPERTY, + SmlDevInfPropertyPrivate); +} + +/** + * sml_dev_inf_property_new: + * + * Creates a new instance of #SmlDevInfProperty. + * + * Return value: the newly created #SmlDevInfProperty instance + */ +SmlDevInfProperty* +sml_dev_inf_property_new (void) +{ + return g_object_new (SML_TYPE_DEV_INF_PROPERTY, NULL); +} + +/** + * sml_dev_inf_property_get_prop_name: + * @self: A #SmlDevInfProperty + * + * Gets the property. + * + * Return value: + */ +G_CONST_RETURN gchar* +sml_dev_inf_property_get_prop_name (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), NULL); + return self->priv->prop_name; +} + +/** + * sml_dev_inf_property_set_prop_name: + * @self: A #SmlDevInfProperty + * @prop_name: + * + * Sets the property. + */ +gboolean +sml_dev_inf_property_set_prop_name (SmlDevInfProperty *self, + const gchar* prop_name, + GError **error) +{ + g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + g_free (self->priv->prop_name); + self->priv->prop_name = g_strdup (prop_name); + return TRUE; +} + +/** + * sml_dev_inf_property_get_size: + * @self: A #SmlDevInfProperty + * + * Gets the property. + * + * Return value: + */ +guint +sml_dev_inf_property_get_size (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); + return self->priv->size; +} + +/** + * sml_dev_inf_property_set_size: + * @self: A #SmlDevInfProperty + * @size: + * + * Sets the property. + */ +gboolean +sml_dev_inf_property_set_size (SmlDevInfProperty *self, + guint size, + GError **error) +{ + g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + if (0 < self->priv->max_size && self->priv->max_size < size) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The size must be lower than the maximum size."); + return FALSE; + } + self->priv->size = size; + return TRUE; +} + +/** + * sml_dev_inf_property_get_datatype: + * @self: A #SmlDevInfProperty + * + * Gets the property. + * + * Return value: + */ +G_CONST_RETURN gchar* +sml_dev_inf_property_get_data_type (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), NULL); + return self->priv->data_type; +} + +/** + * sml_dev_inf_property_set_data_type: + * @self: A #SmlDevInfProperty + * @data_type: + * + * Sets the property. + */ +gboolean +sml_dev_inf_property_set_data_type (SmlDevInfProperty *self, + const gchar* data_type, + GError **error) +{ + g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + g_free (self->priv->data_type); + self->priv->data_type = g_strdup (data_type); + return TRUE; +} + +/** + * sml_dev_inf_property_get_max_occur: + * @self: A #SmlDevInfProperty + * + * Gets the property. + * + * Return value: + */ +guint +sml_dev_inf_property_get_max_occur (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); + return self->priv->max_occur; +} + +/** + * sml_dev_inf_property_set_max_occur: + * @self: A #SmlDevInfProperty + * @maxoccur: + * + * Sets the property. + */ +void +sml_dev_inf_property_set_max_occur (SmlDevInfProperty *self, + guint max_occur) +{ + g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + self->priv->max_occur = max_occur; +} + +/** + * sml_dev_inf_property_get_max_size: + * @self: A #SmlDevInfProperty + * + * Gets the property. + * + * Return value: + */ +guint +sml_dev_inf_property_get_max_size (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); + return self->priv->max_size; +} + +/** + * sml_dev_inf_property_set_max_size: + * @self: A #SmlDevInfProperty + * @maxsize: + * + * Sets the property. + */ +gboolean +sml_dev_inf_property_set_max_size (SmlDevInfProperty *self, + guint max_size, + GError **error) +{ + g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + if (0 < max_size && max_size < self->priv->size) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The maximum size must be greater than the size."); + return FALSE; + } + self->priv->max_size = max_size; + return TRUE; +} + +/** + * sml_dev_inf_property_get_no_truncate: + * @self: A #SmlDevInfProperty + * + * Gets the property. + * + * Return value: + */ +gboolean +sml_dev_inf_property_get_no_truncate (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), FALSE); + return self->priv->no_truncate; +} + +/** + * sml_dev_inf_property_set_no_truncate: + * @self: A #SmlDevInfProperty + * @notruncate: + * + * Sets the property. + */ +void +sml_dev_inf_property_set_no_truncate (SmlDevInfProperty *self, + gboolean no_truncate) +{ + g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + self->priv->no_truncate = no_truncate; +} + +/** + * sml_dev_inf_property_get_display_name: + * @self: A #SmlDevInfProperty + * + * Gets the property. + * + * Return value: + */ +G_CONST_RETURN gchar* +sml_dev_inf_property_get_display_name (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), NULL); + return self->priv->display_name; +} + +/** + * sml_dev_inf_property_set_display_name: + * @self: A #SmlDevInfProperty + * @displayname: + * + * Sets the property. + */ +gboolean +sml_dev_inf_property_set_display_name (SmlDevInfProperty *self, + const gchar* display_name, + GError **error) +{ + g_return_if_fail (SML_IS_DEV_INF_PROPERTY (self)); + g_free (self->priv->display_name); + self->priv->display_name = g_strdup (display_name); + return TRUE; +} + +/** + * sml_dev_inf_property_num_val_enums: + * @self: A #SmlDevInfProperty + * + * + */ +guint +sml_dev_inf_property_num_val_enums (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); + return g_list_length(self->priv->val_enums); +} + +/** + * sml_dev_inf_property_get_nth_val_enum: + * @self: A #SmlDevInfProperty + * + * + */ +const gchar* +sml_dev_inf_property_get_nth_val_enum (SmlDevInfProperty *self, + guint n) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), NULL); + return (gchar *)g_list_nth_data(self->priv->val_enums, n); +} + +/** + * sml_dev_inf_property_add_val_enum: + * @self: A #SmlDevInfProperty + * + * + */ +gboolean +sml_dev_inf_property_add_val_enum (SmlDevInfProperty *self, + const gchar* val_enum, + GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), FALSE); + self->priv->val_enums = g_list_append(self->priv->val_enums, g_strdup(val_enum)); + if (!self->priv->val_enums) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "Cannot add ValEnum to ValEnum list of Property."); + return FALSE; + } + return TRUE; +} + +/** + * sml_dev_inf_property_num_params: + * @self: A #SmlDevInfProperty + * + * + */ +guint +sml_dev_inf_property_num_params (SmlDevInfProperty *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), 0); + return g_list_length(self->priv->params); +} + +/** + * sml_dev_inf_property_get_nth_param: + * @self: A #SmlDevInfProperty + * + * + */ +SmlDevInfPropParam* +sml_dev_inf_property_get_nth_param (SmlDevInfProperty *self, + guint n) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), NULL); + return (SmlDevInfPropParam *)g_list_nth_data(self->priv->params, n); +} + +/** + * sml_dev_inf_property_add_param: + * @self: A #SmlDevInfProperty + * + * The SmlDevInfPropParam object is handled like a normal const string. + * This means that the SmlDevInfProperty object registers an own reference + * to the object. The caller has to maintain its reference to the + * SmlDevInfPropParam object by himself. + * + * sml_dev_inf_property_add_prop_param does not consume a reference of + * the SmlDevInfPropParam object. + */ +gboolean +sml_dev_inf_property_add_param (SmlDevInfProperty *self, + SmlDevInfPropParam *param, + GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROPERTY (self), FALSE); + if (!param) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "The SmlDevInfPropParam object is missing."); + return FALSE; + } + g_object_ref(param); + self->priv->params = g_list_append(self->priv->params, param); + if (!self->priv->params) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "Cannot add PropParam to PropParam list of Property."); + return FALSE; + } + return TRUE; +} + Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_property.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_property.h Fri Jun 19 10:09:09 2009 (r1093) @@ -0,0 +1,80 @@ +/* sml_dev_inf_property.h + * + * 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 Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + + +#ifndef __SML_DEV_INF_PROPERTY_H__ +#define __SML_DEV_INF_PROPERTY_H__ + +#include <glib-object.h> +#include <libsyncml/dev_inf_api/sml_dev_inf_prop_param.h> + +G_BEGIN_DECLS + +#define SML_TYPE_DEV_INF_PROPERTY (sml_dev_inf_property_get_type()) +#define SML_DEV_INF_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SML_TYPE_DEV_INF_PROPERTY, SmlDevInfProperty)) +#define SML_DEV_INF_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SML_TYPE_DEV_INF_PROPERTY, SmlDevInfPropertyClass)) +#define SML_IS_DEV_INF_PROPERTY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SML_TYPE_DEV_INF_PROPERTY)) +#define SML_IS_DEV_INF_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SML_TYPE_DEV_INF_PROPERTY)) +#define SML_DEV_INF_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SML_TYPE_DEV_INF_PROPERTY, SmlDevInfPropertyClass)) + +typedef struct _SmlDevInfProperty SmlDevInfProperty; +typedef struct _SmlDevInfPropertyClass SmlDevInfPropertyClass; +typedef struct _SmlDevInfPropertyPrivate SmlDevInfPropertyPrivate; + +struct _SmlDevInfProperty +{ + GObject parent; + + /*< private >*/ + SmlDevInfPropertyPrivate *priv; +}; + +struct _SmlDevInfPropertyClass +{ + GObjectClass parent_class; + +}; + +GType sml_dev_inf_property_get_type (void); +SmlDevInfProperty* sml_dev_inf_property_new (void); +G_CONST_RETURN gchar* sml_dev_inf_property_get_prop_name (SmlDevInfProperty *self); +gboolean sml_dev_inf_property_set_prop_name (SmlDevInfProperty *self, const gchar* prop_name, GError **error); +guint sml_dev_inf_property_get_size (SmlDevInfProperty *self); +gboolean sml_dev_inf_property_set_size (SmlDevInfProperty *self, guint size, GError **error); +G_CONST_RETURN gchar* sml_dev_inf_property_get_data_type (SmlDevInfProperty *self); +gboolean sml_dev_inf_property_set_data_type (SmlDevInfProperty *self, const gchar* data_type, GError **error); +guint sml_dev_inf_property_get_max_occur (SmlDevInfProperty *self); +void sml_dev_inf_property_set_max_occur (SmlDevInfProperty *self, guint max_occur); +guint sml_dev_inf_property_get_max_size (SmlDevInfProperty *self); +gboolean sml_dev_inf_property_set_max_size (SmlDevInfProperty *self, guint max_size, GError **error); +gboolean sml_dev_inf_property_get_no_truncate (SmlDevInfProperty *self); +void sml_dev_inf_property_set_no_truncate (SmlDevInfProperty *self, gboolean no_truncate); +G_CONST_RETURN gchar* sml_dev_inf_property_get_display_name (SmlDevInfProperty *self); +gboolean sml_dev_inf_property_set_display_name (SmlDevInfProperty *self, const gchar* display_name, GError **error); +guint sml_dev_inf_property_num_val_enums (SmlDevInfProperty *self); +G_CONST_RETURN gchar* sml_dev_inf_property_get_nth_val_enum (SmlDevInfProperty *self, guint n); +gboolean sml_dev_inf_property_add_val_enum (SmlDevInfProperty *self, const gchar* val_enum, GError **error); +guint sml_dev_inf_property_num_params (SmlDevInfProperty *self); +SmlDevInfPropParam* sml_dev_inf_property_get_nth_param (SmlDevInfProperty *self, guint n); +gboolean sml_dev_inf_property_add_param (SmlDevInfProperty *self, SmlDevInfPropParam *param, GError **error); + +G_END_DECLS + +#endif /* __SML_DEV_INF_PROPERTY_H__ */ Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Thu Jun 18 11:16:28 2009 (r1092) +++ trunk/libsyncml/parser/sml_xml_assm.c Fri Jun 19 10:09:09 2009 (r1093) @@ -2089,42 +2089,42 @@ } // add PropName - if (property->propName != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_PROPNAME, property->propName, error)) + if (sml_dev_inf_property_get_prop_name(property) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_PROPNAME, sml_dev_inf_property_get_prop_name(property), error)) goto error; // add DataType - if (property->dataType != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DATATYPE, property->dataType, error)) + if (sml_dev_inf_property_get_data_type(property) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DATATYPE, sml_dev_inf_property_get_data_type(property), error)) goto error; // add MaxOccur - if (property->maxOccur > 0 && - !_smlXmlAssemblerAddID(assm, SML_ELEMENT_MAXOCCUR, property->maxOccur, error)) + if (sml_dev_inf_property_get_max_occur(property) > 0 && + !_smlXmlAssemblerAddID(assm, SML_ELEMENT_MAXOCCUR, sml_dev_inf_property_get_max_occur(property), error)) goto error; // add MaxSize - if (property->maxSize > 0) { + if (sml_dev_inf_property_get_max_size(property) > 0) { /* There was a change of the element name in OMA DS DevInf 1.2. */ if (flat) { if (!_smlXmlAssemblerAddID( assm, SML_ELEMENT_SIZE, - property->maxSize, + sml_dev_inf_property_get_max_size(property), error)) goto error; } else { if (!_smlXmlAssemblerAddID( assm, SML_ELEMENT_MAXSIZE, - property->maxSize, + sml_dev_inf_property_get_max_size(property), error)) goto error; } } // add NoTruncate - if (property->noTruncate) + if (sml_dev_inf_property_get_no_truncate(property)) { if (!_smlXmlAssemblerStartNode(assm, SML_ELEMENT_NOTRUNCATE, error)) goto error; @@ -2133,27 +2133,28 @@ } // add DisplayName - if (property->displayName != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DISPLAYNAME, property->displayName, error)) + if (sml_dev_inf_property_get_display_name(property) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DISPLAYNAME, sml_dev_inf_property_get_display_name(property), error)) goto error; // add values - GList *hvalue = NULL; - for (hvalue = property->valEnums; hvalue; hvalue = hvalue->next) + guint length = sml_dev_inf_property_num_val_enums(property); + guint n; + for (n = 0; n < length; n++) { - char *valEnum = hvalue->data; + const char *valEnum = sml_dev_inf_property_get_nth_val_enum(property, n); // add ValEnum - if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VALENUM, valEnum, error)) + if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VALENUM, valEnum, error)) goto error; - + } // end values for loop // add parameters - GList *hparam = NULL; - for (hparam = property->propParams; hparam; hparam = hparam->next) + length = sml_dev_inf_property_num_params(property); + for (n = 0; n < length; n++); { - SmlDevInfPropParam *param = hparam->data; + SmlDevInfPropParam *param = sml_dev_inf_property_get_nth_param(property, n); if (!flat) { @@ -2179,10 +2180,10 @@ // add values guint length = sml_dev_inf_prop_param_num_val_enums(param); - guint n; - for (n=0; n < length; n++) + guint nn; + for (nn=0; nn < length; nn++) { - const char *valEnum = sml_dev_inf_prop_param_get_nth_val_enum(param, n); + const char *valEnum = sml_dev_inf_prop_param_get_nth_val_enum(param, nn); // add ValEnum if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VALENUM, valEnum, error)) Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Thu Jun 18 11:16:28 2009 (r1092) +++ trunk/libsyncml/parser/sml_xml_parse.c Fri Jun 19 10:09:09 2009 (r1093) @@ -2649,6 +2649,8 @@ smlAssert(parser); smlAssert(devinf); + GError *gerror = NULL; + /* This function was designed to parse one CTCap section */ /* which can include several CTCap definitions */ @@ -2701,7 +2703,8 @@ { if (param != NULL) { - smlDevInfPropertyAddPropParam(property, param); + if (!sml_dev_inf_property_add_param(property, param, &gerror)) + goto error; param = NULL; } smlDevInfCTCapAddProperty(ctcap, property); @@ -2728,77 +2731,77 @@ { if (param != NULL) { - smlDevInfPropertyAddPropParam(property, param); + if (!sml_dev_inf_property_add_param(property, param, &gerror)) + goto error; param = NULL; } smlDevInfCTCapAddProperty(ctcap, property); property = NULL; } - property = smlDevInfNewProperty(error); - if (!property) + property = sml_dev_inf_property_new(); + if (!property) { + smlErrorSet(error, SML_ERROR_GENERIC, "Cannot create new instance of SmlDevInfProperty - out of memory."); + goto error; + } + if (!sml_dev_inf_property_set_prop_name(property, value, &gerror)) goto error; - smlDevInfPropertySetPropName(property, value); break; case SML_DEVINF_CTCAP_DATATYPE: if (property == NULL) goto error; if (param != NULL) { - GError *gerror = NULL; - if (!sml_dev_inf_prop_param_set_data_type(param, value, &gerror)) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); - g_error_free(gerror); + if (!sml_dev_inf_prop_param_set_data_type(param, value, &gerror)) goto error; - } - } else - smlDevInfPropertySetDataType(property, value); + } else { + if (!sml_dev_inf_property_set_data_type(property, value, &gerror)) + goto error; + } break; case SML_DEVINF_CTCAP_MAXOCCUR: if (property == NULL) goto error; - smlDevInfPropertySetMaxOccur(property, atoi(value)); + sml_dev_inf_property_set_max_occur(property, atoi(value)); break; case SML_DEVINF_CTCAP_MAXSIZE: if (property == NULL) goto error; - smlDevInfPropertySetMaxSize(property, atoi(value)); + if (!sml_dev_inf_property_set_max_size(property, atoi(value), &gerror)) + goto error; break; case SML_DEVINF_CTCAP_NOTRUNCATE: if (property == NULL) goto error; - smlDevInfPropertySetNoTruncate(property); + sml_dev_inf_property_set_no_truncate(property, TRUE); break; case SML_DEVINF_CTCAP_DISPLAYNAME: if (property == NULL) goto error; if (param != NULL) { - GError *gerror = NULL; - if (!sml_dev_inf_prop_param_set_display_name(param, value, &gerror)) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); - g_error_free(gerror); + if (!sml_dev_inf_prop_param_set_display_name(param, value, &gerror)) goto error; - } - } else - smlDevInfPropertySetDisplayName(property, value); + } else { + if (!sml_dev_inf_property_set_display_name(property, value, &gerror)) + goto error; + } break; case SML_DEVINF_CTCAP_VALENUM: if (property == NULL) goto error; if (param != NULL) { - GError *gerror = NULL; - if (!sml_dev_inf_prop_param_add_val_enum(param, value, &gerror)) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); - g_error_free(gerror); + if (!sml_dev_inf_prop_param_add_val_enum(param, value, &gerror)) goto error; - } - } else - smlDevInfPropertyAddValEnum(property, value); + } else { + if (!sml_dev_inf_property_add_val_enum(property, value, &gerror)) + goto error; + } break; case SML_DEVINF_CTCAP_PARAMNAME: if (property == NULL) goto error; if (param != NULL) { - smlDevInfPropertyAddPropParam(property, param); + if (!sml_dev_inf_property_add_param(property, param, &gerror)) + goto error; param = NULL; } param = sml_dev_inf_prop_param_new(); @@ -2810,7 +2813,8 @@ sml_dev_inf_prop_param_set_param_name(param, value, &gerror); break; case SML_DEVINF_CTCAP_SIZE: - smlDevInfPropertySetPropSize(property, atoi(value)); + if (!sml_dev_inf_property_set_size(property, atoi(value), &gerror)) + goto error; break; default: smlErrorSet(error, SML_ERROR_GENERIC, "Unknown CTCapType: %s", elem_name); @@ -2823,8 +2827,8 @@ goto error; } } - if (param != NULL) - smlDevInfPropertyAddPropParam(property, param); + if (param != NULL && sml_dev_inf_property_add_param(property, param, &gerror)) + goto error; if (property != NULL) smlDevInfCTCapAddProperty(ctcap, property); if (ctcap != NULL) @@ -2834,6 +2838,10 @@ return TRUE; error: + if (gerror) { + smlErrorSet(error, gerror->code, gerror->message); + g_error_free(gerror); + } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); if (value != NULL) smlSafeCFree(&value); @@ -2931,14 +2939,19 @@ CHECK_ERROR_REF smlAssert(parser); + GError *gerror = NULL; + SmlDevInfProperty *property = NULL; + if (!_smlXmlParserStep(parser)) { smlErrorSet(error, SML_ERROR_GENERIC, "Missing nodes"); goto error; } - SmlDevInfProperty *property = smlDevInfNewProperty(error); - if (!property) + property = sml_dev_inf_property_new(); + if (!property) { + smlErrorSet(error, SML_ERROR_GENERIC, "Cannot create new instance of SmlDevInfProperty - out of memory."); goto error; + } SmlDevInfPropParam *param; char *value = NULL; @@ -2976,34 +2989,41 @@ switch(type) { case SML_DEVINF_CTCAP_PROPNAME: - smlDevInfPropertySetPropName(property, value); + if(!sml_dev_inf_property_set_prop_name(property, value, &gerror)) + goto error; break; case SML_DEVINF_CTCAP_DATATYPE: - smlDevInfPropertySetDataType(property, value); + if (!sml_dev_inf_property_set_data_type(property, value, &gerror)) + goto error; break; case SML_DEVINF_CTCAP_MAXOCCUR: - smlDevInfPropertySetMaxOccur(property, atoi(value)); + sml_dev_inf_property_set_max_occur(property, atoi(value)); break; case SML_DEVINF_CTCAP_MAXSIZE: - smlDevInfPropertySetMaxSize(property, atoi(value)); + if (!sml_dev_inf_property_set_max_size(property, atoi(value), &gerror)) + goto error; break; case SML_DEVINF_CTCAP_NOTRUNCATE: - smlDevInfPropertySetNoTruncate(property); + sml_dev_inf_property_set_no_truncate(property, TRUE); break; case SML_DEVINF_CTCAP_DISPLAYNAME: - smlDevInfPropertySetDisplayName(property, value); + if (!sml_dev_inf_property_set_display_name(property, value, &gerror)) + goto error; break; case SML_DEVINF_CTCAP_VALENUM: - smlDevInfPropertyAddValEnum(property, value); + if (!sml_dev_inf_property_add_val_enum(property, value, &gerror)) + goto error; break; case SML_DEVINF_CTCAP_PROPPARAM: param = _smlXmlDevInfDataStoreParseCTCap12PropParam(parser, error); if (!param) goto error; - smlDevInfPropertyAddPropParam(property, param); + if (!sml_dev_inf_property_add_param(property, param, &gerror)) + goto error; break; case SML_DEVINF_CTCAP_SIZE: - smlDevInfPropertySetPropSize(property, atoi(value)); + if (!sml_dev_inf_property_set_size(property, atoi(value), &gerror)) + goto error; break; default: smlErrorSet(error, SML_ERROR_GENERIC, "Unknown CTCapType for Property: %s", elem_name); @@ -3021,9 +3041,15 @@ return property; error: + if (gerror) { + smlErrorSet(error, gerror->code, gerror->message); + g_error_free(gerror); + } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); if (value != NULL) smlSafeCFree(&value); + if (property) + g_object_unref(property); return NULL; } Modified: trunk/libsyncml/sml_devinf.c ============================================================================== --- trunk/libsyncml/sml_devinf.c Thu Jun 18 11:16:28 2009 (r1092) +++ trunk/libsyncml/sml_devinf.c Fri Jun 19 10:09:09 2009 (r1093) @@ -154,26 +154,7 @@ while (ctcap->properties) { SmlDevInfProperty *prop = ctcap->properties->data; ctcap->properties = g_list_remove(ctcap->properties, prop); - smlSafeCFree(&(prop->propName)); - if (prop->dataType) - smlSafeCFree(&(prop->dataType)); - if (prop->displayName) - smlSafeCFree(&(prop->displayName)); - /* if lists are removed - * then the data must be removed separately - */ - while (prop->valEnums) { - char *valEnum = prop->valEnums->data; - prop->valEnums = g_list_remove(prop->valEnums, valEnum); - smlSafeCFree(&valEnum); - } - while (prop->propParams) { - SmlDevInfPropParam *param = prop->propParams->data; - prop->propParams = g_list_remove(prop->propParams, param); - g_object_unref(param); - } - /* free Property itself */ - smlSafeFree((gpointer *) &prop); + g_object_unref(prop); } /* don't use ctcap here because the list must be cleaned up */ smlSafeFree((gpointer *)&ctcap); @@ -824,237 +805,6 @@ return NULL; } -/* Property stuff */ - -SmlDevInfProperty *smlDevInfNewProperty(SmlError **error) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, error); - CHECK_ERROR_REF - - SmlDevInfProperty *property = smlTryMalloc0(sizeof(SmlDevInfProperty), error); - if (!property) { - smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); - return NULL; - } - - property->propName = NULL; - property->dataType = NULL; - property->maxOccur = 0; - property->maxSize = 0; - property->noTruncate = FALSE; - property->displayName = NULL; - property->valEnums = NULL; - property->propParams = NULL; - - smlTrace(TRACE_EXIT, "%s", __func__); - return property; -} - -void smlDevInfPropertySetPropName( - SmlDevInfProperty *property, - const char *propName) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, property, VA_STRING(propName)); - smlAssert(property); - smlAssert(propName); - - if (property->propName != NULL) - smlSafeCFree(&(property->propName)); - property->propName = g_strdup(propName); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropertySetDataType( - SmlDevInfProperty *property, - const char *dataType) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, property, VA_STRING(dataType)); - smlAssert(property); - smlAssert(dataType); - - if (property->dataType != NULL) - smlSafeCFree(&(property->dataType)); - property->dataType = g_strdup(dataType); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropertySetMaxOccur( - SmlDevInfProperty *property, - unsigned int maxOccur) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %d)", __func__, property, maxOccur); - smlAssert(property); - - property->maxOccur = maxOccur; - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropertySetMaxSize( - SmlDevInfProperty *property, - unsigned int maxSize) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %d)", __func__, property, maxSize); - smlAssert(property); - - property->maxSize = maxSize; - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropertySetPropSize( - SmlDevInfProperty *property, - unsigned int propSize) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %d)", __func__, property, propSize); - smlAssert(property); - - property->propSize = propSize; - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropertySetNoTruncate( - SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - - property->noTruncate = TRUE; - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropertySetDisplayName( - SmlDevInfProperty *property, - const char *displayName) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, property, VA_STRING(displayName)); - smlAssert(property); - smlAssert(displayName); - - if (property->displayName != NULL) - smlSafeCFree(&(property->displayName)); - property->displayName = g_strdup(displayName); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropertyAddValEnum( - SmlDevInfProperty *property, - const char *valEnum) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, property, VA_STRING(valEnum)); - smlAssert(property); - smlAssert(valEnum); - property->valEnums = g_list_append(property->valEnums, g_strdup(valEnum)); - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropertyAddPropParam( - SmlDevInfProperty *property, - SmlDevInfPropParam *propParam) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, property, propParam); - smlAssert(property); - smlAssert(propParam); - property->propParams = g_list_append(property->propParams, propParam); - smlTrace(TRACE_EXIT, "%s", __func__); -} - -char *smlDevInfPropertyGetPropName(const SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - char *result = g_strdup(property->propName); - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); - return result; -} - -char *smlDevInfPropertyGetDataType(const SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - char *result = g_strdup(property->dataType); - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); - return result; -} - -unsigned int smlDevInfPropertyGetMaxOccur(const SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - smlTrace(TRACE_EXIT, "%s - %d", __func__, property->maxOccur); - return property->maxOccur; -} - -unsigned int smlDevInfPropertyGetMaxSize(const SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - smlTrace(TRACE_EXIT, "%s - %d", __func__, property->maxSize); - return property->maxSize; -} - -SmlBool smlDevInfPropertyGetNoTruncate(const SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - smlTrace(TRACE_EXIT, "%s - %d", __func__, property->noTruncate); - return property->noTruncate; -} - -char *smlDevInfPropertyGetDisplayName(const SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - char *result = g_strdup(property->displayName); - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); - return result; -} - -unsigned int smlDevInfPropertyNumValEnums(const SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - unsigned int num = g_list_length(property->valEnums); - smlTrace(TRACE_EXIT, "%s - %d", __func__, num); - return num; -} - -char *smlDevInfPropertyGetNthValEnum( - const SmlDevInfProperty *property, - unsigned int n) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %d)", __func__, property, n); - smlAssert(property); - char *result = g_strdup(g_list_nth_data(property->valEnums, n)); - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); - return result; -} - -unsigned int smlDevInfPropertyNumPropParams(const SmlDevInfProperty *property) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, property); - smlAssert(property); - unsigned int num = g_list_length(property->propParams); - smlTrace(TRACE_EXIT, "%s - %d", __func__, num); - return num; -} - -const SmlDevInfPropParam *smlDevInfPropertyGetNthPropParam( - const SmlDevInfProperty *property, - unsigned int n) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %d)", __func__, property, n); - smlAssert(property); - SmlDevInfPropParam *param = g_list_nth_data(property->propParams, n); - smlTrace(TRACE_EXIT, "%s - %p", __func__, param); - return param; -} - /* CTCap stuff */ SmlDevInfCTCap *smlDevInfNewCTCap(SmlError **error) Modified: trunk/libsyncml/sml_devinf.h ============================================================================== --- trunk/libsyncml/sml_devinf.h Thu Jun 18 11:16:28 2009 (r1092) +++ trunk/libsyncml/sml_devinf.h Fri Jun 19 10:09:09 2009 (r1093) @@ -32,6 +32,7 @@ #include <libsyncml/dev_inf_api/sml_dev_inf_content_type.h> #include <libsyncml/dev_inf_api/sml_dev_inf_prop_param.h> +#include <libsyncml/dev_inf_api/sml_dev_inf_property.h> SmlDevInfDevTyp smlDevInfDevTypeFromString(const char *name, SmlError **error); const char *smlDevInfDevTypeToString(SmlDevInfDevTyp type, SmlError **error); @@ -111,61 +112,8 @@ /* so we can generate SyncML 1.0, 1.1 and 1.2 devinf from this structure */ /* the CTCap will be assigned to a datastore if CTType and VerCT match */ -/* Property stuff */ - -SmlDevInfProperty *smlDevInfNewProperty(SmlError **error); -void smlDevInfPropertySetPropName( // REQUIRED - SmlDevInfProperty *property, - const char *propName); -void smlDevInfPropertySetPropSize( - SmlDevInfProperty *property, - unsigned int propSize); -void smlDevInfPropertySetDataType( - SmlDevInfProperty *property, - const char *dataType); -void smlDevInfPropertySetMaxOccur( - SmlDevInfProperty *property, - unsigned int maxOccur); -void smlDevInfPropertySetMaxSize( - SmlDevInfProperty *property, - unsigned int maxSize); -void smlDevInfPropertySetNoTruncate( - SmlDevInfProperty *property); -void smlDevInfPropertySetDisplayName( - SmlDevInfProperty *property, - const char *displayName); -void smlDevInfPropertyAddValEnum( - SmlDevInfProperty *property, - const char *valEnum); -void smlDevInfPropertyAddPropParam( - SmlDevInfProperty *property, - SmlDevInfPropParam *propParam); - -char *smlDevInfPropertyGetPropName(const SmlDevInfProperty *property... [truncated message content] |
From: <svn...@op...> - 2009-06-18 09:16:33
|
Author: bellmich Date: Thu Jun 18 11:16:28 2009 New Revision: 1092 URL: http://libsyncml.opensync.org/changeset/1092 Log: - consolidated naming conventions - added license to new files Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.h trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_devinf.h trunk/tests/check_dev_inf_prop_param.c Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Thu Jun 18 11:16:28 2009 (r1092) @@ -87,7 +87,7 @@ /* FIXME: missing error handling */ GError *gerror = NULL; - sml_dev_inf_prop_param_set_paramname(param, name, &gerror); + sml_dev_inf_prop_param_set_param_name(param, name, &gerror); smlDevInfPropertyAddPropParam(prop, param); smlTrace(TRACE_EXIT, "%s", __func__); @@ -153,12 +153,12 @@ smlDevInfCTCapSetVerCT(ctcap, "2.1"); _ADD_CTCAP_PROPERTY_BY_NAME("ADR") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "PARCEL", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "POSTAL", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "INTL", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "DOM", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "PARCEL", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "POSTAL", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "INTL", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "DOM", &gerror); _ADD_PROPERTY_PARAM("HOME"); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("PARCEL"); @@ -171,24 +171,24 @@ _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("END","VCARD") _ADD_CTCAP_PROPERTY_BY_NAME("EMAIL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "INTERNET", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "INTERNET", &gerror); _ADD_PROPERTY_PARAM("INTERNET"); _ADD_CTCAP_PROPERTY_BY_NAME("FN") _ADD_CTCAP_PROPERTY_BY_NAME("GEO") _ADD_CTCAP_PROPERTY_BY_NAME("KEY") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "X509", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "PGP", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "X509", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "PGP", &gerror); _ADD_PROPERTY_PARAM("X509"); _ADD_PROPERTY_PARAM("PGP"); _ADD_CTCAP_PROPERTY_BY_NAME("LABEL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "PARCEL", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "POSTAL", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "INTL", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "DOM", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "PARCEL", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "POSTAL", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "INTL", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "DOM", &gerror); _ADD_PROPERTY_PARAM("HOME"); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("PARCEL"); @@ -197,7 +197,7 @@ _ADD_PROPERTY_PARAM("DOM"); _ADD_CTCAP_PROPERTY_BY_NAME("LOGO") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "JPEG", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "JPEG", &gerror); _ADD_PROPERTY_PARAM("JPEG"); _ADD_CTCAP_PROPERTY_BY_NAME("MAILER") _ADD_CTCAP_PROPERTY_BY_NAME("N") @@ -205,32 +205,32 @@ _ADD_CTCAP_PROPERTY_BY_NAME("ORG") _ADD_CTCAP_PROPERTY_BY_NAME("PHOTO") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "JPEG", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "JPEG", &gerror); _ADD_PROPERTY_PARAM("JPEG"); _ADD_CTCAP_PROPERTY_BY_NAME("REV") _ADD_CTCAP_PROPERTY_BY_NAME("ROLE") _ADD_CTCAP_PROPERTY_BY_NAME("SOUND") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "AIFF", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "PCM", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "WAVE", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "AIFF", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "PCM", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "WAVE", &gerror); _ADD_PROPERTY_PARAM("AIFF"); _ADD_PROPERTY_PARAM("PCM"); _ADD_PROPERTY_PARAM("WAVE"); _ADD_CTCAP_PROPERTY_BY_NAME("TEL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "VOICE", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "PREF", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "PAGER", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "MSG", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "MODEM", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "ISDN", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "FAX", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "CELL", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "CAR", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "BBS", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "VOICE", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "PREF", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "PAGER", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "MSG", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "MODEM", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "ISDN", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "FAX", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "CELL", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "CAR", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "BBS", &gerror); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("VOICE"); _ADD_PROPERTY_PARAM("PREF"); @@ -248,8 +248,8 @@ _ADD_CTCAP_PROPERTY_BY_NAME("UID") _ADD_CTCAP_PROPERTY_BY_NAME("URL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("HOME"); _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("VERSION", "2.1") @@ -280,16 +280,16 @@ _ADD_CTCAP_PROPERTY_BY_NAME("URL") _ADD_CTCAP_PROPERTY_BY_NAME("TEL") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "CELL", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "FAX", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "MODEM", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "VOICE", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "CELL", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "FAX", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "MODEM", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "VOICE", &gerror); _ADD_CTCAP_PROPERTY_BY_NAME("ADR") _ADD_PROPERTY_PARAM("TYPE") - sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); - sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_val_enum(param, "WORK", &gerror); _ADD_CTCAP_PROPERTY_BY_NAME("BDAY") _ADD_CTCAP_PROPERTY_BY_NAME("NOTE") _ADD_CTCAP_PROPERTY_BY_NAME("PHOTO") Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Thu Jun 18 11:16:28 2009 (r1092) @@ -1,4 +1,22 @@ -/* sml_dev_inf_content_type.c */ +/* sml_dev_inf_content_type.c + * + * 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 Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ #include "sml_dev_inf_content_type.h" Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h Thu Jun 18 11:16:28 2009 (r1092) @@ -1,4 +1,23 @@ -/* sml_dev_inf_content_type.h */ +/* sml_dev_inf_content_type.h + * + * 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 Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + #ifndef __SML_DEV_INF_CONTENT_TYPE_H__ #define __SML_DEV_INF_CONTENT_TYPE_H__ Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c Thu Jun 18 11:16:28 2009 (r1092) @@ -1,4 +1,23 @@ -/* sml_dev_inf_prop_param.c */ +/* sml_dev_inf_prop_param.c + * + * 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 Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + #include "sml_dev_inf_prop_param.h" #include <libsyncml/syncml.h> @@ -8,18 +27,18 @@ enum { PROP_0, - PROP_PARAMNAME, - PROP_DATATYPE, - PROP_DISPLAYNAME, - PROP_VALENUMS + PROP_PARAM_NAME, + PROP_DATA_TYPE, + PROP_DISPLAY_NAME, + PROP_VAL_ENUMS }; struct _SmlDevInfPropParamPrivate { - gchar* paramname; - gchar* datatype; - gchar* displayname; - GList* valenums; + gchar* param_name; + gchar* data_type; + gchar* display_name; + GList* val_enums; }; static void @@ -29,17 +48,17 @@ GParamSpec *pspec) { switch (property_id) { - case PROP_PARAMNAME: - g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->paramname); + case PROP_PARAM_NAME: + g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->param_name); break; - case PROP_DATATYPE: - g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->datatype); + case PROP_DATA_TYPE: + g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->data_type); break; - case PROP_DISPLAYNAME: - g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->displayname); + case PROP_DISPLAY_NAME: + g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->display_name); break; - case PROP_VALENUMS: - g_value_set_pointer (value, SML_DEV_INF_PROP_PARAM (object)->priv->valenums); + case PROP_VAL_ENUMS: + g_value_set_pointer (value, SML_DEV_INF_PROP_PARAM (object)->priv->val_enums); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -53,20 +72,20 @@ GParamSpec *pspec) { switch (property_id) { - case PROP_PARAMNAME: - g_free (SML_DEV_INF_PROP_PARAM (object)->priv->paramname); - SML_DEV_INF_PROP_PARAM (object)->priv->paramname = g_strdup (g_value_get_string (value)); + case PROP_PARAM_NAME: + g_free (SML_DEV_INF_PROP_PARAM (object)->priv->param_name); + SML_DEV_INF_PROP_PARAM (object)->priv->param_name = g_strdup (g_value_get_string (value)); break; - case PROP_DATATYPE: - g_free (SML_DEV_INF_PROP_PARAM (object)->priv->datatype); - SML_DEV_INF_PROP_PARAM (object)->priv->datatype = g_strdup (g_value_get_string (value)); + case PROP_DATA_TYPE: + g_free (SML_DEV_INF_PROP_PARAM (object)->priv->data_type); + SML_DEV_INF_PROP_PARAM (object)->priv->data_type = g_strdup (g_value_get_string (value)); break; - case PROP_DISPLAYNAME: - g_free (SML_DEV_INF_PROP_PARAM (object)->priv->displayname); - SML_DEV_INF_PROP_PARAM (object)->priv->displayname = g_strdup (g_value_get_string (value)); + case PROP_DISPLAY_NAME: + g_free (SML_DEV_INF_PROP_PARAM (object)->priv->display_name); + SML_DEV_INF_PROP_PARAM (object)->priv->display_name = g_strdup (g_value_get_string (value)); break; - case PROP_VALENUMS: - SML_DEV_INF_PROP_PARAM (object)->priv->valenums = (GList *) g_value_get_pointer(value); + case PROP_VAL_ENUMS: + SML_DEV_INF_PROP_PARAM (object)->priv->val_enums = (GList *) g_value_get_pointer(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -77,13 +96,13 @@ sml_dev_inf_prop_param_finalize (GObject *object) { SmlDevInfPropParam *self = (SmlDevInfPropParam *) object; - g_free(self->priv->paramname); - g_free(self->priv->datatype); - g_free(self->priv->displayname); - while(self->priv->valenums) { - gchar *valenum = self->priv->valenums->data; - self->priv->valenums = g_list_remove(self->priv->valenums, valenum); - g_free(valenum); + g_free(self->priv->param_name); + g_free(self->priv->data_type); + g_free(self->priv->display_name); + while(self->priv->val_enums) { + gchar *val_enum = self->priv->val_enums->data; + self->priv->val_enums = g_list_remove(self->priv->val_enums, val_enum); + g_free(val_enum); } G_OBJECT_CLASS (sml_dev_inf_prop_param_parent_class)->finalize (object); } @@ -105,7 +124,7 @@ * The property. */ g_object_class_install_property (object_class, - PROP_PARAMNAME, + PROP_PARAM_NAME, g_param_spec_string ("ParamName", "", "", @@ -117,7 +136,7 @@ * The property. */ g_object_class_install_property (object_class, - PROP_DATATYPE, + PROP_DATA_TYPE, g_param_spec_string ("DataType", "", "", @@ -129,7 +148,7 @@ * The property. */ g_object_class_install_property (object_class, - PROP_DISPLAYNAME, + PROP_DISPLAY_NAME, g_param_spec_string ("DisplayName", "", "", @@ -141,7 +160,7 @@ * The property. */ g_object_class_install_property (object_class, - PROP_VALENUMS, + PROP_VAL_ENUMS, g_param_spec_pointer ("ValEnums", "", NULL, @@ -171,7 +190,7 @@ } /** - * sml_dev_inf_prop_param_get_paramname: + * sml_dev_inf_prop_param_get_param_name: * @self: A #SmlDevInfPropParam * * Gets the property. @@ -179,32 +198,32 @@ * Return value: */ G_CONST_RETURN gchar* -sml_dev_inf_prop_param_get_paramname (SmlDevInfPropParam *self) +sml_dev_inf_prop_param_get_param_name (SmlDevInfPropParam *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); - return self->priv->paramname; + return self->priv->param_name; } /** - * sml_dev_inf_prop_param_set_paramname: + * sml_dev_inf_prop_param_set_param_name: * @self: A #SmlDevInfPropParam * @paramname: * * Sets the property. */ gboolean -sml_dev_inf_prop_param_set_paramname (SmlDevInfPropParam *self, - const gchar* paramname, - GError **error) +sml_dev_inf_prop_param_set_param_name (SmlDevInfPropParam *self, + const gchar* param_name, + GError **error) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), FALSE); - g_free (self->priv->paramname); - self->priv->paramname = g_strdup (paramname); + g_free (self->priv->param_name); + self->priv->param_name = g_strdup (param_name); return TRUE; } /** - * sml_dev_inf_prop_param_get_datatype: + * sml_dev_inf_prop_param_get_data_type: * @self: A #SmlDevInfPropParam * * Gets the property. @@ -212,32 +231,32 @@ * Return value: */ G_CONST_RETURN gchar* -sml_dev_inf_prop_param_get_datatype (SmlDevInfPropParam *self) +sml_dev_inf_prop_param_get_data_type (SmlDevInfPropParam *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); - return self->priv->datatype; + return self->priv->data_type; } /** - * sml_dev_inf_prop_param_set_datatype: + * sml_dev_inf_prop_param_set_data_type: * @self: A #SmlDevInfPropParam * @datatype: * * Sets the property. */ gboolean -sml_dev_inf_prop_param_set_datatype (SmlDevInfPropParam *self, - const gchar* datatype, - GError **error) +sml_dev_inf_prop_param_set_data_type (SmlDevInfPropParam *self, + const gchar* data_type, + GError **error) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), FALSE); - g_free (self->priv->datatype); - self->priv->datatype = g_strdup (datatype); + g_free (self->priv->data_type); + self->priv->data_type = g_strdup (data_type); return TRUE; } /** - * sml_dev_inf_prop_param_get_displayname: + * sml_dev_inf_prop_param_get_display_name: * @self: A #SmlDevInfPropParam * * Gets the property. @@ -245,71 +264,71 @@ * Return value: */ G_CONST_RETURN gchar* -sml_dev_inf_prop_param_get_displayname (SmlDevInfPropParam *self) +sml_dev_inf_prop_param_get_display_name (SmlDevInfPropParam *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); - return self->priv->displayname; + return self->priv->display_name; } /** - * sml_dev_inf_prop_param_set_displayname: + * sml_dev_inf_prop_param_set_display_name: * @self: A #SmlDevInfPropParam * @displayname: * * Sets the property. */ gboolean -sml_dev_inf_prop_param_set_displayname (SmlDevInfPropParam *self, - const gchar* displayname, - GError **error) +sml_dev_inf_prop_param_set_display_name (SmlDevInfPropParam *self, + const gchar* display_name, + GError **error) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), FALSE); - g_free (self->priv->displayname); - self->priv->displayname = g_strdup (displayname); + g_free (self->priv->display_name); + self->priv->display_name = g_strdup (display_name); return TRUE; } /** - * sml_dev_inf_prop_param_num_valenums: + * sml_dev_inf_prop_param_num_val_enums: * @self: A #SmlDevInfPropParam * * */ guint -sml_dev_inf_prop_param_num_valenums (SmlDevInfPropParam *self) +sml_dev_inf_prop_param_num_val_enums (SmlDevInfPropParam *self) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), 0); - return g_list_length(self->priv->valenums); + return g_list_length(self->priv->val_enums); } /** - * sml_dev_inf_prop_param_get_nth_valenum: + * sml_dev_inf_prop_param_get_nth_val_enum: * @self: A #SmlDevInfPropParam * * */ G_CONST_RETURN gchar* -sml_dev_inf_prop_param_get_nth_valenum (SmlDevInfPropParam *self, +sml_dev_inf_prop_param_get_nth_val_enum (SmlDevInfPropParam *self, guint n) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); - return (gchar *)g_list_nth_data(self->priv->valenums, n); + return (gchar *)g_list_nth_data(self->priv->val_enums, n); } /** - * sml_dev_inf_prop_param_add_valenum: + * sml_dev_inf_prop_param_add_val_enum: * @self: A #SmlDevInfPropParam * * */ gboolean -sml_dev_inf_prop_param_add_valenum (SmlDevInfPropParam *self, - const gchar* valEnum, +sml_dev_inf_prop_param_add_val_enum (SmlDevInfPropParam *self, + const gchar* val_enum, GError **error) { g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), FALSE); - self->priv->valenums = g_list_append(self->priv->valenums, g_strdup(valEnum)); - if (!self->priv->valenums) { + self->priv->val_enums = g_list_append(self->priv->val_enums, g_strdup(val_enum)); + if (!self->priv->val_enums) { *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "Cannot add ValEnum to ValEnum list of PropParam."); return FALSE; } Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.h ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.h Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.h Thu Jun 18 11:16:28 2009 (r1092) @@ -1,4 +1,23 @@ -/* sml_dev_inf_prop_param.h */ +/* sml_dev_inf_prop_param.h + * + * 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 Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + #ifndef __SML_DEV_INF_PROP_PARAM_H__ #define __SML_DEV_INF_PROP_PARAM_H__ @@ -34,15 +53,15 @@ GType sml_dev_inf_prop_param_get_type (void); SmlDevInfPropParam* sml_dev_inf_prop_param_new (void); -G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_paramname (SmlDevInfPropParam *self); -gboolean sml_dev_inf_prop_param_set_paramname (SmlDevInfPropParam *self, const gchar* paramname, GError **error); -G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_datatype (SmlDevInfPropParam *self); -gboolean sml_dev_inf_prop_param_set_datatype (SmlDevInfPropParam *self, const gchar* datatype, GError **error); -G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_displayname (SmlDevInfPropParam *self); -gboolean sml_dev_inf_prop_param_set_displayname (SmlDevInfPropParam *self, const gchar* displayname, GError **error); -gsize sml_dev_inf_prop_param_num_valenums (SmlDevInfPropParam *self); -G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_nth_valenum (SmlDevInfPropParam *self, gsize n); -gboolean sml_dev_inf_prop_param_add_valenum (SmlDevInfPropParam *self, const gchar* valEnum, GError **error); +G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_param_name (SmlDevInfPropParam *self); +gboolean sml_dev_inf_prop_param_set_param_name (SmlDevInfPropParam *self, const gchar* param_name, GError **error); +G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_data_type (SmlDevInfPropParam *self); +gboolean sml_dev_inf_prop_param_set_data_type (SmlDevInfPropParam *self, const gchar* data_type, GError **error); +G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_display_name (SmlDevInfPropParam *self); +gboolean sml_dev_inf_prop_param_set_display_name (SmlDevInfPropParam *self, const gchar* display_name, GError **error); +gsize sml_dev_inf_prop_param_num_val_enums (SmlDevInfPropParam *self); +G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_nth_val_enum (SmlDevInfPropParam *self, gsize n); +gboolean sml_dev_inf_prop_param_add_val_enum (SmlDevInfPropParam *self, const gchar* val_enum, GError **error); G_END_DECLS Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/libsyncml/parser/sml_xml_assm.c Thu Jun 18 11:16:28 2009 (r1092) @@ -2163,26 +2163,26 @@ } // add ParamName - if (sml_dev_inf_prop_param_get_paramname(param) != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_PARAMNAME, sml_dev_inf_prop_param_get_paramname(param), error)) + if (sml_dev_inf_prop_param_get_param_name(param) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_PARAMNAME, sml_dev_inf_prop_param_get_param_name(param), error)) goto error; // add DataType - if (sml_dev_inf_prop_param_get_datatype(param) != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DATATYPE, sml_dev_inf_prop_param_get_datatype(param), error)) + if (sml_dev_inf_prop_param_get_data_type(param) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DATATYPE, sml_dev_inf_prop_param_get_data_type(param), error)) goto error; // add DisplayName - if (sml_dev_inf_prop_param_get_displayname(param) != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DISPLAYNAME, sml_dev_inf_prop_param_get_displayname(param), error)) + if (sml_dev_inf_prop_param_get_display_name(param) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DISPLAYNAME, sml_dev_inf_prop_param_get_display_name(param), error)) goto error; // add values - guint length = sml_dev_inf_prop_param_num_valenums(param); + guint length = sml_dev_inf_prop_param_num_val_enums(param); guint n; for (n=0; n < length; n++) { - const char *valEnum = sml_dev_inf_prop_param_get_nth_valenum(param, n); + const char *valEnum = sml_dev_inf_prop_param_get_nth_val_enum(param, n); // add ValEnum if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VALENUM, valEnum, error)) Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/libsyncml/parser/sml_xml_parse.c Thu Jun 18 11:16:28 2009 (r1092) @@ -2744,7 +2744,7 @@ goto error; if (param != NULL) { GError *gerror = NULL; - if (!sml_dev_inf_prop_param_set_datatype(param, value, &gerror)) { + if (!sml_dev_inf_prop_param_set_data_type(param, value, &gerror)) { smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); g_error_free(gerror); goto error; @@ -2772,7 +2772,7 @@ goto error; if (param != NULL) { GError *gerror = NULL; - if (!sml_dev_inf_prop_param_set_displayname(param, value, &gerror)) { + if (!sml_dev_inf_prop_param_set_display_name(param, value, &gerror)) { smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); g_error_free(gerror); goto error; @@ -2785,7 +2785,7 @@ goto error; if (param != NULL) { GError *gerror = NULL; - if (!sml_dev_inf_prop_param_add_valenum(param, value, &gerror)) { + if (!sml_dev_inf_prop_param_add_val_enum(param, value, &gerror)) { smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); g_error_free(gerror); goto error; @@ -2807,7 +2807,7 @@ goto error; } GError *gerror = NULL; - sml_dev_inf_prop_param_set_paramname(param, value, &gerror); + sml_dev_inf_prop_param_set_param_name(param, value, &gerror); break; case SML_DEVINF_CTCAP_SIZE: smlDevInfPropertySetPropSize(property, atoi(value)); @@ -2892,16 +2892,16 @@ switch(type) { case SML_DEVINF_CTCAP_PARAMNAME: - sml_dev_inf_prop_param_set_paramname(param, value, &gerror); + sml_dev_inf_prop_param_set_param_name(param, value, &gerror); break; case SML_DEVINF_CTCAP_DATATYPE: - sml_dev_inf_prop_param_set_datatype(param, value, &gerror); + sml_dev_inf_prop_param_set_data_type(param, value, &gerror); break; case SML_DEVINF_CTCAP_DISPLAYNAME: - sml_dev_inf_prop_param_set_displayname(param, value, &gerror); + sml_dev_inf_prop_param_set_display_name(param, value, &gerror); break; case SML_DEVINF_CTCAP_VALENUM: - sml_dev_inf_prop_param_add_valenum(param, value, &gerror); + sml_dev_inf_prop_param_add_val_enum(param, value, &gerror); break; default: smlErrorSet(error, SML_ERROR_GENERIC, "Unknown CTCapType for PropParam: %s", elem_name); Modified: trunk/libsyncml/sml_devinf.h ============================================================================== --- trunk/libsyncml/sml_devinf.h Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/libsyncml/sml_devinf.h Thu Jun 18 11:16:28 2009 (r1092) @@ -111,30 +111,6 @@ /* so we can generate SyncML 1.0, 1.1 and 1.2 devinf from this structure */ /* the CTCap will be assigned to a datastore if CTType and VerCT match */ -// /* PropParam stuff */ -// -// SmlDevInfPropParam *smlDevInfNewPropParam(SmlError **error); -// void smlDevInfPropParamSetParamName( // REQUIRED -// SmlDevInfPropParam *propParam, -// const char *paramName); -// void smlDevInfPropParamSetDataType( -// SmlDevInfPropParam *propParam, -// const char *dataType); -// void smlDevInfPropParamSetDisplayName( -// SmlDevInfPropParam *propParam, -// const char *displayName); -// void smlDevInfPropParamAddValEnum( -// SmlDevInfPropParam *propParam, -// const char *valEnum); -// -// char *smlDevInfPropParamGetParamName(const SmlDevInfPropParam *propParam); -// char *smlDevInfPropParamGetDataType(const SmlDevInfPropParam *propParam); -// char *smlDevInfPropParamGetDisplayName(const SmlDevInfPropParam *propParam); -// unsigned int smlDevInfPropParamNumValEnums(const SmlDevInfPropParam *propParam); -// char *smlDevInfPropParamGetNthValEnum( -// const SmlDevInfPropParam *propParam, -// unsigned int n); - /* Property stuff */ SmlDevInfProperty *smlDevInfNewProperty(SmlError **error); Modified: trunk/tests/check_dev_inf_prop_param.c ============================================================================== --- trunk/tests/check_dev_inf_prop_param.c Wed Jun 17 18:07:47 2009 (r1091) +++ trunk/tests/check_dev_inf_prop_param.c Thu Jun 18 11:16:28 2009 (r1092) @@ -41,21 +41,21 @@ SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, "", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - - sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, "", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - - sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, "", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_param_name(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_param_name(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_param_name(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_prop_param_set_data_type(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_data_type(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_data_type(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_prop_param_set_display_name(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_display_name(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_display_name(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); g_object_unref(propParam); } @@ -69,25 +69,25 @@ SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) == NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) == NULL, NULL); - - sml_fail_unless(sml_dev_inf_prop_param_get_datatype(propParam) == NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_get_datatype(propParam) == NULL, NULL); - - sml_fail_unless(sml_dev_inf_prop_param_get_displayname(propParam) == NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_get_displayname(propParam) == NULL, NULL); - - sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 0, NULL); - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 1, NULL); - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 2, NULL); - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 3, NULL); + sml_fail_unless(sml_dev_inf_prop_param_get_param_name(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_param_name(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_param_name(propParam) == NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_data_type(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_data_type(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_data_type(propParam) == NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_display_name(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_display_name(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_display_name(propParam) == NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_num_val_enums(propParam) == 0, NULL); + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_val_enums(propParam) == 1, NULL); + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_val_enums(propParam) == 2, NULL); + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_val_enums(propParam) == 3, NULL); g_object_unref(propParam); } @@ -101,11 +101,11 @@ SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, "property parameter name", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, "property parameter data type", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, "property parameter display name", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "property parameter first value of enumeration", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "property parameter second value of enumeration", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_param_name(propParam, "property parameter name", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_data_type(propParam, "property parameter data type", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_display_name(propParam, "property parameter display name", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, "property parameter first value of enumeration", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, "property parameter second value of enumeration", &error), "%s", error?error->message:"No GError set."); g_object_unref(propParam); } @@ -119,34 +119,34 @@ SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) == NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, "test_1", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) != NULL, NULL); - sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_paramname(propParam), "test_1") == 0, NULL); - - sml_fail_unless(sml_dev_inf_prop_param_get_datatype(propParam) == NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, "test_2", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_get_datatype(propParam) != NULL, NULL); - sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_datatype(propParam), "test_2") == 0, NULL); - - sml_fail_unless(sml_dev_inf_prop_param_get_displayname(propParam) == NULL, NULL); - sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, "test_3", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_get_displayname(propParam) != NULL, NULL); - sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_displayname(propParam), "test_3") == 0, NULL); - - sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 0, NULL); - - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "test_4", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 1, NULL); - sml_fail_unless(sml_dev_inf_prop_param_get_nth_valenum(propParam, 0) != NULL, NULL); - sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_valenum(propParam, 0), "test_4") ==0, NULL); - - sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "test_5", &error), "%s", error?error->message:"No GError set."); - sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 2, NULL); - sml_fail_unless(sml_dev_inf_prop_param_get_nth_valenum(propParam, 0) != NULL, NULL); - sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_valenum(propParam, 0), "test_4") ==0, NULL); - sml_fail_unless(sml_dev_inf_prop_param_get_nth_valenum(propParam, 1) != NULL, NULL); - sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_valenum(propParam, 1), "test_5") ==0, NULL); + sml_fail_unless(sml_dev_inf_prop_param_get_param_name(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_param_name(propParam, "test_1", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_param_name(propParam) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_param_name(propParam), "test_1") == 0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_data_type(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_data_type(propParam, "test_2", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_data_type(propParam) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_data_type(propParam), "test_2") == 0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_display_name(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_display_name(propParam, "test_3", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_display_name(propParam) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_display_name(propParam), "test_3") == 0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_num_val_enums(propParam) == 0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, "test_4", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_val_enums(propParam) == 1, NULL); + sml_fail_unless(sml_dev_inf_prop_param_get_nth_val_enum(propParam, 0) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_val_enum(propParam, 0), "test_4") ==0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_add_val_enum(propParam, "test_5", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_val_enums(propParam) == 2, NULL); + sml_fail_unless(sml_dev_inf_prop_param_get_nth_val_enum(propParam, 0) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_val_enum(propParam, 0), "test_4") ==0, NULL); + sml_fail_unless(sml_dev_inf_prop_param_get_nth_val_enum(propParam, 1) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_val_enum(propParam, 1), "test_5") ==0, NULL); g_object_unref(propParam); } @@ -159,15 +159,15 @@ GError *error = NULL; SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); sml_fail_unless(propParam != NULL, "Cannot create SmlDevInfPropParam."); - sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, "test name", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_param_name(propParam, "test name", &error), "%s", error?error->message:"No GError set."); g_object_ref(propParam); - sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) != NULL, "The property parameter name was not set."); + sml_fail_unless(sml_dev_inf_prop_param_get_param_name(propParam) != NULL, "The property parameter name was not set."); g_object_unref(propParam); - sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) != NULL, "The property parameter name is already cleaned up."); + sml_fail_unless(sml_dev_inf_prop_param_get_param_name(propParam) != NULL, "The property parameter name is already cleaned up."); g_object_unref(propParam); } |
From: <svn...@op...> - 2009-06-17 16:08:03
|
Author: bellmich Date: Wed Jun 17 18:07:47 2009 New Revision: 1091 URL: http://libsyncml.opensync.org/changeset/1091 Log: migrated SmlDevInfPropParam to new GObject style The gobject introspection works for this new object. Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.h trunk/tests/check_dev_inf_prop_param.c Modified: trunk/libsyncml/CMakeLists.txt trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_command.h trunk/libsyncml/sml_devinf.c trunk/libsyncml/sml_devinf.h trunk/libsyncml/sml_error.h trunk/libsyncml/syncml.h trunk/tests/CMakeLists.txt trunk/tests/check_dev_inf_content_type.c trunk/tests/check_xml_parser.c Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/CMakeLists.txt Wed Jun 17 18:07:47 2009 (r1091) @@ -33,6 +33,7 @@ parser/sml_wbxml.c parser/sml_xml_assm.c parser/sml_xml_parse.c + dev_inf_api/sml_dev_inf_prop_param.c dev_inf_api/sml_dev_inf_content_type.c ) @@ -95,6 +96,7 @@ INSTALL( FILES dev_inf_api/sml_dev_inf_content_type.h + dev_inf_api/sml_dev_inf_prop_param.h DESTINATION ${LIBSYNCML_INCLUDE_DIR}/libsyncml/dev_inf_api ) Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Wed Jun 17 18:07:47 2009 (r1091) @@ -79,11 +79,15 @@ smlAssert(prop); smlAssert(name); - SmlDevInfPropParam *param = smlDevInfNewPropParam(error); - if (!param) + SmlDevInfPropParam *param = sml_dev_inf_prop_param_new(); + if (!param) { + smlErrorSet(error, SML_ERROR_GENERIC, "Cannot create new PropParam for SyncML device information."); goto error; + } - smlDevInfPropParamSetParamName(param, name); + /* FIXME: missing error handling */ + GError *gerror = NULL; + sml_dev_inf_prop_param_set_paramname(param, name, &gerror); smlDevInfPropertyAddPropParam(prop, param); smlTrace(TRACE_EXIT, "%s", __func__); @@ -121,8 +125,6 @@ GError *gerror = NULL; SmlDevInfContentType *ct = sml_dev_inf_content_type_new(cttype, verct, &gerror); if (!ct) { - smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); - g_error_free(gerror); goto error; } @@ -151,12 +153,12 @@ smlDevInfCTCapSetVerCT(ctcap, "2.1"); _ADD_CTCAP_PROPERTY_BY_NAME("ADR") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "HOME"); - smlDevInfPropParamAddValEnum(param, "WORK"); - smlDevInfPropParamAddValEnum(param, "PARCEL"); - smlDevInfPropParamAddValEnum(param, "POSTAL"); - smlDevInfPropParamAddValEnum(param, "INTL"); - smlDevInfPropParamAddValEnum(param, "DOM"); + sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "PARCEL", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "POSTAL", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "INTL", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "DOM", &gerror); _ADD_PROPERTY_PARAM("HOME"); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("PARCEL"); @@ -169,24 +171,24 @@ _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("END","VCARD") _ADD_CTCAP_PROPERTY_BY_NAME("EMAIL") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "INTERNET"); + sml_dev_inf_prop_param_add_valenum(param, "INTERNET", &gerror); _ADD_PROPERTY_PARAM("INTERNET"); _ADD_CTCAP_PROPERTY_BY_NAME("FN") _ADD_CTCAP_PROPERTY_BY_NAME("GEO") _ADD_CTCAP_PROPERTY_BY_NAME("KEY") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "X509"); - smlDevInfPropParamAddValEnum(param, "PGP"); + sml_dev_inf_prop_param_add_valenum(param, "X509", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "PGP", &gerror); _ADD_PROPERTY_PARAM("X509"); _ADD_PROPERTY_PARAM("PGP"); _ADD_CTCAP_PROPERTY_BY_NAME("LABEL") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "HOME"); - smlDevInfPropParamAddValEnum(param, "WORK"); - smlDevInfPropParamAddValEnum(param, "PARCEL"); - smlDevInfPropParamAddValEnum(param, "POSTAL"); - smlDevInfPropParamAddValEnum(param, "INTL"); - smlDevInfPropParamAddValEnum(param, "DOM"); + sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "PARCEL", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "POSTAL", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "INTL", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "DOM", &gerror); _ADD_PROPERTY_PARAM("HOME"); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("PARCEL"); @@ -195,7 +197,7 @@ _ADD_PROPERTY_PARAM("DOM"); _ADD_CTCAP_PROPERTY_BY_NAME("LOGO") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "JPEG"); + sml_dev_inf_prop_param_add_valenum(param, "JPEG", &gerror); _ADD_PROPERTY_PARAM("JPEG"); _ADD_CTCAP_PROPERTY_BY_NAME("MAILER") _ADD_CTCAP_PROPERTY_BY_NAME("N") @@ -203,32 +205,32 @@ _ADD_CTCAP_PROPERTY_BY_NAME("ORG") _ADD_CTCAP_PROPERTY_BY_NAME("PHOTO") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "JPEG"); + sml_dev_inf_prop_param_add_valenum(param, "JPEG", &gerror); _ADD_PROPERTY_PARAM("JPEG"); _ADD_CTCAP_PROPERTY_BY_NAME("REV") _ADD_CTCAP_PROPERTY_BY_NAME("ROLE") _ADD_CTCAP_PROPERTY_BY_NAME("SOUND") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "AIFF"); - smlDevInfPropParamAddValEnum(param, "PCM"); - smlDevInfPropParamAddValEnum(param, "WAVE"); + sml_dev_inf_prop_param_add_valenum(param, "AIFF", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "PCM", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "WAVE", &gerror); _ADD_PROPERTY_PARAM("AIFF"); _ADD_PROPERTY_PARAM("PCM"); _ADD_PROPERTY_PARAM("WAVE"); _ADD_CTCAP_PROPERTY_BY_NAME("TEL") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "WORK"); - smlDevInfPropParamAddValEnum(param, "VOICE"); - smlDevInfPropParamAddValEnum(param, "PREF"); - smlDevInfPropParamAddValEnum(param, "PAGER"); - smlDevInfPropParamAddValEnum(param, "MSG"); - smlDevInfPropParamAddValEnum(param, "MODEM"); - smlDevInfPropParamAddValEnum(param, "ISDN"); - smlDevInfPropParamAddValEnum(param, "HOME"); - smlDevInfPropParamAddValEnum(param, "FAX"); - smlDevInfPropParamAddValEnum(param, "CELL"); - smlDevInfPropParamAddValEnum(param, "CAR"); - smlDevInfPropParamAddValEnum(param, "BBS"); + sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "VOICE", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "PREF", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "PAGER", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "MSG", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "MODEM", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "ISDN", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "FAX", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "CELL", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "CAR", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "BBS", &gerror); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("VOICE"); _ADD_PROPERTY_PARAM("PREF"); @@ -246,8 +248,8 @@ _ADD_CTCAP_PROPERTY_BY_NAME("UID") _ADD_CTCAP_PROPERTY_BY_NAME("URL") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "WORK"); - smlDevInfPropParamAddValEnum(param, "HOME"); + sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); _ADD_PROPERTY_PARAM("WORK"); _ADD_PROPERTY_PARAM("HOME"); _ADD_CTCAP_PROPERTY_BY_NAME_VALUE("VERSION", "2.1") @@ -278,16 +280,16 @@ _ADD_CTCAP_PROPERTY_BY_NAME("URL") _ADD_CTCAP_PROPERTY_BY_NAME("TEL") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "CELL"); - smlDevInfPropParamAddValEnum(param, "HOME"); - smlDevInfPropParamAddValEnum(param, "WORK"); - smlDevInfPropParamAddValEnum(param, "FAX"); - smlDevInfPropParamAddValEnum(param, "MODEM"); - smlDevInfPropParamAddValEnum(param, "VOICE"); + sml_dev_inf_prop_param_add_valenum(param, "CELL", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "FAX", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "MODEM", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "VOICE", &gerror); _ADD_CTCAP_PROPERTY_BY_NAME("ADR") _ADD_PROPERTY_PARAM("TYPE") - smlDevInfPropParamAddValEnum(param, "HOME"); - smlDevInfPropParamAddValEnum(param, "WORK"); + sml_dev_inf_prop_param_add_valenum(param, "HOME", &gerror); + sml_dev_inf_prop_param_add_valenum(param, "WORK", &gerror); _ADD_CTCAP_PROPERTY_BY_NAME("BDAY") _ADD_CTCAP_PROPERTY_BY_NAME("NOTE") _ADD_CTCAP_PROPERTY_BY_NAME("PHOTO") @@ -413,7 +415,11 @@ smlTrace(TRACE_EXIT, "%s - content type newly added to devinf", __func__); return TRUE; -error: +error: + if (gerror) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); + } smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); return FALSE; } Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.c Wed Jun 17 18:07:47 2009 (r1091) @@ -0,0 +1,317 @@ +/* sml_dev_inf_prop_param.c */ + +#include "sml_dev_inf_prop_param.h" +#include <libsyncml/syncml.h> + +G_DEFINE_TYPE (SmlDevInfPropParam, sml_dev_inf_prop_param, G_TYPE_OBJECT) + +enum +{ + PROP_0, + PROP_PARAMNAME, + PROP_DATATYPE, + PROP_DISPLAYNAME, + PROP_VALENUMS +}; + +struct _SmlDevInfPropParamPrivate +{ + gchar* paramname; + gchar* datatype; + gchar* displayname; + GList* valenums; +}; + +static void +sml_dev_inf_prop_param_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_PARAMNAME: + g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->paramname); + break; + case PROP_DATATYPE: + g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->datatype); + break; + case PROP_DISPLAYNAME: + g_value_set_string (value, SML_DEV_INF_PROP_PARAM (object)->priv->displayname); + break; + case PROP_VALENUMS: + g_value_set_pointer (value, SML_DEV_INF_PROP_PARAM (object)->priv->valenums); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +sml_dev_inf_prop_param_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_PARAMNAME: + g_free (SML_DEV_INF_PROP_PARAM (object)->priv->paramname); + SML_DEV_INF_PROP_PARAM (object)->priv->paramname = g_strdup (g_value_get_string (value)); + break; + case PROP_DATATYPE: + g_free (SML_DEV_INF_PROP_PARAM (object)->priv->datatype); + SML_DEV_INF_PROP_PARAM (object)->priv->datatype = g_strdup (g_value_get_string (value)); + break; + case PROP_DISPLAYNAME: + g_free (SML_DEV_INF_PROP_PARAM (object)->priv->displayname); + SML_DEV_INF_PROP_PARAM (object)->priv->displayname = g_strdup (g_value_get_string (value)); + break; + case PROP_VALENUMS: + SML_DEV_INF_PROP_PARAM (object)->priv->valenums = (GList *) g_value_get_pointer(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +sml_dev_inf_prop_param_finalize (GObject *object) +{ + SmlDevInfPropParam *self = (SmlDevInfPropParam *) object; + g_free(self->priv->paramname); + g_free(self->priv->datatype); + g_free(self->priv->displayname); + while(self->priv->valenums) { + gchar *valenum = self->priv->valenums->data; + self->priv->valenums = g_list_remove(self->priv->valenums, valenum); + g_free(valenum); + } + G_OBJECT_CLASS (sml_dev_inf_prop_param_parent_class)->finalize (object); +} + +static void +sml_dev_inf_prop_param_class_init (SmlDevInfPropParamClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (SmlDevInfPropParamPrivate)); + + object_class->get_property = sml_dev_inf_prop_param_get_property; + object_class->set_property = sml_dev_inf_prop_param_set_property; + object_class->finalize = sml_dev_inf_prop_param_finalize; + + /** + * SmlDevInfPropParam:ParamName: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_PARAMNAME, + g_param_spec_string ("ParamName", + "", + "", + NULL, + G_PARAM_READWRITE)); + /** + * SmlDevInfPropParam:DataType: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_DATATYPE, + g_param_spec_string ("DataType", + "", + "", + NULL, + G_PARAM_READWRITE)); + /** + * SmlDevInfPropParam:DisplayName: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_DISPLAYNAME, + g_param_spec_string ("DisplayName", + "", + "", + NULL, + G_PARAM_READWRITE)); + /** + * SmlDevInfPropParam:ValEnums: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_VALENUMS, + g_param_spec_pointer ("ValEnums", + "", + NULL, + G_PARAM_PRIVATE)); + +} + +static void +sml_dev_inf_prop_param_init (SmlDevInfPropParam *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + SML_TYPE_DEV_INF_PROP_PARAM, + SmlDevInfPropParamPrivate); +} + +/** + * sml_dev_inf_prop_param_new: + * + * Creates a new instance of #SmlDevInfPropParam. + * + * Return value: the newly created #SmlDevInfPropParam instance + */ +SmlDevInfPropParam* +sml_dev_inf_prop_param_new (void) +{ + return g_object_new (SML_TYPE_DEV_INF_PROP_PARAM, NULL); +} + +/** + * sml_dev_inf_prop_param_get_paramname: + * @self: A #SmlDevInfPropParam + * + * Gets the property. + * + * Return value: + */ +G_CONST_RETURN gchar* +sml_dev_inf_prop_param_get_paramname (SmlDevInfPropParam *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); + return self->priv->paramname; +} + +/** + * sml_dev_inf_prop_param_set_paramname: + * @self: A #SmlDevInfPropParam + * @paramname: + * + * Sets the property. + */ +gboolean +sml_dev_inf_prop_param_set_paramname (SmlDevInfPropParam *self, + const gchar* paramname, + GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), FALSE); + g_free (self->priv->paramname); + self->priv->paramname = g_strdup (paramname); + return TRUE; +} + +/** + * sml_dev_inf_prop_param_get_datatype: + * @self: A #SmlDevInfPropParam + * + * Gets the property. + * + * Return value: + */ +G_CONST_RETURN gchar* +sml_dev_inf_prop_param_get_datatype (SmlDevInfPropParam *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); + return self->priv->datatype; +} + +/** + * sml_dev_inf_prop_param_set_datatype: + * @self: A #SmlDevInfPropParam + * @datatype: + * + * Sets the property. + */ +gboolean +sml_dev_inf_prop_param_set_datatype (SmlDevInfPropParam *self, + const gchar* datatype, + GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), FALSE); + g_free (self->priv->datatype); + self->priv->datatype = g_strdup (datatype); + return TRUE; +} + +/** + * sml_dev_inf_prop_param_get_displayname: + * @self: A #SmlDevInfPropParam + * + * Gets the property. + * + * Return value: + */ +G_CONST_RETURN gchar* +sml_dev_inf_prop_param_get_displayname (SmlDevInfPropParam *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); + return self->priv->displayname; +} + +/** + * sml_dev_inf_prop_param_set_displayname: + * @self: A #SmlDevInfPropParam + * @displayname: + * + * Sets the property. + */ +gboolean +sml_dev_inf_prop_param_set_displayname (SmlDevInfPropParam *self, + const gchar* displayname, + GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), FALSE); + g_free (self->priv->displayname); + self->priv->displayname = g_strdup (displayname); + return TRUE; +} + +/** + * sml_dev_inf_prop_param_num_valenums: + * @self: A #SmlDevInfPropParam + * + * + */ +guint +sml_dev_inf_prop_param_num_valenums (SmlDevInfPropParam *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), 0); + return g_list_length(self->priv->valenums); +} + +/** + * sml_dev_inf_prop_param_get_nth_valenum: + * @self: A #SmlDevInfPropParam + * + * + */ +G_CONST_RETURN gchar* +sml_dev_inf_prop_param_get_nth_valenum (SmlDevInfPropParam *self, + guint n) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), NULL); + return (gchar *)g_list_nth_data(self->priv->valenums, n); +} + +/** + * sml_dev_inf_prop_param_add_valenum: + * @self: A #SmlDevInfPropParam + * + * + */ +gboolean +sml_dev_inf_prop_param_add_valenum (SmlDevInfPropParam *self, + const gchar* valEnum, + GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_PROP_PARAM (self), FALSE); + self->priv->valenums = g_list_append(self->priv->valenums, g_strdup(valEnum)); + if (!self->priv->valenums) { + *error = g_error_new(SML_ERROR, SML_ERROR_GENERIC, "Cannot add ValEnum to ValEnum list of PropParam."); + return FALSE; + } + return TRUE; +} Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_prop_param.h Wed Jun 17 18:07:47 2009 (r1091) @@ -0,0 +1,49 @@ +/* sml_dev_inf_prop_param.h */ + +#ifndef __SML_DEV_INF_PROP_PARAM_H__ +#define __SML_DEV_INF_PROP_PARAM_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define SML_TYPE_DEV_INF_PROP_PARAM (sml_dev_inf_prop_param_get_type()) +#define SML_DEV_INF_PROP_PARAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SML_TYPE_DEV_INF_PROP_PARAM, SmlDevInfPropParam)) +#define SML_DEV_INF_PROP_PARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SML_TYPE_DEV_INF_PROP_PARAM, SmlDevInfPropParamClass)) +#define SML_IS_DEV_INF_PROP_PARAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SML_TYPE_DEV_INF_PROP_PARAM)) +#define SML_IS_DEV_INF_PROP_PARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SML_TYPE_DEV_INF_PROP_PARAM)) +#define SML_DEV_INF_PROP_PARAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SML_TYPE_DEV_INF_PROP_PARAM, SmlDevInfPropParamClass)) + +typedef struct _SmlDevInfPropParam SmlDevInfPropParam; +typedef struct _SmlDevInfPropParamClass SmlDevInfPropParamClass; +typedef struct _SmlDevInfPropParamPrivate SmlDevInfPropParamPrivate; + +struct _SmlDevInfPropParam +{ + GObject parent; + + /*< private >*/ + SmlDevInfPropParamPrivate *priv; +}; + +struct _SmlDevInfPropParamClass +{ + GObjectClass parent_class; + +}; + +GType sml_dev_inf_prop_param_get_type (void); +SmlDevInfPropParam* sml_dev_inf_prop_param_new (void); +G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_paramname (SmlDevInfPropParam *self); +gboolean sml_dev_inf_prop_param_set_paramname (SmlDevInfPropParam *self, const gchar* paramname, GError **error); +G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_datatype (SmlDevInfPropParam *self); +gboolean sml_dev_inf_prop_param_set_datatype (SmlDevInfPropParam *self, const gchar* datatype, GError **error); +G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_displayname (SmlDevInfPropParam *self); +gboolean sml_dev_inf_prop_param_set_displayname (SmlDevInfPropParam *self, const gchar* displayname, GError **error); +gsize sml_dev_inf_prop_param_num_valenums (SmlDevInfPropParam *self); +G_CONST_RETURN gchar* sml_dev_inf_prop_param_get_nth_valenum (SmlDevInfPropParam *self, gsize n); +gboolean sml_dev_inf_prop_param_add_valenum (SmlDevInfPropParam *self, const gchar* valEnum, GError **error); + +G_END_DECLS + +#endif /* __SML_DEV_INF_PROP_PARAM_H__ */ Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/parser/sml_xml_assm.c Wed Jun 17 18:07:47 2009 (r1091) @@ -2163,25 +2163,26 @@ } // add ParamName - if (param->paramName != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_PARAMNAME, param->paramName, error)) + if (sml_dev_inf_prop_param_get_paramname(param) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_PARAMNAME, sml_dev_inf_prop_param_get_paramname(param), error)) goto error; // add DataType - if (param->dataType != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DATATYPE, param->dataType, error)) + if (sml_dev_inf_prop_param_get_datatype(param) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DATATYPE, sml_dev_inf_prop_param_get_datatype(param), error)) goto error; // add DisplayName - if (param->displayName != NULL && - !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DISPLAYNAME, param->displayName, error)) + if (sml_dev_inf_prop_param_get_displayname(param) != NULL && + !_smlXmlAssemblerAddString(assm, SML_ELEMENT_DISPLAYNAME, sml_dev_inf_prop_param_get_displayname(param), error)) goto error; // add values - hvalue = NULL; - for (hvalue = param->valEnums; hvalue; hvalue = hvalue->next) + guint length = sml_dev_inf_prop_param_num_valenums(param); + guint n; + for (n=0; n < length; n++) { - char *valEnum = hvalue->data; + const char *valEnum = sml_dev_inf_prop_param_get_nth_valenum(param, n); // add ValEnum if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VALENUM, valEnum, error)) Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/parser/sml_xml_parse.c Wed Jun 17 18:07:47 2009 (r1091) @@ -2742,9 +2742,14 @@ case SML_DEVINF_CTCAP_DATATYPE: if (property == NULL) goto error; - if (param != NULL) - smlDevInfPropParamSetDataType(param, value); - else + if (param != NULL) { + GError *gerror = NULL; + if (!sml_dev_inf_prop_param_set_datatype(param, value, &gerror)) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); + goto error; + } + } else smlDevInfPropertySetDataType(property, value); break; case SML_DEVINF_CTCAP_MAXOCCUR: @@ -2765,17 +2770,27 @@ case SML_DEVINF_CTCAP_DISPLAYNAME: if (property == NULL) goto error; - if (param != NULL) - smlDevInfPropParamSetDisplayName(param, value); - else + if (param != NULL) { + GError *gerror = NULL; + if (!sml_dev_inf_prop_param_set_displayname(param, value, &gerror)) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); + goto error; + } + } else smlDevInfPropertySetDisplayName(property, value); break; case SML_DEVINF_CTCAP_VALENUM: if (property == NULL) goto error; - if (param != NULL) - smlDevInfPropParamAddValEnum(param, value); - else + if (param != NULL) { + GError *gerror = NULL; + if (!sml_dev_inf_prop_param_add_valenum(param, value, &gerror)) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); + goto error; + } + } else smlDevInfPropertyAddValEnum(property, value); break; case SML_DEVINF_CTCAP_PARAMNAME: @@ -2786,10 +2801,13 @@ smlDevInfPropertyAddPropParam(property, param); param = NULL; } - param = smlDevInfNewPropParam(error); - if (!param) - goto error; - smlDevInfPropParamSetParamName(param, value); + param = sml_dev_inf_prop_param_new(); + if (!param) { + smlErrorSet(error, SML_ERROR_GENERIC, "Cannot create SmlDevInfPropParam during SyncML 1.1 DevInf parsing."); + goto error; + } + GError *gerror = NULL; + sml_dev_inf_prop_param_set_paramname(param, value, &gerror); break; case SML_DEVINF_CTCAP_SIZE: smlDevInfPropertySetPropSize(property, atoi(value)); @@ -2833,9 +2851,11 @@ goto error; } - SmlDevInfPropParam *param = smlDevInfNewPropParam(error); - if (!param) + SmlDevInfPropParam *param = sml_dev_inf_prop_param_new(); + if (!param) { + smlErrorSet(error, SML_ERROR_GENERIC, "Cannot create SmlDevInfPropParam during SyncML 1.2 DevInf parsing."); goto error; + } char *value = NULL; while (1) { @@ -2868,19 +2888,20 @@ } /* now react on the different items */ + GError *gerror = NULL; switch(type) { case SML_DEVINF_CTCAP_PARAMNAME: - smlDevInfPropParamSetParamName(param, value); + sml_dev_inf_prop_param_set_paramname(param, value, &gerror); break; case SML_DEVINF_CTCAP_DATATYPE: - smlDevInfPropParamSetDataType(param, value); + sml_dev_inf_prop_param_set_datatype(param, value, &gerror); break; case SML_DEVINF_CTCAP_DISPLAYNAME: - smlDevInfPropParamSetDisplayName(param, value); + sml_dev_inf_prop_param_set_displayname(param, value, &gerror); break; case SML_DEVINF_CTCAP_VALENUM: - smlDevInfPropParamAddValEnum(param, value); + sml_dev_inf_prop_param_add_valenum(param, value, &gerror); break; default: smlErrorSet(error, SML_ERROR_GENERIC, "Unknown CTCapType for PropParam: %s", elem_name); Modified: trunk/libsyncml/sml_command.h ============================================================================== --- trunk/libsyncml/sml_command.h Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/sml_command.h Wed Jun 17 18:07:47 2009 (r1091) @@ -30,6 +30,8 @@ #ifndef _SML_COMMAND_H_ #define _SML_COMMAND_H_ +#include <libsyncml/syncml.h> + SmlStatus *smlStatusNew(SmlErrorType data, unsigned int cmdref, unsigned int msgref, SmlLocation *sourceref, SmlLocation *targeref, SmlCommandType type, SmlError **error); SmlStatus *smlStatusRef(SmlStatus *status); void smlStatusUnref(SmlStatus *status); Modified: trunk/libsyncml/sml_devinf.c ============================================================================== --- trunk/libsyncml/sml_devinf.c Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/sml_devinf.c Wed Jun 17 18:07:47 2009 (r1091) @@ -170,21 +170,7 @@ while (prop->propParams) { SmlDevInfPropParam *param = prop->propParams->data; prop->propParams = g_list_remove(prop->propParams, param); - smlSafeCFree(&(param->paramName)); - if (param->dataType) - smlSafeCFree(&(param->dataType)); - if (param->displayName) - smlSafeCFree(&(param->displayName)); - /* if lists are removed - * then the data must be removed separately - */ - while (param->valEnums) { - char *valEnum = param->valEnums->data; - param->valEnums = g_list_remove(param->valEnums, valEnum); - smlSafeCFree(&valEnum); - } - /* free PropParam itself */ - smlSafeFree((gpointer *) ¶m); + g_object_unref(param); } /* free Property itself */ smlSafeFree((gpointer *) &prop); @@ -838,131 +824,6 @@ return NULL; } -/* PropParam stuff */ - -SmlDevInfPropParam *smlDevInfNewPropParam(SmlError **error) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, error); - CHECK_ERROR_REF - - SmlDevInfPropParam *param = smlTryMalloc0(sizeof(SmlDevInfPropParam), error); - if (!param) { - smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); - return NULL; - } - - param->paramName = NULL; - param->dataType = NULL; - param->displayName = NULL; - param->valEnums = NULL; - - smlTrace(TRACE_EXIT, "%s", __func__); - return param; -} - -void smlDevInfPropParamSetParamName( - SmlDevInfPropParam *propParam, - const char *paramName) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, propParam, VA_STRING(paramName)); - smlAssert(propParam); - smlAssert(paramName); - - if (propParam->paramName != NULL) - smlSafeCFree(&(propParam->paramName)); - propParam->paramName = g_strdup(paramName); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropParamSetDataType( - SmlDevInfPropParam *propParam, - const char *dataType) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, propParam, VA_STRING(dataType)); - smlAssert(propParam); - smlAssert(dataType); - - if (propParam->dataType != NULL) - smlSafeCFree(&(propParam->dataType)); - propParam->dataType = g_strdup(dataType); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropParamSetDisplayName( - SmlDevInfPropParam *propParam, - const char *displayName) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, propParam, VA_STRING(displayName)); - smlAssert(propParam); - smlAssert(displayName); - - if (propParam->displayName != NULL) - smlSafeCFree(&(propParam->displayName)); - propParam->displayName = g_strdup(displayName); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - -void smlDevInfPropParamAddValEnum( - SmlDevInfPropParam *propParam, - const char *valEnum) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %s)", __func__, propParam, VA_STRING(valEnum)); - smlAssert(propParam); - smlAssert(valEnum); - propParam->valEnums = g_list_append(propParam->valEnums, g_strdup(valEnum)); - smlTrace(TRACE_EXIT, "%s", __func__); -} - -char *smlDevInfPropParamGetParamName(const SmlDevInfPropParam *propParam) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, propParam); - smlAssert(propParam); - char *result = g_strdup(propParam->paramName); - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); - return result; -} - -char *smlDevInfPropParamGetDataType(const SmlDevInfPropParam *propParam) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, propParam); - smlAssert(propParam); - char *result = g_strdup(propParam->dataType); - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); - return result; -} - -char *smlDevInfPropParamGetDisplayName(const SmlDevInfPropParam *propParam) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, propParam); - smlAssert(propParam); - char *result = g_strdup(propParam->displayName); - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); - return result; -} - -unsigned int smlDevInfPropParamNumValEnums(const SmlDevInfPropParam *propParam) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, propParam); - smlAssert(propParam); - unsigned int num = g_list_length(propParam->valEnums); - smlTrace(TRACE_EXIT, "%s - %d", __func__, num); - return num; -} - -char *smlDevInfPropParamGetNthValEnum( - const SmlDevInfPropParam *propParam, - unsigned int n) -{ - smlTrace(TRACE_ENTRY, "%s(%p, %d)", __func__, propParam, n); - smlAssert(propParam); - char *result = g_strdup(g_list_nth_data(propParam->valEnums, n)); - smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(result)); - return result; -} - /* Property stuff */ SmlDevInfProperty *smlDevInfNewProperty(SmlError **error) Modified: trunk/libsyncml/sml_devinf.h ============================================================================== --- trunk/libsyncml/sml_devinf.h Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/sml_devinf.h Wed Jun 17 18:07:47 2009 (r1091) @@ -31,6 +31,7 @@ #define _SML_DEVINF_H_ #include <libsyncml/dev_inf_api/sml_dev_inf_content_type.h> +#include <libsyncml/dev_inf_api/sml_dev_inf_prop_param.h> SmlDevInfDevTyp smlDevInfDevTypeFromString(const char *name, SmlError **error); const char *smlDevInfDevTypeToString(SmlDevInfDevTyp type, SmlError **error); @@ -110,29 +111,29 @@ /* so we can generate SyncML 1.0, 1.1 and 1.2 devinf from this structure */ /* the CTCap will be assigned to a datastore if CTType and VerCT match */ -/* PropParam stuff */ - -SmlDevInfPropParam *smlDevInfNewPropParam(SmlError **error); -void smlDevInfPropParamSetParamName( // REQUIRED - SmlDevInfPropParam *propParam, - const char *paramName); -void smlDevInfPropParamSetDataType( - SmlDevInfPropParam *propParam, - const char *dataType); -void smlDevInfPropParamSetDisplayName( - SmlDevInfPropParam *propParam, - const char *displayName); -void smlDevInfPropParamAddValEnum( - SmlDevInfPropParam *propParam, - const char *valEnum); - -char *smlDevInfPropParamGetParamName(const SmlDevInfPropParam *propParam); -char *smlDevInfPropParamGetDataType(const SmlDevInfPropParam *propParam); -char *smlDevInfPropParamGetDisplayName(const SmlDevInfPropParam *propParam); -unsigned int smlDevInfPropParamNumValEnums(const SmlDevInfPropParam *propParam); -char *smlDevInfPropParamGetNthValEnum( - const SmlDevInfPropParam *propParam, - unsigned int n); +// /* PropParam stuff */ +// +// SmlDevInfPropParam *smlDevInfNewPropParam(SmlError **error); +// void smlDevInfPropParamSetParamName( // REQUIRED +// SmlDevInfPropParam *propParam, +// const char *paramName); +// void smlDevInfPropParamSetDataType( +// SmlDevInfPropParam *propParam, +// const char *dataType); +// void smlDevInfPropParamSetDisplayName( +// SmlDevInfPropParam *propParam, +// const char *displayName); +// void smlDevInfPropParamAddValEnum( +// SmlDevInfPropParam *propParam, +// const char *valEnum); +// +// char *smlDevInfPropParamGetParamName(const SmlDevInfPropParam *propParam); +// char *smlDevInfPropParamGetDataType(const SmlDevInfPropParam *propParam); +// char *smlDevInfPropParamGetDisplayName(const SmlDevInfPropParam *propParam); +// unsigned int smlDevInfPropParamNumValEnums(const SmlDevInfPropParam *propParam); +// char *smlDevInfPropParamGetNthValEnum( +// const SmlDevInfPropParam *propParam, +// unsigned int n); /* Property stuff */ Modified: trunk/libsyncml/sml_error.h ============================================================================== --- trunk/libsyncml/sml_error.h Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/sml_error.h Wed Jun 17 18:07:47 2009 (r1091) @@ -22,6 +22,8 @@ #ifndef _SML_ERROR_H_ #define _SML_ERROR_H_ +#include <libsyncml/syncml.h> + typedef enum { SML_ERRORCLASS_UNKNOWN = 0, SML_ERRORCLASS_SUCCESS = 2, @@ -111,6 +113,8 @@ } SmlErrorType; +#define SML_ERROR g_quark_from_static_string("Sml") + SmlError **smlErrorRef(SmlError **error); void smlErrorDeref(SmlError **error); SmlBool smlErrorIsSet(SmlError **error); Modified: trunk/libsyncml/syncml.h ============================================================================== --- trunk/libsyncml/syncml.h Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/libsyncml/syncml.h Wed Jun 17 18:07:47 2009 (r1091) @@ -80,7 +80,7 @@ //typedef struct SmlDevInfContentType SmlDevInfContentType; typedef struct SmlDevInfCTCap SmlDevInfCTCap; typedef struct SmlDevInfProperty SmlDevInfProperty; -typedef struct SmlDevInfPropParam SmlDevInfPropParam; +//typedef struct SmlDevInfPropParam SmlDevInfPropParam; typedef struct SmlNotification SmlNotification; typedef struct SmlSanAlert SmlSanAlert; typedef struct SmlMapItem SmlMapItem; Modified: trunk/tests/CMakeLists.txt ============================================================================== --- trunk/tests/CMakeLists.txt Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/tests/CMakeLists.txt Wed Jun 17 18:07:47 2009 (r1091) @@ -268,6 +268,15 @@ SML_ADD_TESTCASE( dev_inf_content_type_references ) SML_END_TEST() + SML_START_TEST( "DevInfPropParam" dev_inf_prop_param check_dev_inf_prop_param.c ${TEST_TARGET_LIBRARIES} ) + SML_ADD_TESTCASE( dev_inf_prop_param_create ) + SML_ADD_TESTCASE( dev_inf_prop_param_empty_set ) + SML_ADD_TESTCASE( dev_inf_prop_param_empty_get ) + SML_ADD_TESTCASE( dev_inf_prop_param_filled_set ) + SML_ADD_TESTCASE( dev_inf_prop_param_filled_get ) + SML_ADD_TESTCASE( dev_inf_prop_param_references ) + SML_END_TEST() + SML_START_TEST( "Sync" sync check_sync.c ${TEST_TARGET_LIBRARIES} ) IF ( ENABLE_HTTP ) SML_ADD_TESTCASE( sync_multi_start ) Modified: trunk/tests/check_dev_inf_content_type.c ============================================================================== --- trunk/tests/check_dev_inf_content_type.c Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/tests/check_dev_inf_content_type.c Wed Jun 17 18:07:47 2009 (r1091) @@ -35,8 +35,6 @@ sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); g_object_unref(ct); - return; - ct = sml_dev_inf_content_type_new(NULL, "2.1", &error); sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); g_object_unref(ct); Added: trunk/tests/check_dev_inf_prop_param.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/check_dev_inf_prop_param.c Wed Jun 17 18:07:47 2009 (r1091) @@ -0,0 +1,177 @@ +/* + * 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 "tests/support.h" + +#include <libsyncml/dev_inf_api/sml_dev_inf_prop_param.h> + +START_TEST (dev_inf_prop_param_create) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); + sml_fail_unless(propParam != NULL, NULL); + g_object_unref(propParam); +} +END_TEST + +START_TEST (dev_inf_prop_param_empty_set) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); + sml_fail_unless(propParam != NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + + g_object_unref(propParam); +} +END_TEST + +START_TEST (dev_inf_prop_param_empty_get) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); + sml_fail_unless(propParam != NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) == NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_datatype(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_datatype(propParam) == NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_displayname(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_displayname(propParam) == NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 0, NULL); + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 1, NULL); + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 2, NULL); + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, NULL, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 3, NULL); + + g_object_unref(propParam); +} +END_TEST + +START_TEST (dev_inf_prop_param_filled_set) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); + sml_fail_unless(propParam != NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, "property parameter name", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, "property parameter data type", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, "property parameter display name", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "property parameter first value of enumeration", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "property parameter second value of enumeration", &error), "%s", error?error->message:"No GError set."); + + g_object_unref(propParam); +} +END_TEST + +START_TEST (dev_inf_prop_param_filled_get) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); + sml_fail_unless(propParam != NULL, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, "test_1", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_paramname(propParam), "test_1") == 0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_datatype(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_datatype(propParam, "test_2", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_datatype(propParam) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_datatype(propParam), "test_2") == 0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_get_displayname(propParam) == NULL, NULL); + sml_fail_unless(sml_dev_inf_prop_param_set_displayname(propParam, "test_3", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_get_displayname(propParam) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_displayname(propParam), "test_3") == 0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "test_4", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 1, NULL); + sml_fail_unless(sml_dev_inf_prop_param_get_nth_valenum(propParam, 0) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_valenum(propParam, 0), "test_4") ==0, NULL); + + sml_fail_unless(sml_dev_inf_prop_param_add_valenum(propParam, "test_5", &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(sml_dev_inf_prop_param_num_valenums(propParam) == 2, NULL); + sml_fail_unless(sml_dev_inf_prop_param_get_nth_valenum(propParam, 0) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_valenum(propParam, 0), "test_4") ==0, NULL); + sml_fail_unless(sml_dev_inf_prop_param_get_nth_valenum(propParam, 1) != NULL, NULL); + sml_fail_unless(strcmp(sml_dev_inf_prop_param_get_nth_valenum(propParam, 1), "test_5") ==0, NULL); + + g_object_unref(propParam); +} +END_TEST + +START_TEST (dev_inf_prop_param_references) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfPropParam *propParam = sml_dev_inf_prop_param_new(); + sml_fail_unless(propParam != NULL, "Cannot create SmlDevInfPropParam."); + sml_fail_unless(sml_dev_inf_prop_param_set_paramname(propParam, "test name", &error), "%s", error?error->message:"No GError set."); + + g_object_ref(propParam); + + sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) != NULL, "The property parameter name was not set."); + + g_object_unref(propParam); + + sml_fail_unless(sml_dev_inf_prop_param_get_paramname(propParam) != NULL, "The property parameter name is already cleaned up."); + + g_object_unref(propParam); +} +END_TEST + +@SML_TESTCASE_CODE@ + Modified: trunk/tests/check_xml_parser.c ============================================================================== --- trunk/tests/check_xml_parser.c Wed Jun 17 16:31:06 2009 (r1090) +++ trunk/tests/check_xml_parser.c Wed Jun 17 18:07:47 2009 (r1091) @@ -1235,6 +1235,7 @@ START_TEST (xml_parser_devinf) { + g_type_init(); const char *data = "<?xml version=\"1.0\"?><!DOCTYPE SyncML PUBLIC \"-//SYNCML//DTD SyncML 1.1//EN\" \"http://www.syncml.org/docs/syncml_represent_v11_20020213.dtd\"><SyncML xmlns=\"syncml:SYNCML1.1\"><SyncHdr><VerDTD>1.1</VerDTD><VerProto>SyncML/1.1</VerProto><SessionID>21</SessionID><MsgID>1</MsgID><Target><LocURI>PC Suite</LocURI></Target><Source><LocURI>IMEI:XXXX</LocURI></Source><Meta><MaxMsgSize xmlns=\"syncml:metinf\">10000</MaxMsgSize></Meta></SyncHdr><SyncBody><Put><CmdID>8</CmdID><Meta><Type xmlns=\"syncml:metinf\">application/vnd.syncml-devinf+xml</Type></Meta><Item><Source><LocURI>./devinf11</LocURI></Source><Data><DevInf xmlns=\"syncml:devinf\"><VerDTD>1.1</VerDTD><Man>NOKIA</Man><Mod>6680</Mod><SwV>3.04.37</SwV><DevID>IMEI:XXXX</DevID><DevTyp>phone</DevTyp><SupportLargeObjs/><SupportNumberOfChanges/><DataStore><SourceRef>./C\\Systemata\\Calendar</SourceRef><MaxGUIDSize>8</MaxGUIDSize><Rx-Pref><CTType>text/x-vcalendar</CTType><VerCT>1.0</VerCT></Rx-Pref><Rx><CTType>text/calendar</CTType><VerCT>2.0</VerCT></Rx><Tx-Pref><CTType>text/x-vcalendar</CTType><VerCT>1.0</VerCT></Tx-Pref><SyncCap><SyncType>1</SyncType><SyncType>2</SyncType><SyncType>3</SyncType><SyncType>4</SyncType><SyncType>5</SyncType><SyncType>6</SyncType><SyncType>7</SyncType></SyncCap></DataStore><DataStore><SourceRef>./C\\System\\\\\\Data\\Contacts.cdb</SourceRef><MaxGUIDSize>8</MaxGUIDSize><Rx-Pref><CTType>text/x-vcard</CTType><VerCT>2.1</VerCT></Rx-Pref><Rx><CTType>text/vcard</CTType><VerCT>3.0</VerCT></Rx><Tx-Pref><CTType>text/x-vcard</CTType><VerCT>2.1</VerCT></Tx-Pref><SyncCap><SyncType>1</SyncType><SyncType>2</SyncType><SyncType>3</SyncType><SyncType>4</SyncType><SyncType>5</SyncType><SyncType>6</SyncType><SyncType>7</SyncType></SyncCap></DataStore><DataStore><SourceRef>./C\\System\\Data\\Notepad.dat</SourceRef><MaxGUIDSize>8</MaxGUIDSize><Rx-Pref><CTType>text/plain</CTType><VerCT>1.0</VerCT></Rx-Pref><Rx><CTType>text/plain</CTType><VerCT>1.0</VerCT></Rx><Tx-Pref><CTType>text/plain</CTType><VerCT>1.0</VerCT></Tx-Pref><Tx><CTType>text/plain</CTType><VerCT>1.0</VerCT></Tx><SyncCap><SyncType>1</SyncType><SyncType>2</SyncType><SyncType>3</SyncType><SyncType>4</SyncType><SyncType>5</SyncType><SyncType>6</SyncType><SyncType>7</SyncType></SyncCap></DataStore><CTCap><CTType>text/x-vcalendar</CTType><PropName>BEGIN</PropName><ValEnum>VCALENDAR</ValEnum><ValEnum>VEVENT</ValEnum><ValEnum>VTODO</ValEnum><PropName>END</PropName><ValEnum>VCALENDAR</ValEnum><ValEnum>VEVENT</ValEnum><ValEnum>VTODO</ValEnum><PropName>VERSION</PropName><ValEnum>1.0</ValEnum><PropName>UID</PropName><PropName>SUMMARY</PropName><PropName>DESCRIPTION</PropName><PropName>DTEND</PropName><PropName>DTSTART</PropName><PropName>AALARM</PropName><ParamName>TYPE</ParamName><PropName>CLASS</PropName><ValEnum>PUBLIC</ValEnum><ValEnum>PRIVATE</ValEnum><ValEnum>CONFIDENTIAL</ValEnum><PropName>COMPLETED</PropName><PropName>LOCATION</PropName><PropName>DCREATED</PropName><PropName>LAST-MODIFIED</PropName><PropName>PRIORITY</PropName><PropName>STATUS</PropName><PropName>RRULE</PropName><PropName>DUE</PropName><PropName>EXDATE</PropName><PropName>X-EPOCAGENDAENTRYTYPE</PropName><CTType>text/calendar</CTType><PropName>BEGIN</PropName><ValEnum>VCALENDAR</ValEnum><ValEnum>VEVENT</ValEnum><ValEnum>VTODO</ValEnum><PropName>END</PropName><ValEnum>VCALENDAR</ValEnum><ValEnum>VEVENT</ValEnum><ValEnum>VTODO</ValEnum><PropName>VERSION</PropName><ValEnum>2.0</ValEnum><PropName>UID</PropName><PropName>SUMMARY</PropName><PropName>DESCRIPTION</PropName><PropName>DTEND</PropName><PropName>DTSTART</PropName><PropName>AALARM</PropName><ParamName>TYPE</ParamName><PropName>CLASS</PropName><ValEnum>PUBLIC</ValEnum><ValEnum>PRIVATE</ValEnum><ValEnum>CONFIDENTIAL</ValEnum><PropName>COMPLETED</PropName><PropName>LOCATION</PropName><PropName>DCREATED</PropName><PropName>LAST-MODIFIED</PropName><PropName>PRIORITY</PropName><PropName>STATUS</PropName><PropName>RRULE</PropName><PropName>DUE</PropName><PropName>EXDATE</PropName><PropName>X-EPOCAGENDAENTRYTYPE</PropName><CTType>text/x-vcard</CTType><PropName>BEGIN</PropName><ValEnum>VCARD</ValEnum><PropName>END</PropName><ValEnum>VCARD</ValEnum><PropName>VERSION</PropName><ValEnum>2.1</ValEnum><PropName>REV</PropName><PropName>N</PropName><PropName>ADR</PropName><ParamName>HOME</ParamName><ParamName>WORK</ParamName><PropName>TEL</PropName><ParamName>HOME</ParamName><ParamName>WORK</ParamName><ParamName>CELL</ParamName><ParamName>PAGER</ParamName><ParamName>FAX</ParamName><ParamName>VIDEO</ParamName><PropName>FN</PropName><PropName>EMAIL</PropName><ParamName>INTERNET</ParamName><ParamName>HOME</ParamName><ParamName>WORK</ParamName><PropName>URL</PropName><ParamName>HOME</ParamName><ParamName>WORK</ParamName><PropName>NOTE</PropName><PropName>TITLE</PropName><PropName>ORG</PropName><PropName>PHOTO</PropName><PropName>BDAY</PropName><PropName>SOUND</PropName><ParamName>X-IRMC-N</ParamName><CTType>text/vcard</CTType><PropName>BEGIN</PropName><ValEnum>VCARD</ValEnum><PropName>END</PropName><ValEnum>VCARD</ValEnum><PropName>VERSION</PropName><ValEnum>3.0</ValEnum><PropName>REV</PropName><PropName>N</PropName><PropName>ADR</PropName><ParamName>HOME</ParamName><ParamName>WORK</ParamName><PropName>TEL</PropName><ParamName>HOME</ParamName><ParamName>WORK</ParamName><ParamName>CELL</ParamName><ParamName>PAGER</ParamName><ParamName>FAX</ParamName><ParamName>VIDEO</ParamName><PropName>FN</PropName><PropName>EMAIL</PropName><ParamName>INTERNET</ParamName><ParamName>HOME</ParamName><ParamName>WORK</ParamName><PropName>URL</PropName><ParamName>HOME</ParamName><ParamName>WORK</ParamName><PropName>NOTE</PropName><PropName>TITLE</PropName><PropName>ORG</PropName><PropName>PHOTO</PropName><PropName>BDAY</PropName><PropName>SOUND</PropName><ParamName>X-IRMC-N</ParamName><CTType>text/plain</CTType></CTCap></DevInf></Data></Item></Put><Final/></SyncBody></SyncML>"; SmlError *error = NULL; @@ -1293,6 +1294,7 @@ START_TEST (xml_parser_devinf_ctcap) { + g_type_init(); const char *data = "<?xml version=\"1.0\"?><!DOCTYPE SyncML PUBLIC \"-//SYNCML//DTD SyncML 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/OMA-TS-SyncML_RepPro_DTD-V1_2.dtd\"><SyncML xmlns=\"syncml:SYNCML1.2\"><SyncHdr><VerDTD>1.2</VerDTD><VerProto>SyncML/1.2</VerProto><SessionID>1</SessionID><MsgID>1</MsgID><Target><LocURI>LibSyncML Test Suite</LocURI></Target><Source><LocURI>IMEI:xxxxxxxxxxxxxxx</LocURI></Source><Meta><MaxMsgSize xmlns=\"syncml:metinf\">6000</MaxMsgSize></Meta></SyncHdr><SyncBody><Put><CmdID>1</CmdID><Meta><Type xmlns=\"syncml:metinf\">application/vnd.syncml-devinf+wbxml</Type></Meta><Item><Source><LocURI>./devinf12</LocURI></Source><Data><DevInf xmlns=\"syncml:devinf\"><VerDTD>1.2</VerDTD><Man>SonyEricsson</Man><Mod>K850i</Mod><FwV>R1CA029</FwV><SwV>R7A</SwV><HwV>R6A</HwV><DevID>IMEI:xxxxxxxxxxxxxxx</DevID><DevTyp>phone</DevTyp><UTC/><SupportNumberOfChanges/><SupportLargeObjs/><DataStore><SourceRef>Contacts</SourceRef><DisplayName>Contacts</DisplayName><MaxGUIDSize>64</MaxGUIDSize><Rx-Pref><CTType>text/x-vcard</CTType><VerCT>2.1</VerCT></Rx-Pref><Rx><CTType>text/vcard</CTType><VerCT>3.0</VerCT></Rx><Tx-Pref><CTType>text/x-vcard</CTType><VerCT>2.1</VerCT></Tx-Pref><CTCap><CTType>text/x-vcard</CTType><VerCT>2.1</VerCT><Property><PropName>X-IRMC-LUID</PropName><Size>12</Size></Property><Property><PropName>GEO</PropName></Property><Property><PropName>PHOTO</PropName><Size>10000</Size><NoTruncate/><PropParam><ParamName>ENCODING</ParamName><ValEnum>BASE64</ValEnum></PropParam></Property><Property><PropName>BDAY</PropName><Size>8</Size></Property><Property><PropName>URL</PropName><Size>120</Size></Property><Property><PropName>TITLE</PropName><Size>30</Size></Property><Property><PropName>ORG</PropName><Size>30</Size></Property><Property><PropName>EMAIL</PropName><MaxOccur>3</MaxOccur><Size>128</Size><NoTruncate/><PropParam><ParamName>TYPE</ParamName><ValEnum>WORK</ValEnum><ValEnum>HOME</ValEnum></PropParam></Property><Property><PropName>ADR</PropName><MaxOccur>2</MaxOccur><Size>125</Size><PropParam><ParamName>TYPE</ParamName><ValEnum>WORK</ValEnum><ValEnum>HOME</ValEnum></PropParam></Property><Property><PropName>NOTE</PropName><Size>512</Size></Property><Property><PropName>TEL</PropName><MaxOccur>7</MaxOccur><Size>80</Size><NoTruncate/><PropParam><ParamName>TYPE</ParamName><ValEnum>CELL;WORK</ValEnum><ValEnum>CELL;HOME</ValEnum><ValEnum>CELL</ValEnum><ValEnum>HOME</ValEnum><ValEnum>FAX</ValEnum><ValEnum>WORK</ValEnum></PropParam></Property><Property><PropName>N</PropName><Size>60</Size></Property><Property><PropName>VERSION</PropName><ValEnum>2.1</ValEnum></Property><Property><PropName>END</PropName><ValEnum>VCARD</ValEnum></Property><Property><PropName>BEGIN</PropName><ValEnum>VCARD</ValEnum></Property></CTCap><CTCap><CTType>text/vcard</CTType><VerCT>3.0</VerCT><Property><PropName>X-IRMC-LUID</PropName><Size>12</Size></Property><Property><PropName>GEO</PropName></Property><Property><PropName>PHOTO</PropName><Size>10000</Size><NoTruncate/><PropParam><ParamName>ENCODING</ParamName><ValEnum>BASE64</ValEnum></PropParam></Property><Property><PropName>BDAY</PropName><Size>8</Size></Property><Property><PropName>URL</PropName><Size>120</Size></Property><Property><PropName>TITLE</PropName><Size>30</Size></Property><Property><PropName>ORG</PropName><Size>30</Size></Property><Property><PropName>EMAIL</PropName><MaxOccur>3</MaxOccur><Size>128</Size><NoTruncate/><PropParam><ParamName>TYPE</ParamName><ValEnum>WORK</ValEnum><ValEnum>HOME</ValEnum></PropParam></Property><Property><PropName>ADR</PropName><MaxOccur>2</MaxOccur><Size>125</Size><PropParam><ParamName>TYPE</ParamName><ValEnum>WORK</ValEnum><ValEnum>HOME</ValEnum></PropParam></Property><Property><PropName>NOTE</PropName><Size>512</Size></Property><Property><PropName>TEL</PropName><MaxOccur>7</MaxOccur><Size>80</Size><NoTruncate/><PropParam><ParamName>TYPE</ParamName><ValEnum>CELL;WORK</ValEnum><ValEnum>CELL;HOME</ValEnum><ValEnum>CELL</ValEnum><ValEnum>HOME</ValEnum><ValEnum>FAX</ValEnum><ValEnum>WORK</ValEnum></PropParam></Property><Property><PropName>N</PropName><Size>60</Size></Property><Property><PropName>VERSION</PropName><ValEnum>3.0</ValEnum></Property><Property><PropName>END</PropName><ValEnum>VCARD</ValEnum></Property><Property><PropName>BEGIN</PropName><ValEnum>VCARD</ValEnum></Property></CTCap><DSMem><MaxID>5000</MaxID></DSMem><SyncCap><SyncType>1</SyncType><SyncType>2</SyncType><SyncType>4</SyncType><SyncType>6</SyncType><SyncType>7</SyncType></SyncCap></DataStore><DataStore><SourceRef>Calendar</SourceRef><DisplayName>Calendar</DisplayName><MaxGUIDSize>64</MaxGUIDSize><Rx-Pref><CTType>text/x-vcalendar</CTType><VerCT>1.0</VerCT></Rx-Pref><Tx-Pref><CTType>text/x-vcalendar</CTType><VerCT>1.0</VerCT></Tx-Pref><CTCap><CTType>text/x-vcalendar</CTType><VerCT>1.0</VerCT><Property><PropName>X-IRMC-LUID</PropName><Size>12</Size></Property><Property><PropName>X-SONYERICSSON-DST</PropName></Property><Property><PropName>DAYLIGHT</PropName></Property><Property><PropName>LAST-MODIFIED</PropName></Property><Property><PropName>EXDATE</PropName></Property><Property><PropName>RRULE</PropName><Size>50</Size></Property><Property><PropName>CLASS</PropName><ValEnum>PUBLIC</ValEnum></Property><Property><PropName>CATEGORIES</PropName><ValEnum>BIRTHDAY</ValEnum><ValEnum>HOLIDAY</ValEnum><ValEnum>VACATION</ValEnum><ValEnum>TRAVEL</ValEnum><ValEnum>PHONE CALL</ValEnum><ValEnum>MISCELLANEOUS</ValEnum><ValEnum>MEETING</ValEnum></Property><Property><PropName>AALARM</PropName></Property><Property><PropName>DALARM</PropName></Property><Property><PropName>DTEND</PropName></Property><Property><PropName>DTSTART</PropName></Property><Property><PropName>DESCRIPTION</PropName><Size>512</Size></Property><Property><PropName>LOCATION</PropName... [truncated message content] |
From: <svn...@op...> - 2009-06-17 14:31:12
|
Author: bellmich Date: Wed Jun 17 16:31:06 2009 New Revision: 1090 URL: http://libsyncml.opensync.org/changeset/1090 Log: completed file naming fix Modified: trunk/libsyncml/CMakeLists.txt trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h trunk/libsyncml/sml_devinf.h trunk/tests/check_dev_inf_content_type.c Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Wed Jun 17 13:49:47 2009 (r1089) +++ trunk/libsyncml/CMakeLists.txt Wed Jun 17 16:31:06 2009 (r1090) @@ -33,7 +33,7 @@ parser/sml_wbxml.c parser/sml_xml_assm.c parser/sml_xml_parse.c - dev_inf_api/sml-dev-inf-content-type.c + dev_inf_api/sml_dev_inf_content_type.c ) IF ( ENABLE_OBEX ) @@ -94,7 +94,7 @@ ## install header files of DevInf API INSTALL( FILES - dev_inf_api/sml-dev-inf-content-type.h + dev_inf_api/sml_dev_inf_content_type.h DESTINATION ${LIBSYNCML_INCLUDE_DIR}/libsyncml/dev_inf_api ) Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Wed Jun 17 13:49:47 2009 (r1089) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c Wed Jun 17 16:31:06 2009 (r1090) @@ -1,6 +1,6 @@ -/* sml-dev-inf-content-type.c */ +/* sml_dev_inf_content_type.c */ -#include "sml-dev-inf-content-type.h" +#include "sml_dev_inf_content_type.h" G_DEFINE_TYPE (SmlDevInfContentType, sml_dev_inf_content_type, G_TYPE_OBJECT) Modified: trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h ============================================================================== --- trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h Wed Jun 17 13:49:47 2009 (r1089) +++ trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h Wed Jun 17 16:31:06 2009 (r1090) @@ -1,4 +1,4 @@ -/* sml-dev-inf-content-type.h */ +/* sml_dev_inf_content_type.h */ #ifndef __SML_DEV_INF_CONTENT_TYPE_H__ #define __SML_DEV_INF_CONTENT_TYPE_H__ Modified: trunk/libsyncml/sml_devinf.h ============================================================================== --- trunk/libsyncml/sml_devinf.h Wed Jun 17 13:49:47 2009 (r1089) +++ trunk/libsyncml/sml_devinf.h Wed Jun 17 16:31:06 2009 (r1090) @@ -30,7 +30,7 @@ #ifndef _SML_DEVINF_H_ #define _SML_DEVINF_H_ -#include <libsyncml/dev_inf_api/sml-dev-inf-content-type.h> +#include <libsyncml/dev_inf_api/sml_dev_inf_content_type.h> SmlDevInfDevTyp smlDevInfDevTypeFromString(const char *name, SmlError **error); const char *smlDevInfDevTypeToString(SmlDevInfDevTyp type, SmlError **error); Modified: trunk/tests/check_dev_inf_content_type.c ============================================================================== --- trunk/tests/check_dev_inf_content_type.c Wed Jun 17 13:49:47 2009 (r1089) +++ trunk/tests/check_dev_inf_content_type.c Wed Jun 17 16:31:06 2009 (r1090) @@ -20,7 +20,7 @@ #include "tests/support.h" -#include <libsyncml/dev_inf_api/sml-dev-inf-content-type.h> +#include <libsyncml/dev_inf_api/sml_dev_inf_content_type.h> START_TEST (dev_inf_content_type_create) { |
From: <svn...@op...> - 2009-06-17 13:14:25
|
Author: bricks Date: Wed Jun 17 15:14:12 2009 New Revision: 5674 URL: http://www.opensync.org/changeset/5674 Log: added OSyncError parameter to osync_member_add_objformat and osync_member_add_objformat_with_config refs #1087 Modified: trunk/opensync/engine/opensync_obj_engine.c trunk/opensync/group/opensync_member.c trunk/opensync/group/opensync_member.h trunk/tests/engine-tests/check_engine.c Modified: trunk/opensync/engine/opensync_obj_engine.c ============================================================================== --- trunk/opensync/engine/opensync_obj_engine.c Wed Jun 17 12:43:46 2009 (r5673) +++ trunk/opensync/engine/opensync_obj_engine.c Wed Jun 17 15:14:12 2009 (r5674) @@ -205,7 +205,7 @@ { OSyncList *m = NULL; OSyncList *e = NULL; - osync_bool found_similar = FALSE; + /*osync_bool found_similar = FALSE;*/ OSyncConvCmpResult result = OSYNC_CONV_DATA_MISMATCH; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, mapping_engines, change, sinkengine, mapping_engine); Modified: trunk/opensync/group/opensync_member.c ============================================================================== --- trunk/opensync/group/opensync_member.c Wed Jun 17 12:43:46 2009 (r5673) +++ trunk/opensync/group/opensync_member.c Wed Jun 17 15:14:12 2009 (r5674) @@ -632,27 +632,38 @@ return NULL; } -void osync_member_add_objformat(OSyncMember *member, const char *objtype, const char *format) +void osync_member_add_objformat(OSyncMember *member, const char *objtype, const char *format, OSyncError **error) { OSyncObjTypeSink *sink = osync_member_find_objtype_sink(member, objtype); OSyncObjFormatSink *format_sink = NULL; - if (!sink) + if (!sink) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find objtype %s", objtype); return; + } - /* TODO: handle error */ - format_sink = osync_objformat_sink_new(format, NULL); + format_sink = osync_objformat_sink_new(format, error); + if (!format_sink) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to create sink for format %s", format); + return; + } osync_objtype_sink_add_objformat_sink(sink, format_sink); osync_objformat_sink_unref(format_sink); } -void osync_member_add_objformat_with_config(OSyncMember *member, const char *objtype, const char *format, const char *format_config) +void osync_member_add_objformat_with_config(OSyncMember *member, const char *objtype, const char *format, const char *format_config, OSyncError **error) { OSyncObjTypeSink *sink = osync_member_find_objtype_sink(member, objtype); OSyncObjFormatSink *format_sink = NULL; - if (!sink) + if (!sink) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to find objtype %s", objtype); return; + } - format_sink = osync_objformat_sink_new(format, NULL); + format_sink = osync_objformat_sink_new(format, error); + if (!format_sink) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to create sink for format %s", format); + return; + } osync_objformat_sink_set_config(format_sink, format_config); osync_objtype_sink_add_objformat_sink(sink, format_sink); osync_objformat_sink_unref(format_sink); Modified: trunk/opensync/group/opensync_member.h ============================================================================== --- trunk/opensync/group/opensync_member.h Wed Jun 17 12:43:46 2009 (r5673) +++ trunk/opensync/group/opensync_member.h Wed Jun 17 15:14:12 2009 (r5674) @@ -264,10 +264,11 @@ * * @param member The member pointer * @param objtype The searched object type - * @param format The name of the Object Format + * @param format The name of the Object Format + * @param error An OSyncError struct * */ -OSYNC_EXPORT void osync_member_add_objformat(OSyncMember *member, const char *objtype, const char *format); +OSYNC_EXPORT void osync_member_add_objformat(OSyncMember *member, const char *objtype, const char *format, OSyncError **error); /** @brief Add a specifc Object Format with a conversion path config to member * @@ -275,9 +276,10 @@ * @param objtype The searched object type * @param format The name of the Object Format * @param format_config The Object Format specific configuration + * @param error An OSyncError struct * */ -OSYNC_EXPORT void osync_member_add_objformat_with_config(OSyncMember *member, const char *objtype, const char *format, const char *format_config); +OSYNC_EXPORT void osync_member_add_objformat_with_config(OSyncMember *member, const char *objtype, const char *format, const char *format_config, OSyncError **error); /** @brief Get the capabilities of the member Modified: trunk/tests/engine-tests/check_engine.c ============================================================================== --- trunk/tests/engine-tests/check_engine.c Wed Jun 17 12:43:46 2009 (r5673) +++ trunk/tests/engine-tests/check_engine.c Wed Jun 17 15:14:12 2009 (r5674) @@ -19,17 +19,18 @@ static void _member_add_format(OSyncMember *member, const char *objtype, const char *objformat) { - OSyncObjTypeSink *sink = NULL; - osync_assert(member); - osync_assert(objtype); + OSyncObjTypeSink *sink = NULL; + OSyncError *error = NULL; + osync_assert(member); + osync_assert(objtype); - if (!osync_member_find_objtype_sink(member, objtype)) { - sink = osync_objtype_sink_new(objtype, NULL); - osync_member_add_objtype_sink(member, sink); - osync_objtype_sink_unref(sink); - } + if (!osync_member_find_objtype_sink(member, objtype)) { + sink = osync_objtype_sink_new(objtype, &error); + osync_member_add_objtype_sink(member, sink); + osync_objtype_sink_unref(sink); + } - osync_member_add_objformat(member, objtype, objformat); + osync_member_add_objformat(member, objtype, objformat, &error); } START_TEST (engine_new) |
From: <svn...@op...> - 2009-06-17 11:49:51
|
Author: bellmich Date: Wed Jun 17 13:49:47 2009 New Revision: 1089 URL: http://libsyncml.opensync.org/changeset/1089 Log: enforce libsyncml naming conventions Added: trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.c - copied unchanged from r1088, trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.c trunk/libsyncml/dev_inf_api/sml_dev_inf_content_type.h - copied unchanged from r1088, trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.h Deleted: trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.c trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.h |
From: <svn...@op...> - 2009-06-17 10:43:51
|
Author: bricks Date: Wed Jun 17 12:43:46 2009 New Revision: 5673 URL: http://www.opensync.org/changeset/5673 Log: added an OSyncError parameter to osync_group_lock refs #1087 Modified: trunk/opensync/engine/opensync_engine.c trunk/opensync/group/opensync_group.c trunk/opensync/group/opensync_group.h trunk/opensync/group/opensync_updater.c trunk/tests/group-tests/check_lock.c Modified: trunk/opensync/engine/opensync_engine.c ============================================================================== --- trunk/opensync/engine/opensync_engine.c Wed Jun 17 12:23:57 2009 (r5672) +++ trunk/opensync/engine/opensync_engine.c Wed Jun 17 12:43:46 2009 (r5673) @@ -1635,7 +1635,7 @@ first_sync = TRUE; } - switch (osync_group_lock(group)) { + switch (osync_group_lock(group, error)) { case OSYNC_LOCKED: osync_error_set(error, OSYNC_ERROR_LOCKED, "Group is locked"); goto error; Modified: trunk/opensync/group/opensync_group.c ============================================================================== --- trunk/opensync/group/opensync_group.c Wed Jun 17 12:23:57 2009 (r5672) +++ trunk/opensync/group/opensync_group.c Wed Jun 17 12:43:46 2009 (r5673) @@ -332,7 +332,7 @@ } } -OSyncLockState osync_group_lock(OSyncGroup *group) +OSyncLockState osync_group_lock(OSyncGroup *group, OSyncError **error) { char *lockfile = NULL; osync_bool exists = FALSE; @@ -361,8 +361,8 @@ if ((group->lock_fd = g_open(lockfile, O_CREAT | O_WRONLY, 00700)) == -1) { group->lock_fd = 0; osync_free(lockfile); - osync_trace(TRACE_EXIT, "%s: Unable to open: %s", __func__, g_strerror(errno)); - return OSYNC_LOCK_STALE; + osync_error_set(error, OSYNC_ERROR_IO_ERROR, "Unable to open: %s", g_strerror(errno) ); + goto error; } else { #ifndef _WIN32 /* Set FD_CLOEXEC flags for the lock file descriptor. We don't want the @@ -370,13 +370,13 @@ */ int oldflags = fcntl(group->lock_fd, F_GETFD); if (oldflags == -1) { - osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, "Unable to get fd flags"); - return OSYNC_LOCK_STALE; + osync_error_set(error, OSYNC_ERROR_IO_ERROR, "Unable to get fd flags"); + goto error; } if (fcntl(group->lock_fd, F_SETFD, oldflags|FD_CLOEXEC) == -1) { - osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, "Unable to set fd flags"); - return OSYNC_LOCK_STALE; + osync_error_set(error, OSYNC_ERROR_IO_ERROR, "Unable to set fd flags"); + goto error; } if (flock(group->lock_fd, LOCK_EX | LOCK_NB) == -1) { @@ -385,8 +385,10 @@ locked = TRUE; close(group->lock_fd); group->lock_fd = 0; - } else - osync_trace(TRACE_INTERNAL, "error setting lock: %s", g_strerror(errno)); + } else { + osync_error_set(error, OSYNC_ERROR_IO_ERROR, "error setting lock: %s", g_strerror(errno)); + osync_trace(TRACE_INTERNAL, osync_error_print(error)); + } } else #else /* _WIN32 */ /* Windows cannot delete files which are open. When doing the backup, the lock file */ @@ -410,6 +412,9 @@ osync_trace(TRACE_EXIT, "%s: OSYNC_LOCK_OK", __func__); return OSYNC_LOCK_OK; +error: + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return OSYNC_LOCK_STALE; } void osync_group_unlock(OSyncGroup *group) Modified: trunk/opensync/group/opensync_group.h ============================================================================== --- trunk/opensync/group/opensync_group.h Wed Jun 17 12:23:57 2009 (r5672) +++ trunk/opensync/group/opensync_group.h Wed Jun 17 12:43:46 2009 (r5673) @@ -89,10 +89,11 @@ * If the group is locked, OSYNC_LOCKED is returned * * @param group The group + * @param error Pointer to an OSyncError struct * @returns if the lockfile was acquired * */ -OSYNC_EXPORT OSyncLockState osync_group_lock(OSyncGroup *group); +OSYNC_EXPORT OSyncLockState osync_group_lock(OSyncGroup *group, OSyncError **error); /** @brief Unlocks a group * Modified: trunk/opensync/group/opensync_updater.c ============================================================================== --- trunk/opensync/group/opensync_updater.c Wed Jun 17 12:23:57 2009 (r5672) +++ trunk/opensync/group/opensync_updater.c Wed Jun 17 12:43:46 2009 (r5673) @@ -595,7 +595,7 @@ osync_trace(TRACE_ENTRY, "%s(%p)", __func__, userdata); /* #1 Lock group */ - if (osync_group_lock(updater->group) == OSYNC_LOCKED) { + if (osync_group_lock(updater->group, &error) == OSYNC_LOCKED) { osync_error_set(&error, OSYNC_ERROR_GENERIC, "Group is locked. Can not process update on this group."); goto error; } Modified: trunk/tests/group-tests/check_lock.c ============================================================================== --- trunk/tests/group-tests/check_lock.c Wed Jun 17 12:23:57 2009 (r5672) +++ trunk/tests/group-tests/check_lock.c Wed Jun 17 12:43:46 2009 (r5673) @@ -13,11 +13,12 @@ { char *testbed = setup_testbed("multisync_easy_new"); - OSyncGroup *group = osync_group_new(NULL); + OSyncError *error = NULL; + OSyncGroup *group = osync_group_new(&error); osync_group_set_schemadir(group, testbed); - osync_group_load(group, "configs/group", NULL); + osync_group_load(group, "configs/group", &error); - fail_unless(osync_group_lock(group) == OSYNC_LOCK_OK, NULL); + fail_unless(osync_group_lock(group, &error) == OSYNC_LOCK_OK, NULL); osync_group_unlock(group); osync_group_unref(group); @@ -31,14 +32,15 @@ { char *testbed = setup_testbed("multisync_easy_new"); - OSyncGroup *group = osync_group_new(NULL); + OSyncError *error = NULL; + OSyncGroup *group = osync_group_new(&error); osync_group_set_schemadir(group, testbed); - osync_group_load(group, "configs/group", NULL); + osync_group_load(group, "configs/group", &error); - fail_unless(osync_group_lock(group) == OSYNC_LOCK_OK, NULL); + fail_unless(osync_group_lock(group, &error) == OSYNC_LOCK_OK, NULL); osync_group_unlock(group); - fail_unless(osync_group_lock(group) == OSYNC_LOCK_OK, NULL); + fail_unless(osync_group_lock(group, &error) == OSYNC_LOCK_OK, NULL); osync_group_unlock(group); osync_group_unref(group); @@ -52,12 +54,13 @@ { char *testbed = setup_testbed("multisync_easy_new"); - OSyncGroup *group = osync_group_new(NULL); + OSyncError *error = NULL; + OSyncGroup *group = osync_group_new(&error); osync_group_set_schemadir(group, testbed); - osync_group_load(group, "configs/group", NULL); + osync_group_load(group, "configs/group", &error); - fail_unless(osync_group_lock(group) == OSYNC_LOCK_OK, NULL); - fail_unless(osync_group_lock(group) == OSYNC_LOCKED, NULL); + fail_unless(osync_group_lock(group, &error) == OSYNC_LOCK_OK, NULL); + fail_unless(osync_group_lock(group, &error) == OSYNC_LOCKED, NULL); osync_group_unlock(group); osync_group_unref(group); @@ -70,15 +73,16 @@ { char *testbed = setup_testbed("multisync_easy_new"); - OSyncGroup *group = osync_group_new(NULL); + OSyncError *error = NULL; + OSyncGroup *group = osync_group_new(&error); osync_group_set_schemadir(group, testbed); - osync_group_load(group, "configs/group", NULL); + osync_group_load(group, "configs/group", &error); OSyncGroup *group2 = osync_group_new(NULL); osync_group_set_schemadir(group, testbed); - osync_group_load(group2, "configs/group", NULL); + osync_group_load(group2, "configs/group", &error); - fail_unless(osync_group_lock(group) == OSYNC_LOCK_OK, NULL); - fail_unless(osync_group_lock(group2) == OSYNC_LOCKED, NULL); + fail_unless(osync_group_lock(group, &error) == OSYNC_LOCK_OK, NULL); + fail_unless(osync_group_lock(group2, &error) == OSYNC_LOCKED, NULL); osync_group_unlock(group); osync_group_unref(group); |
From: <svn...@op...> - 2009-06-17 10:24:03
|
Author: bricks Date: Wed Jun 17 12:23:57 2009 New Revision: 5672 URL: http://www.opensync.org/changeset/5672 Log: Added an OSyncError parameter for osync_format_env_register_converter format plugin related changes refs #1087 Modified: format-plugins/tomboy-note/src/tomboy_note.c format-plugins/vformat/src/vcard.c format-plugins/vformat/src/vevent.c format-plugins/vformat/src/vformat-xmlformat.c format-plugins/vformat/src/vjournal.c format-plugins/vformat/src/vnote.c format-plugins/vformat/src/vtodo.c format-plugins/xmlformat/trunk/src/xmlformat-doc.c Modified: format-plugins/tomboy-note/src/tomboy_note.c ============================================================================== --- format-plugins/tomboy-note/src/tomboy_note.c Wed Jun 17 12:23:24 2009 (r5671) +++ format-plugins/tomboy-note/src/tomboy_note.c Wed Jun 17 12:23:57 2009 (r5672) @@ -626,7 +626,7 @@ OSyncFormatConverter *conv = osync_converter_new_detector(plain, tomboynote, detect_tomboynote, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); OSyncObjFormat *xmlformat = osync_format_env_find_objformat(env, "xmlformat-note"); @@ -640,7 +640,7 @@ osync_error_unref(error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, tomboynote, xmlformat, conv_tomboynote_to_xmlformat, error); @@ -649,7 +649,7 @@ osync_error_unref(error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); return TRUE; Modified: format-plugins/vformat/src/vcard.c ============================================================================== --- format-plugins/vformat/src/vcard.c Wed Jun 17 12:23:24 2009 (r5671) +++ format-plugins/vformat/src/vcard.c Wed Jun 17 12:23:57 2009 (r5672) @@ -138,13 +138,13 @@ OSyncFormatConverter *conv = osync_converter_new_detector(plain, vcard21, detect_plain_as_vcard21, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); conv = osync_converter_new_detector(plain, vcard30, detect_plain_as_vcard30, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); return TRUE; Modified: format-plugins/vformat/src/vevent.c ============================================================================== --- format-plugins/vformat/src/vevent.c Wed Jun 17 12:23:24 2009 (r5671) +++ format-plugins/vformat/src/vevent.c Wed Jun 17 12:23:57 2009 (r5672) @@ -143,13 +143,13 @@ OSyncFormatConverter *conv = osync_converter_new_detector(plain, vevent10, detect_plain_as_vevent10, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); conv = osync_converter_new_detector(plain, vevent20, detect_plain_as_vevent20, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); return TRUE; Modified: format-plugins/vformat/src/vformat-xmlformat.c ============================================================================== --- format-plugins/vformat/src/vformat-xmlformat.c Wed Jun 17 12:23:24 2009 (r5671) +++ format-plugins/vformat/src/vformat-xmlformat.c Wed Jun 17 12:23:57 2009 (r5672) @@ -62,7 +62,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, vevent10, xmlformat, conv_vevent10_to_xmlformat, &error); @@ -71,7 +71,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, xmlformat, vevent20, conv_xmlformat_to_vevent20, &error); @@ -80,7 +80,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, vevent20, xmlformat, conv_vevent20_to_xmlformat, &error); @@ -89,7 +89,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); //todo stuff @@ -103,7 +103,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, vtodo20, xmlformat, conv_vtodo20_to_xmlformat, &error); @@ -112,7 +112,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, xmlformat, vtodo10, conv_xmlformat_to_vtodo10, &error); @@ -121,7 +121,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, vtodo10, xmlformat, conv_vtodo10_to_xmlformat, &error); @@ -130,7 +130,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); @@ -173,7 +173,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, vcard21, xmlformat, conv_vcard_to_xmlformat, &error); @@ -182,7 +182,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); @@ -192,7 +192,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, vcard30, xmlformat, conv_vcard_to_xmlformat, &error); @@ -201,7 +201,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); return TRUE; @@ -243,7 +243,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, vnote, xmlformat, conv_vnote_to_xmlformat, &error); @@ -252,7 +252,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, xmlformat, vjournal, conv_xmlformat_to_vjournal, &error); @@ -261,7 +261,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, vjournal, xmlformat, conv_vjournal_to_xmlformat, &error); @@ -270,7 +270,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); Modified: format-plugins/vformat/src/vjournal.c ============================================================================== --- format-plugins/vformat/src/vjournal.c Wed Jun 17 12:23:24 2009 (r5671) +++ format-plugins/vformat/src/vjournal.c Wed Jun 17 12:23:57 2009 (r5672) @@ -91,7 +91,7 @@ OSyncFormatConverter *conv = osync_converter_new_detector(plain, vjournal, detect_plain_as_vjournal, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); return TRUE; Modified: format-plugins/vformat/src/vnote.c ============================================================================== --- format-plugins/vformat/src/vnote.c Wed Jun 17 12:23:24 2009 (r5671) +++ format-plugins/vformat/src/vnote.c Wed Jun 17 12:23:57 2009 (r5672) @@ -90,7 +90,7 @@ OSyncFormatConverter *conv = osync_converter_new_detector(plain, vnote, detect_plain_as_vnote, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); return TRUE; Modified: format-plugins/vformat/src/vtodo.c ============================================================================== --- format-plugins/vformat/src/vtodo.c Wed Jun 17 12:23:24 2009 (r5671) +++ format-plugins/vformat/src/vtodo.c Wed Jun 17 12:23:57 2009 (r5672) @@ -118,13 +118,13 @@ OSyncFormatConverter *conv = osync_converter_new_detector(plain, vtodo10, detect_plain_as_vtodo10, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); conv = osync_converter_new_detector(plain, vtodo20, detect_plain_as_vtodo20, error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); return TRUE; Modified: format-plugins/xmlformat/trunk/src/xmlformat-doc.c ============================================================================== --- format-plugins/xmlformat/trunk/src/xmlformat-doc.c Wed Jun 17 12:23:24 2009 (r5671) +++ format-plugins/xmlformat/trunk/src/xmlformat-doc.c Wed Jun 17 12:23:57 2009 (r5672) @@ -155,7 +155,7 @@ conv = osync_converter_new_detector(plain, fromformat, detect_func, &error); if (!conv) return FALSE; - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); } @@ -166,7 +166,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_CONV, toformat, fromformat, from_xml, &error); @@ -175,7 +175,7 @@ osync_error_unref(&error); return FALSE; } - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); osync_converter_unref(conv); return TRUE; |
From: <svn...@op...> - 2009-06-17 10:23:36
|
Author: bricks Date: Wed Jun 17 12:23:24 2009 New Revision: 5671 URL: http://www.opensync.org/changeset/5671 Log: Added an OSyncError parameter for osync_format_env_register_converter refs #1087 Modified: trunk/opensync/format/opensync_format_env.c trunk/opensync/format/opensync_format_env.h trunk/tests/format-tests/check_conv.c trunk/tests/format-tests/check_detect.c trunk/tests/format-tests/check_format_env.c trunk/tests/mock-plugin/mock_format.c Modified: trunk/opensync/format/opensync_format_env.c ============================================================================== --- trunk/opensync/format/opensync_format_env.c Fri Jun 5 00:33:21 2009 (r5670) +++ trunk/opensync/format/opensync_format_env.c Wed Jun 17 12:23:24 2009 (r5671) @@ -853,7 +853,7 @@ return osync_list_copy(env->objformats); } -void osync_format_env_register_converter(OSyncFormatEnv *env, OSyncFormatConverter *converter) +void osync_format_env_register_converter(OSyncFormatEnv *env, OSyncFormatConverter *converter, OSyncError **error) { osync_assert(env); osync_assert(converter); @@ -862,7 +862,7 @@ * of a detector can always be used */ if (osync_converter_get_type(converter) == OSYNC_CONVERTER_DETECTOR) { - OSyncFormatConverter *conv = osync_converter_new_detector(osync_converter_get_targetformat(converter), osync_converter_get_sourceformat(converter), NULL, NULL); + OSyncFormatConverter *conv = osync_converter_new_detector(osync_converter_get_targetformat(converter), osync_converter_get_sourceformat(converter), NULL, error); if (!conv) return; Modified: trunk/opensync/format/opensync_format_env.h ============================================================================== --- trunk/opensync/format/opensync_format_env.h Fri Jun 5 00:33:21 2009 (r5670) +++ trunk/opensync/format/opensync_format_env.h Wed Jun 17 12:23:24 2009 (r5671) @@ -115,8 +115,9 @@ * * @param env The format environment * @param converter Pointer of the Format Converter or Detector + * @param error An OSyncError */ -OSYNC_EXPORT void osync_format_env_register_converter(OSyncFormatEnv *env, OSyncFormatConverter *converter); +OSYNC_EXPORT void osync_format_env_register_converter(OSyncFormatEnv *env, OSyncFormatConverter *converter, OSyncError **error); /** @brief Finds first converter with the given source and target format * Modified: trunk/tests/format-tests/check_conv.c ============================================================================== --- trunk/tests/format-tests/check_conv.c Fri Jun 5 00:33:21 2009 (r5670) +++ trunk/tests/format-tests/check_conv.c Wed Jun 17 12:23:24 2009 (r5671) @@ -149,7 +149,7 @@ fail_unless(converter != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); osync_converter_unref(converter); @@ -187,7 +187,7 @@ fail_unless(osync_format_env_num_converters(env) == 0, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); fail_unless(osync_format_env_num_converters(env) == 1, NULL); fail_unless(osync_format_env_nth_converter(env, 0) == converter, NULL); @@ -226,7 +226,7 @@ fail_unless(converter != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); osync_converter_unref(converter); fail_unless(osync_format_env_find_converter(env, format1, format2) == converter, NULL); @@ -268,7 +268,7 @@ fail_unless(converter != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); osync_converter_unref(converter); fail_unless(osync_format_env_find_converter(env, format1, format3) == NULL, NULL); @@ -393,7 +393,7 @@ OSyncFormatConverter *converter = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); osync_converter_unref(converter); OSyncData *data1 = osync_data_new(g_strdup("data"), 5, format1, &error); @@ -461,13 +461,13 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format3, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncData *data1 = osync_data_new(g_strdup("data"), 5, format1, &error); @@ -523,13 +523,13 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format2, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncData *data1 = osync_data_new("data", 5, format1, &error); @@ -589,25 +589,25 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format4, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format3, convert_func, &error); fail_unless(converter3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format4, convert_func, &error); fail_unless(converter4 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncData *data1 = osync_data_new(g_strdup("data"), 5, format1, &error); @@ -672,25 +672,25 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format4, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format3, convert_func, &error); fail_unless(converter3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format4, convert_func, &error); fail_unless(converter4 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncData *data1 = osync_data_new(g_strdup("data"), 5, format1, &error); @@ -751,19 +751,19 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format3, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format1, convert_func, &error); fail_unless(converter3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncData *data1 = osync_data_new("data", 5, format1, &error); @@ -848,55 +848,55 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format3, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format4, convert_func, &error); fail_unless(converter3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format5, convert_func, &error); fail_unless(converter4 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncFormatConverter *converter5 = osync_converter_new(OSYNC_CONVERTER_CONV, format4, format7, convert_func, &error); fail_unless(converter5 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter5); + osync_format_env_register_converter(env, converter5, &error); osync_converter_unref(converter5); OSyncFormatConverter *converter6 = osync_converter_new(OSYNC_CONVERTER_CONV, format5, format7, convert_func, &error); fail_unless(converter6 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter6); + osync_format_env_register_converter(env, converter6, &error); osync_converter_unref(converter6); OSyncFormatConverter *converter7 = osync_converter_new(OSYNC_CONVERTER_CONV, format7, format8, convert_func, &error); fail_unless(converter7 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter7); + osync_format_env_register_converter(env, converter7, &error); osync_converter_unref(converter7); OSyncFormatConverter *converter8 = osync_converter_new(OSYNC_CONVERTER_CONV, format8, format6, convert_func, &error); fail_unless(converter8 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter8); + osync_format_env_register_converter(env, converter8, &error); osync_converter_unref(converter8); OSyncFormatConverter *converter9 = osync_converter_new(OSYNC_CONVERTER_CONV, format5, format6, convert_func, &error); fail_unless(converter9 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter9); + osync_format_env_register_converter(env, converter9, &error); osync_converter_unref(converter9); OSyncData *data1 = osync_data_new(g_strdup("data"), 5, format1, &error); @@ -957,13 +957,13 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format3, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncList *targets = NULL; @@ -1026,19 +1026,19 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format4, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format3, convert_func, &error); fail_unless(converter3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncList *targets = NULL; @@ -1112,31 +1112,31 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format4, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format3, convert_func, &error); fail_unless(converter3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format4, convert_func, &error); fail_unless(converter4 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncFormatConverter *converter5 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format5, convert_func, &error); fail_unless(converter5 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter5); + osync_format_env_register_converter(env, converter5, &error); osync_converter_unref(converter5); OSyncList *targets = NULL; @@ -1212,31 +1212,31 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_func, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format4, convert_func, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format3, convert_func, &error); fail_unless(converter3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format4, convert_func, &error); fail_unless(converter4 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncFormatConverter *converter5 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format5, convert_func, &error); fail_unless(converter5 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter5); + osync_format_env_register_converter(env, converter5, &error); osync_converter_unref(converter5); OSyncList *targets = NULL; @@ -1346,13 +1346,13 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_addtest, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format3, convert_addtest2, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); mark_point(); @@ -1407,25 +1407,25 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_CONV, format1, format2, convert_addtest, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format1, convert_remtest, &error); fail_unless(converter1_back != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format3, convert_addtest2, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter2_back = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format2, convert_remtest2, &error); fail_unless(converter2_back != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2_back); + osync_format_env_register_converter(env, converter2_back, &error); osync_converter_unref(converter2_back); mark_point(); @@ -1497,25 +1497,25 @@ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_DECAP, format1, format2, convert_addtest, &error); fail_unless(converter1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format2, format1, convert_remtest, &error); fail_unless(converter1_back != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_DECAP, format2, format3, convert_addtest2, &error); fail_unless(converter2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter2_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format3, format2, convert_remtest2, &error); fail_unless(converter2_back != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter2_back); + osync_format_env_register_converter(env, converter2_back, &error); osync_converter_unref(converter2_back); mark_point(); @@ -1608,59 +1608,59 @@ OSyncFormatConverter *detector1 = osync_converter_new_detector(format2, format4, detect_true, &error); fail_unless(detector1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector1); + osync_format_env_register_converter(env, detector1, &error); // osync_converter_unref(detector1); OSyncFormatConverter *detector2 = osync_converter_new_detector(format2, format3, detect_false, &error); fail_unless(detector2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector2); + osync_format_env_register_converter(env, detector2, &error); // osync_converter_unref(detector2); /*** Converter ***/ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_DECAP, format1, format2, convert_addtest, &error); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format2, format1, convert_remtest, &error); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_DECAP, format2, format3, convert_addtest2, &error); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter2_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format3, format2, convert_remtest2, &error); - osync_format_env_register_converter(env, converter2_back); + osync_format_env_register_converter(env, converter2_back, &error); osync_converter_unref(converter2_back); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_DECAP, format2, format4, convert_addtest2, &error); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter3_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format4, format2, convert_remtest2, &error); - osync_format_env_register_converter(env, converter3_back); + osync_format_env_register_converter(env, converter3_back, &error); osync_converter_unref(converter3_back); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format6, convert_addtest2, &error); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncFormatConverter *converter5 = osync_converter_new(OSYNC_CONVERTER_CONV, format4, format5, convert_addtest2, &error); - osync_format_env_register_converter(env, converter5); + osync_format_env_register_converter(env, converter5, &error); osync_converter_unref(converter5); OSyncFormatConverter *converter6 = osync_converter_new(OSYNC_CONVERTER_CONV, format5, format4, convert_remtest2, &error); - osync_format_env_register_converter(env, converter6); + osync_format_env_register_converter(env, converter6, &error); osync_converter_unref(converter6); OSyncFormatConverter *converter7 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format5, format6, convert_addtest2, &error); - osync_format_env_register_converter(env, converter7); + osync_format_env_register_converter(env, converter7, &error); osync_converter_unref(converter7); OSyncFormatConverter *converter7_back = osync_converter_new(OSYNC_CONVERTER_DECAP, format6, format5, convert_remtest2, &error); - osync_format_env_register_converter(env, converter7_back); + osync_format_env_register_converter(env, converter7_back, &error); osync_converter_unref(converter7_back); mark_point(); @@ -1737,7 +1737,7 @@ OSyncFormatConverter *detector1 = osync_converter_new_detector(format1, format2, detect_true, &error); fail_unless(detector1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector1); + osync_format_env_register_converter(env, detector1, &error); // osync_converter_unref(detector1); /* Detect F3, not F4 */ @@ -1745,47 +1745,47 @@ OSyncFormatConverter *detector2 = osync_converter_new_detector(format2, format3, detect_true, &error); fail_unless(detector2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector2); + osync_format_env_register_converter(env, detector2, &error); // osync_converter_unref(detector2); OSyncFormatConverter *detector3 = osync_converter_new_detector(format2, format4, detect_false, &error); fail_unless(detector3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector3); + osync_format_env_register_converter(env, detector3, &error); // osync_converter_unref(detector3); /*** Converter ***/ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_DECAP, format1, format2, convert_addtest, &error); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format2, format1, convert_remtest, &error); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_DECAP, format2, format3, convert_addtest2, &error); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter2_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format3, format2, convert_remtest2, &error); - osync_format_env_register_converter(env, converter2_back); + osync_format_env_register_converter(env, converter2_back, &error); osync_converter_unref(converter2_back); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_DECAP, format2, format4, convert_addtest2, &error); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter3_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format4, format2, convert_remtest2, &error); - osync_format_env_register_converter(env, converter3_back); + osync_format_env_register_converter(env, converter3_back, &error); osync_converter_unref(converter3_back); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format4, convert_addtest2, &error); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncFormatConverter *converter5 = osync_converter_new(OSYNC_CONVERTER_CONV, format4, format3, convert_remtest2, &error); - osync_format_env_register_converter(env, converter5); + osync_format_env_register_converter(env, converter5, &error); osync_converter_unref(converter5); @@ -1872,7 +1872,7 @@ OSyncFormatConverter *detector1 = osync_converter_new_detector(format1, format2, detect_true, &error); fail_unless(detector1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector1); + osync_format_env_register_converter(env, detector1, &error); // osync_converter_unref(detector1); /* Detect F3, not F4 */ @@ -1880,35 +1880,35 @@ OSyncFormatConverter *detector2 = osync_converter_new_detector(format2, format3, detect_true, &error); fail_unless(detector2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector2); + osync_format_env_register_converter(env, detector2, &error); // osync_converter_unref(detector2); OSyncFormatConverter *detector3 = osync_converter_new_detector(format2, format4, detect_false, &error); fail_unless(detector3 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector3); + osync_format_env_register_converter(env, detector3, &error); // osync_converter_unref(detector3); /*** Converter ***/ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format1, format2, convert_addtest, &error); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format2, format3, convert_addtest, &error); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format3, format5, convert_addtest, &error); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter2_back = osync_converter_new(OSYNC_CONVERTER_DECAP, format1, format4, convert_addtest2, &error); - osync_format_env_register_converter(env, converter2_back); + osync_format_env_register_converter(env, converter2_back, &error); osync_converter_unref(converter2_back); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format4, format5, convert_addtest2, &error); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); mark_point(); @@ -1991,27 +1991,27 @@ /*** Converter ***/ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format1, format2, convert_addtest, &error); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format2, format3, convert_addtest, &error); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format3, format4, convert_addtest, &error); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format4, format5, convert_addtest, &error); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format5, format6, convert_addtest, &error); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncFormatConverter *converter5 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format1, format_g1, convert_addtest2, &error); - osync_format_env_register_converter(env, converter5); + osync_format_env_register_converter(env, converter5, &error); osync_converter_unref(converter5); mark_point(); @@ -2100,27 +2100,27 @@ /*** Converter ***/ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format1, format2, convert_addtest, &error); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_DECAP, format2, format3, convert_addtest, &error); /* Lossy */ - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format3, format4, convert_addtest, &error); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter3 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format4, format5, convert_addtest, &error); - osync_format_env_register_converter(env, converter3); + osync_format_env_register_converter(env, converter3, &error); osync_converter_unref(converter3); OSyncFormatConverter *converter4 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format5, format6, convert_addtest, &error); - osync_format_env_register_converter(env, converter4); + osync_format_env_register_converter(env, converter4, &error); osync_converter_unref(converter4); OSyncFormatConverter *converter5 = osync_converter_new(OSYNC_CONVERTER_ENCAP, format1, format_g1, convert_addtest2, &error); - osync_format_env_register_converter(env, converter5); + osync_format_env_register_converter(env, converter5, &error); osync_converter_unref(converter5); mark_point(); @@ -2180,31 +2180,31 @@ OSyncFormatConverter *detector1 = osync_converter_new_detector(format1, format2, detect_true, &error); fail_unless(detector1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector1); + osync_format_env_register_converter(env, detector1, &error); // osync_converter_unref(detector1); OSyncFormatConverter *detector2 = osync_converter_new_detector(format2, format3, detect_false, &error); fail_unless(detector2 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector2); + osync_format_env_register_converter(env, detector2, &error); // osync_converter_unref(detector2); /*** Converter ***/ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_DECAP, format1, format2, convert_addtest, &error); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format2, format1, convert_remtest, &error); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_DECAP, format2, format3, convert_addtest2, &error); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter2_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format3, format2, convert_remtest2, &error); - osync_format_env_register_converter(env, converter2_back); + osync_format_env_register_converter(env, converter2_back, &error); osync_converter_unref(converter2_back); mark_point(); @@ -2258,25 +2258,25 @@ OSyncFormatConverter *detector1 = osync_converter_new_detector(format_plain, format2, detect_plain_as_f2, &error); fail_unless(detector1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector1); + osync_format_env_register_converter(env, detector1, &error); // osync_converter_unref(detector1); /*** Converter ***/ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_DECAP, format1, format_plain, convert_addtest, &error); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format_plain, format1, convert_remtest, &error); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format3, convert_addtest, &error); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter2_back = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format2, convert_remtest, &error); - osync_format_env_register_converter(env, converter2_back); + osync_format_env_register_converter(env, converter2_back, &error); osync_converter_unref(converter2_back); mark_point(); @@ -2383,25 +2383,25 @@ OSyncFormatConverter *detector1 = osync_converter_new_detector(format_plain, format2, detect_f2, &error); fail_unless(detector1 != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, detector1); + osync_format_env_register_converter(env, detector1, &error); // osync_converter_unref(detector1); /*** Converter ***/ OSyncFormatConverter *converter1 = osync_converter_new(OSYNC_CONVERTER_DECAP, format1, format_plain, convert_f1_to_f2, &error); - osync_format_env_register_converter(env, converter1); + osync_format_env_register_converter(env, converter1, &error); osync_converter_unref(converter1); OSyncFormatConverter *converter1_back = osync_converter_new(OSYNC_CONVERTER_ENCAP, format_plain, format1, convert_f2_to_f1, &error); - osync_format_env_register_converter(env, converter1_back); + osync_format_env_register_converter(env, converter1_back, &error); osync_converter_unref(converter1_back); OSyncFormatConverter *converter2 = osync_converter_new(OSYNC_CONVERTER_CONV, format2, format3, convert_addtest, &error); - osync_format_env_register_converter(env, converter2); + osync_format_env_register_converter(env, converter2, &error); osync_converter_unref(converter2); OSyncFormatConverter *converter2_back = osync_converter_new(OSYNC_CONVERTER_CONV, format3, format2, convert_remtest, &error); - osync_format_env_register_converter(env, converter2_back); + osync_format_env_register_converter(env, converter2_back, &error); osync_converter_unref(converter2_back); mark_point(); Modified: trunk/tests/format-tests/check_detect.c ============================================================================== --- trunk/tests/format-tests/check_detect.c Fri Jun 5 00:33:21 2009 (r5670) +++ trunk/tests/format-tests/check_detect.c Wed Jun 17 12:23:24 2009 (r5671) @@ -24,7 +24,7 @@ OSyncFormatConverter *conv = osync_converter_new_detector(format2, format1, detect, &error); fail_unless(error == NULL); - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); mark_point(); @@ -55,7 +55,7 @@ OSyncFormatConverter *conv = osync_converter_new_detector(format2, format1, detect, &error); fail_unless(error == NULL); - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); mark_point(); @@ -86,7 +86,7 @@ OSyncFormatConverter *conv = osync_converter_new_detector(format2, format1, detect_false, &error); fail_unless(error == NULL); - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, &error); mark_point(); Modified: trunk/tests/format-tests/check_format_env.c ============================================================================== --- trunk/tests/format-tests/check_format_env.c Fri Jun 5 00:33:21 2009 (r5670) +++ trunk/tests/format-tests/check_format_env.c Wed Jun 17 12:23:24 2009 (r5671) @@ -147,7 +147,7 @@ fail_unless(converter != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); osync_converter_unref(converter); @@ -185,7 +185,7 @@ fail_unless(osync_format_env_num_converters(env) == 0, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); fail_unless(osync_format_env_num_converters(env) == 1, NULL); fail_unless(osync_format_env_nth_converter(env, 0) == converter, NULL); @@ -224,7 +224,7 @@ fail_unless(converter != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); osync_converter_unref(converter); fail_unless(osync_format_env_find_converter(env, format1, format2) == converter, NULL); @@ -266,7 +266,7 @@ fail_unless(converter != NULL, NULL); fail_unless(error == NULL, NULL); - osync_format_env_register_converter(env, converter); + osync_format_env_register_converter(env, converter, &error); osync_converter_unref(converter); fail_unless(osync_format_env_find_converter(env, format1, format3) == NULL, NULL); Modified: trunk/tests/mock-plugin/mock_format.c ============================================================================== --- trunk/tests/mock-plugin/mock_format.c Fri Jun 5 00:33:21 2009 (r5670) +++ trunk/tests/mock-plugin/mock_format.c Wed Jun 17 12:23:24 2009 (r5671) @@ -291,13 +291,13 @@ conv = osync_converter_new(OSYNC_CONVERTER_ENCAP, mockformat1, mockformat2, conv_mockformat1_to_mockformat2, error); osync_assert(conv); - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); conv = osync_converter_new(OSYNC_CONVERTER_DECAP, mockformat2, mockformat1, conv_mockformat2_to_mockformat1, error); osync_assert(conv); - osync_format_env_register_converter(env, conv); + osync_format_env_register_converter(env, conv, error); osync_converter_unref(conv); |
From: <svn...@op...> - 2009-06-15 16:29:04
|
Author: bellmich Date: Mon Jun 15 18:27:55 2009 New Revision: 1088 URL: http://libsyncml.opensync.org/changeset/1088 Log: migrated SmlDevInfContentType to GObject Added: trunk/libsyncml/dev_inf_api/ trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.c trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.h trunk/tests/check_dev_inf_content_type.c Modified: trunk/CMakeLists.txt trunk/libsyncml/CMakeLists.txt trunk/libsyncml/data_sync_api/data_sync_devinf.c trunk/libsyncml/parser/sml_xml_assm.c trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_devinf.c trunk/libsyncml/sml_devinf.h trunk/libsyncml/syncml.h trunk/tests/CMakeLists.txt Modified: trunk/CMakeLists.txt ============================================================================== --- trunk/CMakeLists.txt Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/CMakeLists.txt Mon Jun 15 18:27:55 2009 (r1088) @@ -187,6 +187,12 @@ INCLUDE( Testing ) ENDIF(CHECK_FOUND) +IF(MEMORYCHECK_COMMAND) + SET( MEMORYCHECK_AVAILABLE ON ) +ELSE(MEMORYCHECK_COMMAND) + SET( MEMORYCHECK_AVAILABLE OFF ) +ENDIF(MEMORYCHECK_COMMAND) + OPTION( ENABLE_TOOLS "enable building tools" ON ) OPTION( ENABLE_TRACE "enable tracing" ON ) OPTION( ENABLE_BASE64_TEST "enable deprecated base64 tests" OFF ) @@ -254,6 +260,7 @@ SHOW_STATUS( ENABLE_TRACE "tracing tools\t\t" ) SHOW_STATUS( ENABLE_UNIT_TEST "unit tests\t\t\t" ) SHOW_STATUS( THREAD_SAFE_CHECK "check is thread safe\t\t" CHECK_VERSION ) +SHOW_STATUS( MEMORYCHECK_AVAILABLE "memory debugger\t\t" ) SHOW_STATUS( ENABLE_WBXML "WAP Binary XML\t\t" LIBWBXML2_VERSION ) SHOW_STATUS( ENABLE_HTTP "http transports\t\t" LIBSOUP2_VERSION ) SHOW_STATUS( ENABLE_OBEX "obex transports\t\t" OPENOBEX_VERSION ) Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/libsyncml/CMakeLists.txt Mon Jun 15 18:27:55 2009 (r1088) @@ -33,6 +33,7 @@ parser/sml_wbxml.c parser/sml_xml_assm.c parser/sml_xml_parse.c + dev_inf_api/sml-dev-inf-content-type.c ) IF ( ENABLE_OBEX ) @@ -90,3 +91,10 @@ DESTINATION ${LIBSYNCML_INCLUDE_DIR}/libsyncml/data_sync_api ) +## install header files of DevInf API + +INSTALL( FILES + dev_inf_api/sml-dev-inf-content-type.h + DESTINATION ${LIBSYNCML_INCLUDE_DIR}/libsyncml/dev_inf_api +) + Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Mon Jun 15 18:27:55 2009 (r1088) @@ -118,17 +118,21 @@ smlAssert(verct); // first we check for an already configure CTCap - SmlDevInfContentType *ct = smlDevInfNewContentType(cttype, verct, error); - if (!ct) + GError *gerror = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(cttype, verct, &gerror); + if (!ct) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } if (smlDevInfGetCTCap(devinf, ct) != NULL) { - smlDevInfFreeContentType(ct); + g_object_unref(ct); smlTrace(TRACE_EXIT, "%s - content type already present in devinf", __func__); return TRUE; } else { - smlDevInfFreeContentType(ct); + g_object_unref(ct); smlTrace(TRACE_INTERNAL, "%s: new content type detected", __func__); } @@ -454,18 +458,25 @@ const char *ct = datastore->contentType; SmlDevInfContentType *ctype; + GError *gerror = NULL; if (!strcmp(ct, SML_ELEMENT_TEXT_VCARD)) { // we prefer actually vCard 2.1 // because the most cellphones support it - ctype = smlDevInfNewContentType(SML_ELEMENT_TEXT_VCARD_30, "3.0", error); - if (!ctype) + ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "3.0", &gerror); + if (!ctype) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } smlDevInfDataStoreAddRx(ds, ctype); - ctype = smlDevInfNewContentType(SML_ELEMENT_TEXT_VCARD_30, "3.0", error); - if (!ctype) + ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "3.0", &gerror); + if (!ctype) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } smlDevInfDataStoreAddTx(ds, ctype); smlDevInfDataStoreSetRxPref(ds, SML_ELEMENT_TEXT_VCARD, "2.1"); smlDevInfDataStoreSetTxPref(ds, SML_ELEMENT_TEXT_VCARD, "2.1"); @@ -476,13 +487,19 @@ } else if (!strcmp(ct, SML_ELEMENT_TEXT_VCARD_30)) { - ctype = smlDevInfNewContentType(SML_ELEMENT_TEXT_VCARD_30, "2.1", error); - if (!ctype) + ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "2.1", &gerror); + if (!ctype) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } smlDevInfDataStoreAddRx(ds, ctype); - ctype = smlDevInfNewContentType(SML_ELEMENT_TEXT_VCARD_30, "2.1", error); - if (!ctype) + ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCARD_30, "2.1", &gerror); + if (!ctype) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } smlDevInfDataStoreAddTx(ds, ctype); smlDevInfDataStoreSetRxPref(ds, SML_ELEMENT_TEXT_VCARD_30, "3.0"); smlDevInfDataStoreSetTxPref(ds, SML_ELEMENT_TEXT_VCARD_30, "3.0"); @@ -493,13 +510,19 @@ } else if (!strcmp(ct, SML_ELEMENT_TEXT_VCAL)) { - ctype = smlDevInfNewContentType(SML_ELEMENT_TEXT_ICAL, "2.0", error); - if (!ctype) + ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_ICAL, "2.0", &gerror); + if (!ctype) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } smlDevInfDataStoreAddRx(ds, ctype); - ctype = smlDevInfNewContentType(SML_ELEMENT_TEXT_ICAL, "2.0", error); - if (!ctype) + ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_ICAL, "2.0", &gerror); + if (!ctype) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } smlDevInfDataStoreAddTx(ds, ctype); smlDevInfDataStoreSetRxPref(ds, SML_ELEMENT_TEXT_VCAL, "1.0"); smlDevInfDataStoreSetTxPref(ds, SML_ELEMENT_TEXT_VCAL, "1.0"); @@ -510,13 +533,19 @@ } else if (!strcmp(ct, SML_ELEMENT_TEXT_ICAL)) { - ctype = smlDevInfNewContentType(SML_ELEMENT_TEXT_VCAL, "1.0", error); - if (!ctype) + ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCAL, "1.0", &gerror); + if (!ctype) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } smlDevInfDataStoreAddRx(ds, ctype); - ctype = smlDevInfNewContentType(SML_ELEMENT_TEXT_VCAL, "1.0", error); - if (!ctype) + ctype = sml_dev_inf_content_type_new(SML_ELEMENT_TEXT_VCAL, "1.0", &gerror); + if (!ctype) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error; + } smlDevInfDataStoreAddTx(ds, ctype); smlDevInfDataStoreSetRxPref(ds, SML_ELEMENT_TEXT_ICAL, "2.0"); smlDevInfDataStoreSetTxPref(ds, SML_ELEMENT_TEXT_ICAL, "2.0"); Added: trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.c Mon Jun 15 18:27:55 2009 (r1088) @@ -0,0 +1,199 @@ +/* sml-dev-inf-content-type.c */ + +#include "sml-dev-inf-content-type.h" + +G_DEFINE_TYPE (SmlDevInfContentType, sml_dev_inf_content_type, G_TYPE_OBJECT) + +enum +{ + PROP_0, + PROP_CTTYPE, + PROP_VERCT +}; + +struct _SmlDevInfContentTypePrivate +{ + gchar* cttype; + gchar* verct; +}; + +static void +sml_dev_inf_content_type_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_CTTYPE: + g_value_set_string (value, SML_DEV_INF_CONTENT_TYPE (object)->priv->cttype); + break; + case PROP_VERCT: + g_value_set_string (value, SML_DEV_INF_CONTENT_TYPE (object)->priv->verct); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +sml_dev_inf_content_type_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +sml_dev_inf_content_type_finalize (GObject *object) +{ + g_return_if_fail (SML_IS_DEV_INF_CONTENT_TYPE (object)); + SmlDevInfContentType *self = (SmlDevInfContentType*) object; + if (self->priv->cttype != NULL) + g_free(self->priv->cttype); + if (self->priv->verct != NULL) + g_free(self->priv->verct); + G_OBJECT_CLASS (sml_dev_inf_content_type_parent_class)->finalize (object); +} + +static void +sml_dev_inf_content_type_class_init (SmlDevInfContentTypeClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (SmlDevInfContentTypePrivate)); + + object_class->get_property = sml_dev_inf_content_type_get_property; + object_class->set_property = sml_dev_inf_content_type_set_property; + object_class->finalize = sml_dev_inf_content_type_finalize; + + /** + * SmlDevInfContentType:CTType: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_CTTYPE, + g_param_spec_string ("CTType", + "", + "", + NULL, + G_PARAM_READABLE)); + /** + * SmlDevInfContentType:VerCT: + * + * The property. + */ + g_object_class_install_property (object_class, + PROP_VERCT, + g_param_spec_string ("VerCT", + "", + "", + NULL, + G_PARAM_READABLE)); + +} + +static void +sml_dev_inf_content_type_init (SmlDevInfContentType *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, + SML_TYPE_DEV_INF_CONTENT_TYPE, + SmlDevInfContentTypePrivate); +} + +/** + * sml_dev_inf_content_type_new: + * + * Creates a new instance of #SmlDevInfContentType. + * + * Return value: the newly created #SmlDevInfContentType instance + */ +SmlDevInfContentType* +sml_dev_inf_content_type_new (const gchar* cttype, + const gchar* verct, + GError **error) +{ + SmlDevInfContentType* self = g_object_new (SML_TYPE_DEV_INF_CONTENT_TYPE, NULL); + self->priv->cttype = g_strdup(cttype); + self->priv->verct = g_strdup(verct); + return self; +} + +/** + * sml_dev_inf_content_type_get_cttype: + * @self: A #SmlDevInfContentType + * + * Gets the property. + * + * Return value: + */ +G_CONST_RETURN gchar* +sml_dev_inf_content_type_get_cttype (SmlDevInfContentType *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CONTENT_TYPE (self), NULL); + return self->priv->cttype; +} + +/** + * sml_dev_inf_content_type_get_verct: + * @self: A #SmlDevInfContentType + * + * Gets the property. + * + * Return value: + */ +G_CONST_RETURN gchar* +sml_dev_inf_content_type_get_verct (SmlDevInfContentType *self) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CONTENT_TYPE (self), NULL); + return self->priv->verct; +} + +/** + * sml_dev_inf_content_type_set_cttype: + * @self: A #SmlDevInfContentType + * @cttype: The content type string + * @error: A potential failure reason + * + * Sets the property. + * + * Return value: + */ +gboolean +sml_dev_inf_content_type_set_cttype (SmlDevInfContentType *self, const gchar* cttype, GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CONTENT_TYPE (self), FALSE); + if (self->priv->cttype) { + g_free(self->priv->cttype); + self->priv->cttype = NULL; + } + self->priv->cttype = g_strdup(cttype); + return TRUE; +} + +/** + * sml_dev_inf_content_type_get_verct: + * @self: A #SmlDevInfContentType + * @verct: The version of the content type + * @error: A potential failure reason + * + * Gets the property. + * + * Return value: + */ +gboolean +sml_dev_inf_content_type_set_verct (SmlDevInfContentType *self, const gchar* verct, GError **error) +{ + g_return_val_if_fail (SML_IS_DEV_INF_CONTENT_TYPE (self), FALSE); + if (self->priv->verct) { + g_free(self->priv->verct); + self->priv->verct = NULL; + } + self->priv->verct = g_strdup(verct); + return TRUE; +} + Added: trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/libsyncml/dev_inf_api/sml-dev-inf-content-type.h Mon Jun 15 18:27:55 2009 (r1088) @@ -0,0 +1,44 @@ +/* sml-dev-inf-content-type.h */ + +#ifndef __SML_DEV_INF_CONTENT_TYPE_H__ +#define __SML_DEV_INF_CONTENT_TYPE_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define SML_TYPE_DEV_INF_CONTENT_TYPE (sml_dev_inf_content_type_get_type()) +#define SML_DEV_INF_CONTENT_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SML_TYPE_DEV_INF_CONTENT_TYPE, SmlDevInfContentType)) +#define SML_DEV_INF_CONTENT_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SML_TYPE_DEV_INF_CONTENT_TYPE, SmlDevInfContentTypeClass)) +#define SML_IS_DEV_INF_CONTENT_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SML_TYPE_DEV_INF_CONTENT_TYPE)) +#define SML_IS_DEV_INF_CONTENT_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SML_TYPE_DEV_INF_CONTENT_TYPE)) +#define SML_DEV_INF_CONTENT_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SML_TYPE_DEV_INF_CONTENT_TYPE, SmlDevInfContentTypeClass)) + +typedef struct _SmlDevInfContentType SmlDevInfContentType; +typedef struct _SmlDevInfContentTypeClass SmlDevInfContentTypeClass; +typedef struct _SmlDevInfContentTypePrivate SmlDevInfContentTypePrivate; + +struct _SmlDevInfContentType +{ + GObject parent; + + /*< private >*/ + SmlDevInfContentTypePrivate *priv; +}; + +struct _SmlDevInfContentTypeClass +{ + GObjectClass parent_class; + +}; + +GType sml_dev_inf_content_type_get_type (void); +SmlDevInfContentType* sml_dev_inf_content_type_new (const gchar* cttype, const gchar* verct, GError **error); +G_CONST_RETURN gchar* sml_dev_inf_content_type_get_cttype (SmlDevInfContentType *self); +G_CONST_RETURN gchar* sml_dev_inf_content_type_get_verct (SmlDevInfContentType *self); +gboolean sml_dev_inf_content_type_set_cttype (SmlDevInfContentType *self, const gchar* cttype, GError **error); +gboolean sml_dev_inf_content_type_set_verct (SmlDevInfContentType *self, const gchar* verct, GError **error); + +G_END_DECLS + +#endif /* __SML_DEV_INF_CONTENT_TYPE_H__ */ Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/libsyncml/parser/sml_xml_assm.c Mon Jun 15 18:27:55 2009 (r1088) @@ -2063,7 +2063,7 @@ } // add CTType - if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_CTTYPE, ctcap->ct->cttype, error)) + if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_CTTYPE, sml_dev_inf_content_type_get_cttype(ctcap->ct), error)) goto error; // add VerCT @@ -2071,7 +2071,7 @@ // because this info is in the VERSION property. if (!flat) { - if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VERCT, ctcap->ct->verct, error)) + if (!_smlXmlAssemblerAddString(assm, SML_ELEMENT_VERCT, sml_dev_inf_content_type_get_verct(ctcap->ct), error)) goto error; } @@ -2234,6 +2234,7 @@ smlAssert(assm); GList *contentTypes = NULL; + GError *gerror = NULL; if (!datastore->sourceref) { smlErrorSet(error, SML_ERROR_GENERIC, "Missing sourceref"); @@ -2278,11 +2279,12 @@ //rx-pref if (!_smlXmlDevInfDataStoreAssembleRxTx(assm, SML_ELEMENT_RXPREF, datastore->rxPrefContentType, datastore->rxPrefVersion, error)) goto error; + /* FIXME: ignored error */ contentTypes = g_list_append( contentTypes, - smlDevInfNewContentType( + sml_dev_inf_content_type_new( datastore->rxPrefContentType, - datastore->rxPrefVersion, error)); + datastore->rxPrefVersion, &gerror)); //rx if (datastore->rx) { @@ -2290,11 +2292,11 @@ for (hl = datastore->rx; hl; hl = hl->next) { SmlDevInfContentType *ct = hl->data; - if (!_smlXmlDevInfDataStoreAssembleRxTx(assm, SML_ELEMENT_RX, ct->cttype, ct->verct, error)) + if (!_smlXmlDevInfDataStoreAssembleRxTx(assm, SML_ELEMENT_RX, sml_dev_inf_content_type_get_cttype(ct), sml_dev_inf_content_type_get_verct(ct), error)) goto error; contentTypes = g_list_append( contentTypes, - smlDevInfNewContentType(ct->cttype, ct->verct, error)); + sml_dev_inf_content_type_new(sml_dev_inf_content_type_get_cttype(ct), sml_dev_inf_content_type_get_verct(ct), &gerror)); } } @@ -2303,9 +2305,9 @@ goto error; contentTypes = g_list_append( contentTypes, - smlDevInfNewContentType( + sml_dev_inf_content_type_new( datastore->txPrefContentType, - datastore->txPrefVersion, error)); + datastore->txPrefVersion, &gerror)); //tx if (datastore->tx) { @@ -2313,11 +2315,11 @@ for (hl = datastore->tx; hl; hl = hl->next) { SmlDevInfContentType *ct = hl->data; - if (!_smlXmlDevInfDataStoreAssembleRxTx(assm, SML_ELEMENT_TX, ct->cttype, ct->verct, error)) + if (!_smlXmlDevInfDataStoreAssembleRxTx(assm, SML_ELEMENT_TX, sml_dev_inf_content_type_get_cttype(ct), sml_dev_inf_content_type_get_verct(ct), error)) goto error; contentTypes = g_list_append( contentTypes, - smlDevInfNewContentType(ct->cttype, ct->verct, error)); + sml_dev_inf_content_type_new(sml_dev_inf_content_type_get_cttype(ct), sml_dev_inf_content_type_get_verct(ct), &gerror)); } } @@ -2339,7 +2341,7 @@ // this is a real source of trouble // WARNING: should we fail on this issue? smlTrace(TRACE_INTERNAL, "%s: found a content type (%s %d) without CTCap", - __func__, VA_STRING(ct->cttype), ct->verct); + __func__, VA_STRING(sml_dev_inf_content_type_get_cttype(ct)), VA_STRING(sml_dev_inf_content_type_get_verct(ct))); } } // end of contentTypes for loop } // end of SML_DEVINF_VERSION_12 @@ -2349,7 +2351,7 @@ { SmlDevInfContentType *ct = contentTypes->data; contentTypes = g_list_remove(contentTypes, ct); - smlDevInfFreeContentType(ct); + g_object_unref(ct); } //Dsmem Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/libsyncml/parser/sml_xml_parse.c Mon Jun 15 18:27:55 2009 (r1088) @@ -3232,12 +3232,16 @@ char *verct = NULL; if (!_smlXmlDevInfDataStoreParseRxTx(parser, SML_ELEMENT_RX, &cttype, &verct, error)) goto error_free_datastore; - SmlDevInfContentType *ct = smlDevInfNewContentType(cttype, verct, error); + GError *gerror = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(cttype, verct, &gerror); smlSafeCFree(&cttype); if (verct) smlSafeCFree(&verct); - if (!ct) + if (!ct) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error_free_datastore; + } smlDevInfDataStoreAddRx(datastore, ct); } else if (!strcmp((char *)xmlTextReaderConstName(parser->reader), SML_ELEMENT_TXPREF)) { if (!_smlXmlDevInfDataStoreParseRxTx(parser, SML_ELEMENT_TXPREF, &(datastore->txPrefContentType), &(datastore->txPrefVersion), error)) @@ -3247,12 +3251,16 @@ char *verct = NULL; if (!_smlXmlDevInfDataStoreParseRxTx(parser, SML_ELEMENT_TX, &cttype, &verct, error)) goto error_free_datastore; - SmlDevInfContentType *ct = smlDevInfNewContentType(cttype, verct, error); + GError *gerror = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(cttype, verct, &gerror); smlSafeCFree(&cttype); if (verct) smlSafeCFree(&verct); - if (!ct) + if (!ct) { + smlErrorSet(error, SML_ERROR_GENERIC, "%s", gerror->message); + g_error_free(gerror); goto error_free_datastore; + } smlDevInfDataStoreAddTx(datastore, ct); } else if (!strcmp((char *)xmlTextReaderConstName(parser->reader), SML_ELEMENT_CTCAP)) { if (!_smlXmlDevInfDataStoreParseCTCap(parser, devinf, error)) Modified: trunk/libsyncml/sml_devinf.c ============================================================================== --- trunk/libsyncml/sml_devinf.c Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/libsyncml/sml_devinf.c Mon Jun 15 18:27:55 2009 (r1088) @@ -146,10 +146,11 @@ while (devinf->ctcaps) { SmlDevInfCTCap *ctcap = devinf->ctcaps->data; devinf->ctcaps = g_list_remove(devinf->ctcaps, ctcap); - smlSafeCFree(&(ctcap->ct->cttype)); - if (ctcap->ct->verct) - smlSafeCFree(&(ctcap->ct->verct)); - smlSafeFree((gpointer *)&(ctcap->ct)); + //smlSafeCFree(&(ctcap->ct->cttype)); + //if (ctcap->ct->verct) + // smlSafeCFree(&(ctcap->ct->verct)); + //smlSafeFree((gpointer *)&(ctcap->ct)); + g_object_unref(ctcap->ct); while (ctcap->properties) { SmlDevInfProperty *prop = ctcap->properties->data; ctcap->properties = g_list_remove(ctcap->properties, prop); @@ -397,7 +398,7 @@ GList *d = NULL; for (d = datastore->rx; d; d = d->next) { SmlDevInfContentType *ct = d->data; - smlDevInfFreeContentType(ct); + g_object_unref(ct); } g_list_free(datastore->rx); @@ -405,7 +406,7 @@ smlSafeCFree(&(datastore->txPrefVersion)); for (d = datastore->tx; d; d = d->next) { SmlDevInfContentType *ct = d->data; - smlDevInfFreeContentType(ct); + g_object_unref(ct); } g_list_free(datastore->tx); @@ -471,32 +472,6 @@ return TRUE; } -/* FIXME: DEPRECATED*/ -void smlDevInfDataStoreSetRx(SmlDevInfDataStore *datastore, const char *contenttype, const char *version) -{ - SmlError *error = NULL; - SmlDevInfContentType *ct = smlDevInfNewContentType(contenttype, version, &error); - if (!ct) - { - smlTrace(TRACE_ERROR, "%s - %s", __func__, smlErrorPrint(&error)); - smlErrorDeref(&error); - return; - } - smlDevInfDataStoreAddRx(datastore, ct); -} - -/* FIXME: DEPRECATED*/ -SmlBool smlDevInfDataStoreGetRx(const SmlDevInfDataStore *datastore, char **contenttype, char **version) -{ - const SmlDevInfContentType *ct = smlDevInfDataStoreGetNthRx(datastore, 0); - if (!ct) - return FALSE; - - *contenttype = smlDevInfContentTypeGetCTType(ct); - *version = smlDevInfContentTypeGetVerCT(ct); - return TRUE; -} - void smlDevInfDataStoreAddRx(SmlDevInfDataStore *datastore, SmlDevInfContentType *ct) { smlAssert(datastore); @@ -537,32 +512,6 @@ return TRUE; } -/* FIXME: DEPRECATED*/ -void smlDevInfDataStoreSetTx(SmlDevInfDataStore *datastore, const char *contenttype, const char *version) -{ - SmlError *error = NULL; - SmlDevInfContentType *ct = smlDevInfNewContentType(contenttype, version, &error); - if (!ct) - { - smlTrace(TRACE_ERROR, "%s - %s", __func__, smlErrorPrint(&error)); - smlErrorDeref(&error); - return; - } - smlDevInfDataStoreAddTx(datastore, ct); -} - -/* FIXME: DEPRECATED*/ -SmlBool smlDevInfDataStoreGetTx(const SmlDevInfDataStore *datastore, char **contenttype, char **version) -{ - const SmlDevInfContentType *ct = smlDevInfDataStoreGetNthRx(datastore, 0); - if (!ct) - return FALSE; - - *contenttype = smlDevInfContentTypeGetCTType(ct); - *version = smlDevInfContentTypeGetVerCT(ct); - return TRUE; -} - void smlDevInfDataStoreAddTx(SmlDevInfDataStore *datastore, SmlDevInfContentType *ct) { smlAssert(datastore); @@ -1247,57 +1196,6 @@ /* CTCap stuff */ -SmlDevInfContentType *smlDevInfNewContentType( - const char *cttype, - const char *verct, - SmlError **error) -{ - smlTrace(TRACE_ENTRY, "%s(%p)", __func__, error); - CHECK_ERROR_REF - - SmlDevInfContentType *ct = smlTryMalloc0(sizeof(SmlDevInfContentType), error); - if (!ct) { - smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); - return NULL; - } - - if (cttype != NULL) - ct->cttype = g_strdup(cttype); - else - ct->cttype = NULL; - if (verct != NULL) - ct->verct = g_strdup(verct); - else - ct->verct = NULL; - - smlTrace(TRACE_EXIT, "%s", __func__); - return ct; -} - -char *smlDevInfContentTypeGetCTType(const SmlDevInfContentType *ct) -{ - return g_strdup(ct->cttype); -} - -char *smlDevInfContentTypeGetVerCT(const SmlDevInfContentType *ct) -{ - return g_strdup(ct->verct); -} - -void smlDevInfFreeContentType(SmlDevInfContentType *ct) -{ - smlTrace(TRACE_ENTRY, "%s", __func__); - smlAssert(ct); - - if (ct->cttype != NULL) - smlSafeCFree(&(ct->cttype)); - if (ct->verct != NULL) - smlSafeCFree(&(ct->verct)); - smlSafeFree((gpointer *)&ct); - - smlTrace(TRACE_EXIT, "%s", __func__); -} - SmlDevInfCTCap *smlDevInfNewCTCap(SmlError **error) { smlTrace(TRACE_ENTRY, "%s(%p)", __func__, error); @@ -1309,9 +1207,10 @@ return NULL; } - ctcap->ct = smlDevInfNewContentType(NULL, NULL, error); + GError *gerror = NULL; + ctcap->ct = sml_dev_inf_content_type_new(NULL, NULL, &gerror); if (!ctcap->ct) { - smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); + smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, gerror->message); smlSafeFree((gpointer *)&ctcap); return NULL; } @@ -1329,7 +1228,8 @@ smlAssert(ctcap); smlAssert(cttype); - ctcap->ct->cttype = g_strdup(cttype); + GError *gerror = NULL; + sml_dev_inf_content_type_set_cttype(ctcap->ct, cttype, &gerror); smlTrace(TRACE_EXIT, "%s", __func__); } @@ -1342,7 +1242,8 @@ smlAssert(ctcap); smlAssert(verct); - ctcap->ct->verct = g_strdup(verct); + GError *gerror = NULL; + sml_dev_inf_content_type_set_verct(ctcap->ct, verct, &gerror); smlTrace(TRACE_EXIT, "%s", __func__); } @@ -1353,7 +1254,7 @@ smlAssert(ctcap); char *cttype; - cttype = g_strdup(ctcap->ct->cttype); + cttype = g_strdup(sml_dev_inf_content_type_get_cttype(ctcap->ct)); smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(cttype)); return cttype; @@ -1365,7 +1266,7 @@ smlAssert(ctcap); char *verct; - verct = g_strdup(ctcap->ct->verct); + verct = g_strdup(sml_dev_inf_content_type_get_verct(ctcap->ct)); smlTrace(TRACE_EXIT, "%s - %s", __func__, VA_STRING(verct)); return verct; @@ -1391,33 +1292,6 @@ smlTrace(TRACE_EXIT, "%s", __func__); } -/* FIXME: DEPRECATED*/ -void smlDevInfAddCTCap(SmlDevInf *devinf, SmlDevInfCTCapType type, const char *value) -{ - SmlDevInfCTCap *ctcap = smlDevInfNewCTCap(NULL); - smlDevInfCTCapSetCTType(ctcap, smlDevInfCTCapTypeToString(type, NULL)); - smlDevInfCTCapSetVerCT(ctcap, value); - smlDevInfAppendCTCap(devinf, ctcap); -} - -/* FIXME: DEPRECATED*/ -SmlDevInfCTCapType smlDevInfGetNthCTCapType(SmlDevInf *devinf, unsigned int nth) -{ - const SmlDevInfCTCap *ctcap = smlDevInfGetNthCTCap(devinf, nth); - char *type = smlDevInfCTCapGetCTType(ctcap); - SmlError *error = NULL; - SmlDevInfCTCapType cttype = smlDevInfCTCapTypeFromString(type, &error); - smlSafeCFree(&type); - return cttype; -} - -/* FIXME: DEPRECATED*/ -const char *smlDevInfGetNthCTCapValue(SmlDevInf *devinf, unsigned int nth) -{ - const SmlDevInfCTCap *ctcap = smlDevInfGetNthCTCap(devinf, nth); - return smlDevInfCTCapGetVerCT(ctcap); -} - const SmlDevInfCTCap *smlDevInfGetCTCap( const SmlDevInf *devinf, SmlDevInfContentType *ct) @@ -1425,16 +1299,18 @@ smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, devinf, ct); smlAssert(devinf); smlAssert(ct); - smlAssert(ct->cttype); - smlAssert(ct->verct); + smlAssert(sml_dev_inf_content_type_get_cttype(ct)); + smlAssert(sml_dev_inf_content_type_get_verct(ct)); GList *h; for (h = devinf->ctcaps; h; h = h->next) { SmlDevInfCTCap *ctcap = h->data; // check that CTType matches - if (!strcmp(ct->cttype, ctcap->ct->cttype) && - !strcmp(ct->verct, ctcap->ct->verct)) + if (!strcmp(sml_dev_inf_content_type_get_cttype(ct), + sml_dev_inf_content_type_get_cttype(ctcap->ct)) && + !strcmp(sml_dev_inf_content_type_get_verct(ct), + sml_dev_inf_content_type_get_verct(ctcap->ct))) { smlTrace(TRACE_EXIT, "%s - succeeded", __func__); return ctcap; Modified: trunk/libsyncml/sml_devinf.h ============================================================================== --- trunk/libsyncml/sml_devinf.h Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/libsyncml/sml_devinf.h Mon Jun 15 18:27:55 2009 (r1088) @@ -30,6 +30,8 @@ #ifndef _SML_DEVINF_H_ #define _SML_DEVINF_H_ +#include <libsyncml/dev_inf_api/sml-dev-inf-content-type.h> + SmlDevInfDevTyp smlDevInfDevTypeFromString(const char *name, SmlError **error); const char *smlDevInfDevTypeToString(SmlDevInfDevTyp type, SmlError **error); @@ -179,13 +181,13 @@ /* CTCap stuff */ -SmlDevInfContentType *smlDevInfNewContentType( - const char *cttype, - const char *verct, - SmlError **error); -char *smlDevInfContentTypeGetCTType(const SmlDevInfContentType *ct); -char *smlDevInfContentTypeGetVerCT(const SmlDevInfContentType *ct); -void smlDevInfFreeContentType(SmlDevInfContentType *ct); +//SmlDevInfContentType *smlDevInfNewContentType( +// const char *cttype, +// const char *verct, +// SmlError **error); +//char *smlDevInfContentTypeGetCTType(const SmlDevInfContentType *ct); +//char *smlDevInfContentTypeGetVerCT(const SmlDevInfContentType *ct); +//void smlDevInfFreeContentType(SmlDevInfContentType *ct); SmlDevInfCTCap *smlDevInfNewCTCap(SmlError **error); void smlDevInfCTCapSetCTType( @@ -213,17 +215,6 @@ const SmlDevInfCTCap *ctcap, unsigned int n); -/* expire date: 20090120 */ -void smlDevInfAddCTCap(SmlDevInf *devinf, SmlDevInfCTCapType type, const char *value) LIBSYNCML_DEPRECATED; -SmlDevInfCTCapType smlDevInfGetNthCTCapType(SmlDevInf *devinf, unsigned int nth) LIBSYNCML_DEPRECATED; -const char *smlDevInfGetNthCTCapValue(SmlDevInf *devinf, unsigned int nth) LIBSYNCML_DEPRECATED; - -/* expire date: 20090407 */ -void smlDevInfDataStoreSetRx(SmlDevInfDataStore *datastore, const char *contenttype, const char *version) LIBSYNCML_DEPRECATED; -SmlBool smlDevInfDataStoreGetRx(const SmlDevInfDataStore *datastore, char **contenttype, char **version) LIBSYNCML_DEPRECATED; -void smlDevInfDataStoreSetTx(SmlDevInfDataStore *datastore, const char *contenttype, const char *version) LIBSYNCML_DEPRECATED; -SmlBool smlDevInfDataStoreGetTx(const SmlDevInfDataStore *datastore, char **contenttype, char **version) LIBSYNCML_DEPRECATED; - #endif //_SML_DEVINF_H_ /*@}*/ Modified: trunk/libsyncml/syncml.h ============================================================================== --- trunk/libsyncml/syncml.h Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/libsyncml/syncml.h Mon Jun 15 18:27:55 2009 (r1088) @@ -77,7 +77,7 @@ typedef struct SmlItem SmlItem; typedef struct SmlDevInf SmlDevInf; typedef struct SmlDevInfDataStore SmlDevInfDataStore; -typedef struct SmlDevInfContentType SmlDevInfContentType; +//typedef struct SmlDevInfContentType SmlDevInfContentType; typedef struct SmlDevInfCTCap SmlDevInfCTCap; typedef struct SmlDevInfProperty SmlDevInfProperty; typedef struct SmlDevInfPropParam SmlDevInfPropParam; Modified: trunk/tests/CMakeLists.txt ============================================================================== --- trunk/tests/CMakeLists.txt Thu Jun 4 11:27:14 2009 (r1087) +++ trunk/tests/CMakeLists.txt Mon Jun 15 18:27:55 2009 (r1088) @@ -261,6 +261,13 @@ SML_ADD_TESTCASE( devinf_max_size_element ) SML_END_TEST() + SML_START_TEST( "DevInfContentType" dev_inf_content_type check_dev_inf_content_type.c ${TEST_TARGET_LIBRARIES} ) + SML_ADD_TESTCASE( dev_inf_content_type_create ) + SML_ADD_TESTCASE( dev_inf_content_type_empty_get ) + SML_ADD_TESTCASE( dev_inf_content_type_filled_get ) + SML_ADD_TESTCASE( dev_inf_content_type_references ) + SML_END_TEST() + SML_START_TEST( "Sync" sync check_sync.c ${TEST_TARGET_LIBRARIES} ) IF ( ENABLE_HTTP ) SML_ADD_TESTCASE( sync_multi_start ) Added: trunk/tests/check_dev_inf_content_type.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/tests/check_dev_inf_content_type.c Mon Jun 15 18:27:55 2009 (r1088) @@ -0,0 +1,103 @@ +/* + * 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 "tests/support.h" + +#include <libsyncml/dev_inf_api/sml-dev-inf-content-type.h> + +START_TEST (dev_inf_content_type_create) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + g_object_unref(ct); + + ct = sml_dev_inf_content_type_new("text/plain", NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + g_object_unref(ct); + + return; + + ct = sml_dev_inf_content_type_new(NULL, "2.1", &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + g_object_unref(ct); + + ct = sml_dev_inf_content_type_new("text/x-vCalendar", "1.0", &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + g_object_unref(ct); +} +END_TEST + +START_TEST (dev_inf_content_type_empty_get) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new(NULL, NULL, &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_content_type_get_cttype(ct) == NULL, NULL); + sml_fail_unless(sml_dev_inf_content_type_get_verct(ct) == NULL, NULL); + + g_object_unref(ct); +} +END_TEST + +START_TEST (dev_inf_content_type_filled_get) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new("text/x-vCalendar", "1.0", &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + + sml_fail_unless(sml_dev_inf_content_type_get_cttype(ct) != NULL, NULL); + sml_fail_unless(sml_dev_inf_content_type_get_verct(ct) != NULL, NULL); + + g_object_unref(ct); +} +END_TEST + +START_TEST (dev_inf_content_type_references) +{ + g_type_init(); + + GError *error = NULL; + SmlDevInfContentType *ct = sml_dev_inf_content_type_new("text/x-vCalendar", "1.0", &error); + sml_fail_unless(ct != NULL, "%s", error?error->message:"No GError set."); + + g_object_ref(ct); + + sml_fail_unless(sml_dev_inf_content_type_get_cttype(ct) != NULL, NULL); + sml_fail_unless(sml_dev_inf_content_type_get_verct(ct) != NULL, NULL); + + g_object_unref(ct); + + sml_fail_unless(sml_dev_inf_content_type_get_cttype(ct) != NULL, NULL); + sml_fail_unless(sml_dev_inf_content_type_get_verct(ct) != NULL, NULL); + + g_object_unref(ct); +} +END_TEST + +@SML_TESTCASE_CODE@ + |
From: <svn...@op...> - 2009-06-11 08:12:14
|
Author: bellmich Date: Thu Jun 11 10:12:09 2009 New Revision: 223 URL: http://libwbxml.opensync.org/changeset/223 Log: reverted the changed element names (please see ticket #35) Modified: wbxml2/trunk/src/wbxml_tables.c Modified: wbxml2/trunk/src/wbxml_tables.c ============================================================================== --- wbxml2/trunk/src/wbxml_tables.c Tue Jun 9 11:29:55 2009 (r222) +++ wbxml2/trunk/src/wbxml_tables.c Thu Jun 11 10:12:09 2009 (r223) @@ -3169,7 +3169,7 @@ { "Unknown_0x0d", 0x00, 0x0d }, { "Unknown_0x0e", 0x00, 0x0e }, { "Unknown_0x0f", 0x00, 0x0f }, - { "DevInf", 0x00, 0x10 }, + { "DeviceInfo", 0x00, 0x10 }, /* Candidates from SyncML: DevTyp */ @@ -3194,7 +3194,7 @@ MaxMsgSize */ { "Unknown_0x20", 0x00, 0x20 }, - { "MaxObjSize", 0x00, 0x21 }, + { "MaxObjectSize", 0x00, 0x21 }, { "Modified", 0x00, 0x22 }, { "MoreData", 0x00, 0x23 }, /* The content of the element Name is originally encoded as opaque data. |
From: <svn...@op...> - 2009-06-09 09:30:00
|
Author: bellmich Date: Tue Jun 9 11:29:55 2009 New Revision: 222 URL: http://libwbxml.opensync.org/changeset/222 Log: - added comments about - the background of Nokia ConML - the content encoding (string instead of opaque data for Name) - added unknown_0x?? for unknown tags incl. ideas what it could be - changed the name of two elements into SyncML style Modified: wbxml2/trunk/src/wbxml_tables.c Modified: wbxml2/trunk/src/wbxml_tables.c ============================================================================== --- wbxml2/trunk/src/wbxml_tables.c Tue Jun 9 11:11:50 2009 (r221) +++ wbxml2/trunk/src/wbxml_tables.c Tue Jun 9 11:29:55 2009 (r222) @@ -3143,7 +3143,10 @@ #if defined( WBXML_SUPPORT_CONML ) /************************************************* - * ConML + * Nokia ConML + * + * This is no official markup language from Nokia. + * It is used for example by Nokia PC Suite to install software. */ const WBXMLTagEntry sv_conml_tag_table[] = { @@ -3151,13 +3154,34 @@ { "All", 0x00, 0x05 }, { "Application", 0x00, 0x06 }, { "Applications", 0x00, 0x07 }, + { "Unknown_0x08", 0x00, 0x08 }, { "Cancel", 0x00, 0x09 }, { "Complete", 0x00, 0x0a }, { "ConML", 0x00, 0x0b }, { "Data", 0x00, 0x0c }, - { "DeviceInfo", 0x00, 0x10 }, + /* Candidates from SyncML: + DataType * + DefaultValue + Delete + Description * + DevID * + */ + { "Unknown_0x0d", 0x00, 0x0d }, + { "Unknown_0x0e", 0x00, 0x0e }, + { "Unknown_0x0f", 0x00, 0x0f }, + { "DevInf", 0x00, 0x10 }, + /* Candidates from SyncML: + DevTyp + */ + { "Unknown_0x11", 0x00, 0x11 }, { "Drives", 0x00, 0x12 }, { "Execute", 0x00, 0x13 }, + /* Candidates from SyncML: + Final + */ + { "Unknown_0x14", 0x00, 0x14 }, + { "Unknown_0x15", 0x00, 0x15 }, + { "Unknown_0x16", 0x00, 0x16 }, { "GetDataSize", 0x00, 0x17 }, { "GetStatus", 0x00, 0x18 }, { "HasFiles", 0x00, 0x19 }, @@ -3166,21 +3190,67 @@ { "Install", 0x00, 0x1c }, { "InstParams", 0x00, 0x1d }, { "ListInstalledApps", 0x00, 0x1f }, - { "MaxObjectSize", 0x00, 0x21 }, + /* Candidates from SyncML: + MaxMsgSize + */ + { "Unknown_0x20", 0x00, 0x20 }, + { "MaxObjSize", 0x00, 0x21 }, { "Modified", 0x00, 0x22 }, { "MoreData", 0x00, 0x23 }, + /* The content of the element Name is originally encoded as opaque data. + The mobiles accepts the element data also as a normal string. + Therefore the data will be encoded as a string. + If there is a requirement for the original behavior + then it is necessary to add some code to wbxml_encoder.c. + */ { "Name", 0x00, 0x24 }, { "PackageInfo", 0x00, 0x25 }, { "Param", 0x00, 0x26 }, { "PartialType", 0x00, 0x27 }, { "Progress", 0x00, 0x28 }, { "Reboot", 0x00, 0x29 }, + /* Candidates from SyncML: + Replace + RespURI + */ + { "Unknown_0x2a", 0x00, 0x2a }, + { "Unknown_0x2b", 0x00, 0x2b }, { "Results", 0x00, 0x2c }, + /* Candidates from SyncML: + Search + Sequence + SessionID + SftDel + Source + SourceRef + */ + { "Unknown_0x2d", 0x00, 0x2d }, + { "Unknown_0x2e", 0x00, 0x2e }, + { "Unknown_0x2f", 0x00, 0x2f }, + { "Unknown_0x30", 0x00, 0x30 }, { "Status", 0x00, 0x31 }, + /* Candidates from SyncML: + Target + TargetRef + */ + { "Unknown_0x32", 0x00, 0x32 }, + { "Unknown_0x33", 0x00, 0x33 }, + { "Unknown_0x34", 0x00, 0x34 }, { "Task", 0x00, 0x35 }, + /* Candidates from SyncML: + Time + TStamp + Title + */ + { "Unknown_0x36", 0x00, 0x36 }, { "Type", 0x00, 0x37 }, { "UID", 0x00, 0x38 }, { "UnInstall", 0x00, 0x39 }, + /* Candidates from SyncML: + ValEnum + */ + { "Unknown_0x3a", 0x00, 0x3a }, + { "Unknown_0x3b", 0x00, 0x3b }, { "Value", 0x00, 0x3c }, { "Version", 0x00, 0x3d }, { NULL, 0x00, 0x00 } |
From: <svn...@op...> - 2009-06-09 09:11:56
|
Author: bellmich Date: Tue Jun 9 11:11:50 2009 New Revision: 221 URL: http://libwbxml.opensync.org/changeset/221 Log: added tests for Nokia ConML support Modified: wbxml2/trunk/CMakeLists.txt Modified: wbxml2/trunk/CMakeLists.txt ============================================================================== --- wbxml2/trunk/CMakeLists.txt Tue Jun 9 11:11:41 2009 (r220) +++ wbxml2/trunk/CMakeLists.txt Tue Jun 9 11:11:50 2009 (r221) @@ -265,8 +265,9 @@ SET( sl_tests 13 ) SET( syncml_tests 14 ) SET( wv_tests 116 ) -FOREACH( TESTDIR airsync ddf emn ota prov si sl syncml wv ) +SET( conml_tests 2 ) +FOREACH( TESTDIR airsync conml ddf emn ota prov si sl syncml wv ) FOREACH( ITEM RANGE 1 ${${TESTDIR}_tests} ) ADD_TEST( "${TESTDIR}_${ITEM}" launchTests.sh "${CMAKE_SOURCE_DIR}/tests" "${TESTDIR}" ${ITEM} ) ENDFOREACH( ITEM RANGE 1 ${${TESTDIR}_tests} ) -ENDFOREACH( TESTDIR airsync ddf emn ota prov si sl syncml wv ) +ENDFOREACH( TESTDIR airsync conml ddf emn ota prov si sl syncml wv ) |
From: <svn...@op...> - 2009-06-09 09:11:46
|
Author: bellmich Date: Tue Jun 9 11:11:41 2009 New Revision: 220 URL: http://libwbxml.opensync.org/changeset/220 Log: added tests for Nokia ConML support Added: wbxmlTestSuite/trunk/conml/ wbxmlTestSuite/trunk/conml/conml-001.xml wbxmlTestSuite/trunk/conml/conml-002.xml Added: wbxmlTestSuite/trunk/conml/conml-001.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/conml/conml-001.xml Tue Jun 9 11:11:41 2009 (r220) @@ -0,0 +1,16 @@ +<?xml version="1.0" ?> +<!DOCTYPE ConML PUBLIC "-//CONML//DTD ConML//EN" "http://www.nokia.com/"> +<!-- This script was manually generated + after the reading of install_sis.py from ticket #35. + --> +<ConML> + <Execute> + <Install> + <Name> + C:\Temp\MyApp + </Name> + <InstParams/> + </Install> + </Execute> +</ConML> + Added: wbxmlTestSuite/trunk/conml/conml-002.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ wbxmlTestSuite/trunk/conml/conml-002.xml Tue Jun 9 11:11:41 2009 (r220) @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<!DOCTYPE ConML PUBLIC "-//CONML//DTD ConML//EN" "http://www.nokia.com/"> +<!-- This document was created from a sniffed WBXML document. --> +<ConML> + <Execute> + <Install> + <Name>C:\Data\Installs\helloworldbasic.sis</Name> + <InstParams/> + </Install> + </Execute> +</ConML> |
From: <svn...@op...> - 2009-06-09 09:10:24
|
Author: bellmich Date: Tue Jun 9 11:10:20 2009 New Revision: 219 URL: http://libwbxml.opensync.org/changeset/219 Log: added missing Nokia ConML support to wbxml2xml Modified: wbxml2/trunk/tools/wbxml2xml_tool.c Modified: wbxml2/trunk/tools/wbxml2xml_tool.c ============================================================================== --- wbxml2/trunk/tools/wbxml2xml_tool.c Tue Jun 9 10:40:48 2009 (r218) +++ wbxml2/trunk/tools/wbxml2xml_tool.c Tue Jun 9 11:10:20 2009 (r219) @@ -143,6 +143,11 @@ return WBXML_LANG_AIRSYNC; #endif /* WBXML_SUPPORT_AIRSYNC */ +#if defined( WBXML_SUPPORT_CONML ) + if (WBXML_STRCMP(lang, "CONML") == 0) + return WBXML_LANG_CONML; +#endif /* WBXML_SUPPORT_CONML */ + return WBXML_LANG_UNKNOWN; } @@ -218,6 +223,9 @@ #if defined( WBXML_SUPPORT_AIRSYNC ) fprintf(stderr, " AIRSYNC : Microsoft AirSync\n"); #endif /* WBXML_SUPPORT_AIRSYNC */ +#if defined( WBXML_SUPPORT_CONML ) + fprintf(stderr, " CONML : Nokia ConML\n"); +#endif /* WBXML_SUPPORT_CONML */ fprintf(stderr, "\nNote: '-' can be used to mean stdin on input or stdout on output\n\n"); } |