X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgdbusintrospection.c;h=0c501c41ce9e432de78adaa049056aeac2d605a6;hb=958da1e9dc82fbb91862501226b8928faf2f9558;hp=ca7490aae92c2500bb0ceda33e5f8962803377ef;hpb=86329ba44fc7662c0bad37955f0ec980a24be495;p=platform%2Fupstream%2Fglib.git diff --git a/gio/gdbusintrospection.c b/gio/gdbusintrospection.c index ca7490a..0c501c4 100644 --- a/gio/gdbusintrospection.c +++ b/gio/gdbusintrospection.c @@ -13,9 +13,7 @@ * 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. + * Public License along with this library; if not, see . * * Author: David Zeuthen */ @@ -40,7 +38,7 @@ * used when registering objects with g_dbus_connection_register_object(). * * The format of D-Bus introspection XML is specified in the - * D-Bus specification. + * [D-Bus specification](http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format) */ /* ---------------------------------------------------------------------------------------------------- */ @@ -583,12 +581,15 @@ g_dbus_annotation_info_generate_xml (GDBusAnnotationInfo *info, guint indent, GString *string_builder) { + gchar *tmp; guint n; - g_string_append_printf (string_builder, "%*skey, - info->value); + tmp = g_markup_printf_escaped ("%*skey, + info->value); + g_string_append (string_builder, tmp); + g_free (tmp); if (info->annotations == NULL) { @@ -779,7 +780,7 @@ g_dbus_property_info_generate_xml (GDBusPropertyInfo *info, * * This function is typically used for generating introspection XML * documents at run-time for handling the - * org.freedesktop.DBus.Introspectable.Introspect + * `org.freedesktop.DBus.Introspectable.Introspect` * method. * * Since: 2.26 @@ -827,7 +828,7 @@ g_dbus_interface_info_generate_xml (GDBusInterfaceInfo *info, * Appends an XML representation of @info (and its children) to @string_builder. * * This function is typically used for generating introspection XML documents at run-time for - * handling the org.freedesktop.DBus.Introspectable.Introspect method. + * handling the `org.freedesktop.DBus.Introspectable.Introspect` method. * * Since: 2.26 */ @@ -1276,12 +1277,14 @@ parser_start_element (GMarkupParseContext *context, goto out; } - if (!g_markup_collect_known_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "name", &name, - G_MARKUP_COLLECT_INVALID)) + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "name", &name, + /* some hand-written introspection XML documents use this */ + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "xmlns:doc", NULL, + G_MARKUP_COLLECT_INVALID)) goto out; g_dbus_node_info_set (data, @@ -1313,12 +1316,14 @@ parser_start_element (GMarkupParseContext *context, goto out; } - if (!g_markup_collect_known_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING, "name", &name, - G_MARKUP_COLLECT_INVALID)) + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING, "name", &name, + /* seen in the wild */ + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "version", NULL, + G_MARKUP_COLLECT_INVALID)) goto out; g_dbus_interface_info_set (data, @@ -1342,12 +1347,14 @@ parser_start_element (GMarkupParseContext *context, goto out; } - if (!g_markup_collect_known_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING, "name", &name, - G_MARKUP_COLLECT_INVALID)) + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING, "name", &name, + /* seen in the wild */ + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "version", NULL, + G_MARKUP_COLLECT_INVALID)) goto out; g_dbus_method_info_set (data, @@ -1372,12 +1379,12 @@ parser_start_element (GMarkupParseContext *context, goto out; } - if (!g_markup_collect_known_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING, "name", &name, - G_MARKUP_COLLECT_INVALID)) + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING, "name", &name, + G_MARKUP_COLLECT_INVALID)) goto out; g_dbus_signal_info_set (data, @@ -1403,14 +1410,14 @@ parser_start_element (GMarkupParseContext *context, goto out; } - if (!g_markup_collect_known_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING, "name", &name, - G_MARKUP_COLLECT_STRING, "type", &type, - G_MARKUP_COLLECT_STRING, "access", &access, - G_MARKUP_COLLECT_INVALID)) + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING, "name", &name, + G_MARKUP_COLLECT_STRING, "type", &type, + G_MARKUP_COLLECT_STRING, "access", &access, + G_MARKUP_COLLECT_INVALID)) goto out; if (strcmp (access, "read") == 0) @@ -1454,14 +1461,14 @@ parser_start_element (GMarkupParseContext *context, goto out; } - if (!g_markup_collect_known_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "name", &name, - G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "direction", &direction, - G_MARKUP_COLLECT_STRING, "type", &type, - G_MARKUP_COLLECT_INVALID)) + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "name", &name, + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "direction", &direction, + G_MARKUP_COLLECT_STRING, "type", &type, + G_MARKUP_COLLECT_INVALID)) goto out; if (strcmp (stack->next->data, "method") == 0) @@ -1541,13 +1548,13 @@ parser_start_element (GMarkupParseContext *context, goto out; } - if (!g_markup_collect_known_attributes (element_name, - attribute_names, - attribute_values, - error, - G_MARKUP_COLLECT_STRING, "name", &name, - G_MARKUP_COLLECT_STRING, "value", &value, - G_MARKUP_COLLECT_INVALID)) + if (!g_markup_collect_attributes (element_name, + attribute_names, + attribute_values, + error, + G_MARKUP_COLLECT_STRING, "name", &name, + G_MARKUP_COLLECT_STRING, "value", &value, + G_MARKUP_COLLECT_INVALID)) goto out; g_dbus_annotation_info_set (data, @@ -1750,10 +1757,10 @@ parser_error (GMarkupParseContext *context, * Parses @xml_data and returns a #GDBusNodeInfo representing the data. * * The introspection XML must contain exactly one top-level - * node element. + * element. * * Note that this routine is using a - * GMarkup-based + * [GMarkup][glib-Simple-XML-Subset-Parser.description]-based * parser that only accepts a subset of valid XML documents. * * Returns: A #GDBusNodeInfo structure or %NULL if @error is set. Free @@ -1783,7 +1790,7 @@ g_dbus_node_info_new_for_xml (const gchar *xml_data, data = parse_data_new (); context = g_markup_parse_context_new (parser, - 0, + G_MARKUP_IGNORE_QUALIFIED, data, (GDestroyNotify) parse_data_free); @@ -1837,7 +1844,7 @@ g_dbus_node_info_new_for_xml (const gchar *xml_data, * * Looks up the value of an annotation. * - * This cost of this function is O(n) in number of annotations. + * The cost of this function is O(n) in number of annotations. * * Returns: The value or %NULL if not found. Do not free, it is owned by @annotations. * @@ -1904,7 +1911,7 @@ static GHashTable *info_cache = NULL; * * Looks up information about a method. * - * This cost of this function is O(n) in number of methods unless + * The cost of this function is O(n) in number of methods unless * g_dbus_interface_info_cache_build() has been used on @info. * * Returns: (transfer none): A #GDBusMethodInfo or %NULL if not found. Do not free, it is owned by @info. @@ -1958,7 +1965,7 @@ g_dbus_interface_info_lookup_method (GDBusInterfaceInfo *info, * * Looks up information about a signal. * - * This cost of this function is O(n) in number of signals unless + * The cost of this function is O(n) in number of signals unless * g_dbus_interface_info_cache_build() has been used on @info. * * Returns: (transfer none): A #GDBusSignalInfo or %NULL if not found. Do not free, it is owned by @info. @@ -2012,7 +2019,7 @@ g_dbus_interface_info_lookup_signal (GDBusInterfaceInfo *info, * * Looks up information about a property. * - * This cost of this function is O(n) in number of properties unless + * The cost of this function is O(n) in number of properties unless * g_dbus_interface_info_cache_build() has been used on @info. * * Returns: (transfer none): A #GDBusPropertyInfo or %NULL if not found. Do not free, it is owned by @info. @@ -2155,7 +2162,7 @@ g_dbus_interface_info_cache_release (GDBusInterfaceInfo *info) * * Looks up information about an interface. * - * This cost of this function is O(n) in number of interfaces. + * The cost of this function is O(n) in number of interfaces. * * Returns: (transfer none): A #GDBusInterfaceInfo or %NULL if not found. Do not free, it is owned by @info. *