urihandler: fix return type of get_protocols()
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 13 Nov 2011 23:07:58 +0000 (23:07 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 13 Nov 2011 23:07:58 +0000 (23:07 +0000)
gst/gstelementfactory.c
gst/gstelementfactory.h
gst/gsturi.c
gst/gsturi.h

index 18431d0..cc0713d 100644 (file)
@@ -273,8 +273,12 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
       factory->uri_type = iface->get_type (factory->type);
     if (!GST_URI_TYPE_IS_VALID (factory->uri_type))
       goto urierror;
-    if (iface->get_protocols)
-      factory->uri_protocols = iface->get_protocols (factory->type);
+    if (iface->get_protocols) {
+      const gchar *const *protocols;
+
+      protocols = iface->get_protocols (factory->type);
+      factory->uri_protocols = g_strdupv ((gchar **) protocols);
+    }
     if (!factory->uri_protocols)
       goto urierror;
   }
@@ -577,12 +581,12 @@ gst_element_factory_get_uri_type (GstElementFactory * factory)
  * Returns: (transfer none) (array zero-terminated=1): the supported protocols
  *     or NULL
  */
-gchar **
+const gchar *const *
 gst_element_factory_get_uri_protocols (GstElementFactory * factory)
 {
   g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL);
 
-  return factory->uri_protocols;
+  return (const gchar * const *) factory->uri_protocols;
 }
 
 /**
index a7ecec5..62a80ac 100644 (file)
@@ -90,7 +90,7 @@ guint                   gst_element_factory_get_num_pad_templates (GstElementFac
 const GList *           gst_element_factory_get_static_pad_templates (GstElementFactory *factory);
 
 GstURIType              gst_element_factory_get_uri_type        (GstElementFactory *factory);
-gchar **                gst_element_factory_get_uri_protocols   (GstElementFactory *factory);
+const gchar * const *   gst_element_factory_get_uri_protocols   (GstElementFactory *factory);
 
 gboolean                gst_element_factory_has_interface       (GstElementFactory *factory,
                                                                  const gchar *interfacename);
index 359fba8..6d49a39 100644 (file)
@@ -478,7 +478,7 @@ SearchEntry;
 static gboolean
 search_by_entry (GstPluginFeature * feature, gpointer search_entry)
 {
-  gchar **protocols;
+  const gchar *const *protocols;
   GstElementFactory *factory;
   SearchEntry *entry = (SearchEntry *) search_entry;
 
@@ -649,11 +649,11 @@ gst_uri_handler_get_uri_type (GstURIHandler * handler)
  *     supported protocols. Returns NULL if the @handler isn't implemented
  *     properly, or the @handler doesn't support any protocols.
  */
-gchar **
+const gchar *const *
 gst_uri_handler_get_protocols (GstURIHandler * handler)
 {
   GstURIHandlerInterface *iface;
-  gchar **ret;
+  const gchar *const *ret;
 
   g_return_val_if_fail (GST_IS_URI_HANDLER (handler), NULL);
 
@@ -673,9 +673,9 @@ gst_uri_handler_get_protocols (GstURIHandler * handler)
  *
  * Gets the currently handled URI.
  *
- * Returns: (transfer none): the URI currently handled by the @handler.
+ * Returns: (transfer full): the URI currently handled by the @handler.
  *   Returns NULL if there are no URI currently handled. The
- *   returned string must not be modified or freed.
+ *   returned string must be freed with g_free() when no longer needed.
  */
 gchar *
 gst_uri_handler_get_uri (GstURIHandler * handler)
@@ -725,7 +725,8 @@ gst_uri_handler_set_uri (GstURIHandler * handler, const gchar * uri,
   protocol = gst_uri_get_protocol (uri);
 
   if (iface->get_protocols) {
-    gchar **p, **protocols;
+    const gchar *const *protocols;
+    const gchar *const *p;
     gboolean found_protocol = FALSE;
 
     protocols = iface->get_protocols (G_OBJECT_TYPE (handler));
index 7435fc7..ad9005c 100644 (file)
@@ -111,7 +111,7 @@ struct _GstURIHandlerInterface {
   /*< public >*/
   /* querying capabilities */
   GstURIType           (* get_type)            (GType type);
-  gchar **             (* get_protocols)       (GType type);
+  const gchar * const *        (* get_protocols)       (GType type);
 
   /* using the interface */
   gchar *              (* get_uri)             (GstURIHandler * handler);
@@ -144,7 +144,7 @@ GstElement *        gst_element_make_from_uri       (const GstURIType type,
 GType          gst_uri_handler_get_type        (void);
 
 GstURIType     gst_uri_handler_get_uri_type    (GstURIHandler * handler);
-gchar **       gst_uri_handler_get_protocols   (GstURIHandler * handler);
+const gchar * const * gst_uri_handler_get_protocols    (GstURIHandler * handler);
 gchar *                gst_uri_handler_get_uri         (GstURIHandler * handler);
 gboolean       gst_uri_handler_set_uri         (GstURIHandler * handler,
                                                 const gchar   * uri,