X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fgsturi.c;h=a5b7190e7e9984dd27e698fe94b11558df9a2ad1;hb=dc5a62f70234f729c0f3443ab725e9f0232cc1fe;hp=3312e33fd0e9ecc68fbc5d6bff00b2966fd3b667;hpb=a87b4551a6090663a1714f263d4e20fe75eb46ca;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gsturi.c b/gst/gsturi.c index 3312e33..a5b7190 100644 --- a/gst/gsturi.c +++ b/gst/gsturi.c @@ -155,6 +155,9 @@ gst_uri_error_quark (void) return g_quark_from_static_string ("gst-uri-error-quark"); } +#define HEX_ESCAPE '%' + +#ifndef GST_REMOVE_DEPRECATED static const guchar acceptable[96] = { /* X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ 0x00, 0x3F, 0x20, 0x20, 0x20, 0x00, 0x2C, 0x3F, 0x3F, 0x3F, 0x3F, 0x22, 0x20, 0x3F, 0x3F, 0x1C, /* 2X !"#$%&'()*+,-./ */ 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x38, 0x20, 0x20, 0x2C, 0x20, 0x2C, /* 3X 0123456789:;<=>? */ @@ -174,8 +177,6 @@ typedef enum UNSAFE_SLASHES = 0x20 /* Allows all characters except for '/' and '%' */ } UnsafeCharacterSet; -#define HEX_ESCAPE '%' - /* Escape undesirable characters using % * ------------------------------------- * @@ -248,21 +249,7 @@ escape_string_internal (const gchar * string, UnsafeCharacterSet mask) return result; } - -/* escape_string: - * @string: string to be escaped - * - * Escapes @string, replacing any and all special characters - * with equivalent escape sequences. - * - * Return value: a newly allocated string equivalent to @string - * but with all special characters escaped - **/ -static gchar * -escape_string (const gchar * string) -{ - return escape_string_internal (string, UNSAFE_ALL); -} +#endif static int hex_to_int (gchar c) @@ -410,7 +397,7 @@ gst_uri_is_valid (const gchar * uri) * Extracts the protocol out of a given valid URI. The returned string must be * freed using g_free(). * - * Returns: The protocol for this URI. + * Returns: (nullable): The protocol for this URI. */ gchar * gst_uri_get_protocol (const gchar * uri) @@ -462,9 +449,9 @@ gst_uri_has_protocol (const gchar * uri, const gchar * protocol) * * Free-function: g_free * - * Returns: (transfer full): the location for this URI. Returns %NULL if the - * URI isn't valid. If the URI does not contain a location, an empty - * string is returned. + * Returns: (transfer full) (nullable): the location for this URI. Returns + * %NULL if the URI isn't valid. If the URI does not contain a location, an + * empty string is returned. */ gchar * gst_uri_get_location (const gchar * uri) @@ -511,7 +498,10 @@ gst_uri_get_location (const gchar * uri) * * Returns: (transfer full): a new string for this URI. Returns %NULL if the * given URI protocol is not valid, or the given location is %NULL. + * + * Deprecated: Use GstURI instead. */ +#ifndef GST_REMOVE_DEPRECATED gchar * gst_uri_construct (const gchar * protocol, const gchar * location) { @@ -522,13 +512,14 @@ gst_uri_construct (const gchar * protocol, const gchar * location) g_return_val_if_fail (location != NULL, NULL); proto_lowercase = g_ascii_strdown (protocol, -1); - escaped = escape_string (location); + escaped = escape_string_internal (location, UNSAFE_PATH); retval = g_strdup_printf ("%s://%s", proto_lowercase, escaped); g_free (escaped); g_free (proto_lowercase); return retval; } +#endif typedef struct { @@ -627,7 +618,8 @@ gst_uri_protocol_is_supported (const GstURIType type, const gchar * protocol) * * Creates an element for handling the given URI. * - * Returns: (transfer floating): a new element or %NULL if none could be created + * Returns: (transfer floating) (nullable): a new element or %NULL if none + * could be created */ GstElement * gst_element_make_from_uri (const GstURIType type, const gchar * uri, @@ -900,7 +892,7 @@ file_path_contains_relatives (const gchar * path) /** * gst_filename_to_uri: - * @filename: absolute or relative file name path + * @filename: (type filename): absolute or relative file name path * @error: pointer to error, or %NULL * * Similar to g_filename_to_uri(), but attempts to handle relative file paths @@ -965,7 +957,7 @@ beach: * @short_description: URI parsing and manipulation. * * A #GstUri object can be used to parse and split a URI string into its - * constituant parts. Two #GstUri objects can be joined to make a new #GstUri + * constituent parts. Two #GstUri objects can be joined to make a new #GstUri * using the algorithm described in RFC3986. */ @@ -1022,6 +1014,10 @@ _gst_uri_free (GstUri * uri) g_hash_table_unref (uri->query); g_free (uri->fragment); +#ifdef USE_POISONING + memset (uri, 0xff, sizeof (*uri)); +#endif + g_slice_free1 (sizeof (*uri), uri); } @@ -1508,7 +1504,7 @@ gst_uri_new_with_base (GstUri * base, const gchar * scheme, * Parses a URI string into a new #GstUri object. Will return NULL if the URI * cannot be parsed. * - * Returns: (transfer full)(nullable): A new #GstUri object, or NULL. + * Returns: (transfer full) (nullable): A new #GstUri object, or NULL. * * Since: 1.6 */ @@ -1770,16 +1766,16 @@ gst_uri_equal (const GstUri * first, const GstUri * second) /** * gst_uri_join: - * @base_uri: (transfer none)(nullable): The base URI to join another to. - * @ref_uri: (transfer none)(nullable): The reference URI to join onto the - * base URI. + * @base_uri: (transfer none) (nullable): The base URI to join another to. + * @ref_uri: (transfer none) (nullable): The reference URI to join onto the + * base URI. * * Join a reference URI onto a base URI using the method from RFC 3986. * If either URI is %NULL then the other URI will be returned with the ref count * increased. * - * Returns: (transfer full): A #GstUri which represents the base with the - * reference URI joined on. + * Returns: (transfer full) (nullable): A #GstUri which represents the base + * with the reference URI joined on. * * Since: 1.6 */ @@ -2087,7 +2083,7 @@ gst_uri_normalize (GstUri * uri) * Get the scheme name from the URI or %NULL if it doesn't exist. * If @uri is %NULL then returns %NULL. * - * Returns: The scheme from the #GstUri object or %NULL. + * Returns: (nullable): The scheme from the #GstUri object or %NULL. */ const gchar * gst_uri_get_scheme (const GstUri * uri) @@ -2127,7 +2123,7 @@ gst_uri_set_scheme (GstUri * uri, const gchar * scheme) * Get the userinfo (usually in the form "username:password") from the URI * or %NULL if it doesn't exist. If @uri is %NULL then returns %NULL. * - * Returns: The userinfo from the #GstUri object or %NULL. + * Returns: (nullable): The userinfo from the #GstUri object or %NULL. * * Since: 1.6 */ @@ -2169,7 +2165,7 @@ gst_uri_set_userinfo (GstUri * uri, const gchar * userinfo) * Get the host name from the URI or %NULL if it doesn't exist. * If @uri is %NULL then returns %NULL. * - * Returns: The host name from the #GstUri object or %NULL. + * Returns: (nullable): The host name from the #GstUri object or %NULL. * * Since: 1.6 */ @@ -2251,8 +2247,8 @@ gst_uri_set_port (GstUri * uri, guint port) * * Extract the path string from the URI object. * - * Returns: (transfer full): The path from the URI. Once finished with the - * string should be g_free()'d. + * Returns: (transfer full) (nullable): The path from the URI. Once finished + * with the string should be g_free()'d. * * Since: 1.6 */ @@ -2285,7 +2281,7 @@ gst_uri_get_path (const GstUri * uri) /** * gst_uri_set_path: - * @uri: (transfer none)(nullable): The #GstUri to modify. + * @uri: (transfer none) (nullable): The #GstUri to modify. * @path: The new path to set with path segments separated by '/', or use %NULL * to unset the path. * @@ -2314,8 +2310,8 @@ gst_uri_set_path (GstUri * uri, const gchar * path) * * Extract the path string from the URI object as a percent encoded URI path. * - * Returns: (transfer full): The path from the URI. Once finished with the - * string should be g_free()'d. + * Returns: (transfer full) (nullable): The path from the URI. Once finished + * with the string should be g_free()'d. * * Since: 1.6 */ @@ -2379,7 +2375,7 @@ gst_uri_set_path_string (GstUri * uri, const gchar * path) * * Get a list of path segments from the URI. * - * Returns: (transfer full)(element-type gchar*): A #GList of path segment + * Returns: (transfer full) (element-type gchar*): A #GList of path segment * strings or %NULL if no path segments are available. Free the list * when no longer needed with g_list_free_full(list, g_free). * @@ -2501,8 +2497,8 @@ gst_uri_append_path_segment (GstUri * uri, const gchar * path_segment) * * Get a percent encoded URI query string from the @uri. * - * Returns: (transfer full): A percent encoded query string. Use g_free() when - * no longer needed. + * Returns: (transfer full) (nullable): A percent encoded query string. Use + * g_free() when no longer needed. * * Since: 1.6 */ @@ -2577,8 +2573,8 @@ gst_uri_set_query_string (GstUri * uri, const gchar * query) * no longer required. Modifying this hash table will modify the query in the * URI. * - * Returns: (transfer full)(element-type gchar* gchar*): The query hash table - * from the URI. + * Returns: (transfer full) (element-type gchar* gchar*) (nullable): The query + * hash table from the URI. * * Since: 1.6 */ @@ -2604,7 +2600,7 @@ gst_uri_get_query_table (const GstUri * uri) * reference to the new one is used instead. A value if %NULL for @query_table * will remove the query string from the URI. * - * Returns: %TRUE if the new table was sucessfully used for the query table. + * Returns: %TRUE if the new table was successfully used for the query table. * * Since: 1.6 */ @@ -2638,7 +2634,7 @@ gst_uri_set_query_table (GstUri * uri, GHashTable * query_table) * indicates that the key has no associated value, but will still be present in * the query string. * - * Returns: %TRUE if the query table was sucessfully updated. + * Returns: %TRUE if the query table was successfully updated. * * Since: 1.6 */ @@ -2725,7 +2721,7 @@ gst_uri_query_has_key (const GstUri * uri, const gchar * query_key) * use gst_uri_query_has_key() to determine if a key is present in the URI * query. * - * Returns: The value for the given key, or %NULL if not found. + * Returns: (nullable): The value for the given key, or %NULL if not found. * * Since: 1.6 */ @@ -2747,7 +2743,7 @@ gst_uri_get_query_value (const GstUri * uri, const gchar * query_key) * * Get a list of the query keys from the URI. * - * Returns: (transfer container)(element-type gchar*): A list of keys from + * Returns: (transfer container) (element-type gchar*): A list of keys from * the URI query. Free the list with g_list_free(). * * Since: 1.6 @@ -2771,7 +2767,7 @@ gst_uri_get_query_keys (const GstUri * uri) * Get the fragment name from the URI or %NULL if it doesn't exist. * If @uri is %NULL then returns %NULL. * - * Returns: The host name from the #GstUri object or %NULL. + * Returns: (nullable): The host name from the #GstUri object or %NULL. * * Since: 1.6 */ @@ -2813,7 +2809,7 @@ gst_uri_set_fragment (GstUri * uri, const gchar * fragment) * Get the media fragment table from the URI, as defined by "Media Fragments URI 1.0". * Hash table returned by this API is a list of "key-value" pairs, and the each * pair is generated by splitting "URI fragment" per "&" sub-delims, then "key" - * and "value" are splitted by "=" sub-delims. The "key" returned by this API may + * and "value" are split by "=" sub-delims. The "key" returned by this API may * be undefined keyword by standard. * A value may be %NULL to indicate that the key should appear in the fragment * string in the URI, but does not have a value. Free the returned #GHashTable @@ -2822,8 +2818,8 @@ gst_uri_set_fragment (GstUri * uri, const gchar * fragment) * * See more about Media Fragments URI 1.0 (W3C) at https://www.w3.org/TR/media-frags/ * - * Returns: (transfer full)(element-type gchar* gchar*): The fragment hash table - * from the URI. + * Returns: (transfer full) (element-type gchar* gchar*) (nullable): The + * fragment hash table from the URI. * * Since: 1.12 */