Fixes for -Wwrite-strings

This changes some APIs in compatible ways:
- Some functions now take "const char *" arguments, not "char *"
- Some structs now have "conts char *" members, not "char *"
The changes may cause warnings when compiling with the right warning
flags. You've been warned.

Also adds -Wwrite-strings as a warning flag in configure.ac.

https://bugzilla.gnome.org/show_bug.cgi?id=611692
This commit is contained in:
Benjamin Otte 2010-03-03 11:45:38 +01:00
parent 22f87a529f
commit a9d1a493a7
44 changed files with 177 additions and 232 deletions

View file

@ -578,7 +578,7 @@ GST_PKG_DEPS="glib-2.0, gobject-2.0, gmodule-no-export-2.0, gthread-2.0"
AC_SUBST(GST_PKG_DEPS)
dnl define an ERROR_CFLAGS Makefile variable
AG_GST_SET_ERROR_CFLAGS($GST_GIT, [-Wredundant-decls -Wundef])
AG_GST_SET_ERROR_CFLAGS($GST_GIT, [-Wredundant-decls -Wundef -Wwrite-strings])
dnl define correct level for debugging messages
AG_GST_SET_LEVEL_DEFAULT($GST_GIT)

View file

@ -528,7 +528,7 @@ prepare_for_load_plugin_func (gpointer data, gpointer user_data)
#ifndef GST_DISABLE_OPTION_PARSING
static void
split_and_iterate (const gchar * stringlist, gchar * separator,
split_and_iterate (const gchar * stringlist, const gchar * separator,
GFunc iterator, gpointer user_data)
{
gchar **strings;
@ -957,7 +957,7 @@ parse_goption_arg (const gchar * opt,
{
static const struct
{
gchar *opt;
const gchar *opt;
int val;
} options[] = {
{

View file

@ -128,7 +128,7 @@
#define GST_CAT_DEFAULT GST_CAT_BUFFER_LIST
#define GROUP_START NULL
static const gpointer STOLEN = "";
static gconstpointer STOLEN = "";
/**
* GstBufferList:
@ -736,7 +736,7 @@ gst_buffer_list_iterator_steal (GstBufferListIterator * it)
g_assert (it->last_returned->data != GROUP_START);
buffer = it->last_returned->data;
it->last_returned->data = STOLEN;
it->last_returned->data = (gpointer) STOLEN;
return buffer;
}

View file

@ -136,12 +136,14 @@ debug_dump_get_element_params (GstElement * element)
}
static void
debug_dump_pad (GstPad * pad, gchar * color_name, gchar * element_name,
GstDebugGraphDetails details, FILE * out, const gint indent)
debug_dump_pad (GstPad * pad, const gchar * color_name,
const gchar * element_name, GstDebugGraphDetails details, FILE * out,
const gint indent)
{
GstPadTemplate *pad_templ;
GstPadPresence presence;
gchar *pad_name, *style_name;
gchar *pad_name;
const gchar *style_name;
const gchar *spc = &spaces[MAX (sizeof (spaces) - (1 + indent * 2), 0)];
pad_name = debug_dump_make_object_name (GST_OBJECT (pad));
@ -191,7 +193,7 @@ debug_dump_element_pad (GstPad * pad, GstElement * element,
GstPadDirection dir;
gchar *element_name;
gchar *target_element_name;
gchar *color_name;
const gchar *color_name;
dir = gst_pad_get_direction (pad);
element_name = debug_dump_make_object_name (GST_OBJECT (element));
@ -206,14 +208,13 @@ debug_dump_element_pad (GstPad * pad, GstElement * element,
target_element_name =
debug_dump_make_object_name (GST_OBJECT (target_element));
} else {
target_element_name = "";
target_element_name = g_strdup ("");
}
debug_dump_pad (target_pad, color_name, target_element_name, details,
out, indent);
if (target_element) {
g_free (target_element_name);
g_free (target_element_name);
if (target_element)
gst_object_unref (target_element);
}
gst_object_unref (target_pad);
}
gst_object_unref (tmp_pad);
@ -265,8 +266,7 @@ string_append_field (GQuark field, const GValue * value, gpointer ptr)
}
static gchar *
debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details,
gboolean * need_free)
debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details)
{
gchar *media = NULL;
@ -274,7 +274,6 @@ debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details,
if (gst_caps_is_any (caps) || gst_caps_is_empty (caps)) {
media = gst_caps_to_string (caps);
*need_free = TRUE;
} else {
GString *str = NULL;
@ -297,16 +296,14 @@ debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details,
}
media = g_string_free (str, FALSE);
*need_free = TRUE;
}
} else {
if (GST_CAPS_IS_SIMPLE (caps))
media =
(gchar *) gst_structure_get_name (gst_caps_get_structure (caps, 0));
g_strdup (gst_structure_get_name (gst_caps_get_structure (caps, 0)));
else
media = "*";
*need_free = FALSE;
media = g_strdup ("*");
}
return media;
}
@ -318,8 +315,6 @@ debug_dump_element_pad_link (GstPad * pad, GstElement * element,
GstElement *peer_element, *target_element;
GstPad *peer_pad, *target_pad, *tmp_pad;
GstCaps *caps, *peer_caps;
gboolean free_caps, free_peer_caps;
gboolean free_media, free_media_src, free_media_sink;
gchar *media = NULL;
gchar *media_src = NULL, *media_sink = NULL;
gchar *pad_name, *element_name;
@ -328,69 +323,47 @@ debug_dump_element_pad_link (GstPad * pad, GstElement * element,
const gchar *spc = &spaces[MAX (sizeof (spaces) - (1 + indent * 2), 0)];
if ((peer_pad = gst_pad_get_peer (pad))) {
free_media = free_media_src = free_media_sink = FALSE;
if ((details & GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE) ||
(details & GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS)
) {
if ((caps = gst_pad_get_negotiated_caps (pad))) {
free_caps = TRUE;
} else {
free_caps = FALSE;
if (!(caps = (GstCaps *)
gst_pad_get_pad_template_caps (pad))) {
/* this should not happen */
media = "?";
}
}
if ((peer_caps = gst_pad_get_negotiated_caps (peer_pad))) {
free_peer_caps = TRUE;
} else {
free_peer_caps = FALSE;
peer_caps = (GstCaps *) gst_pad_get_pad_template_caps (peer_pad);
}
if (caps) {
media = debug_dump_describe_caps (caps, details, &free_media);
/* check if peer caps are different */
if (peer_caps && !gst_caps_is_equal (caps, peer_caps)) {
gchar *tmp;
gboolean free_tmp;
caps = gst_pad_get_negotiated_caps (pad);
if (!caps)
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
peer_caps = gst_pad_get_negotiated_caps (peer_pad);
if (!peer_caps)
peer_caps = gst_caps_copy (gst_pad_get_pad_template_caps (peer_pad));
tmp = debug_dump_describe_caps (peer_caps, details, &free_tmp);
if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
media_src = media;
free_media_src = free_media;
media_sink = tmp;
free_media_sink = free_tmp;
} else {
media_src = tmp;
free_media_src = free_tmp;
media_sink = media;
free_media_sink = free_media;
}
media = NULL;
free_media = FALSE;
}
if (free_caps) {
gst_caps_unref (caps);
media = debug_dump_describe_caps (caps, details);
/* check if peer caps are different */
if (peer_caps && !gst_caps_is_equal (caps, peer_caps)) {
gchar *tmp;
tmp = debug_dump_describe_caps (peer_caps, details);
if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
media_src = media;
media_sink = tmp;
} else {
media_src = tmp;
media_sink = media;
}
media = NULL;
}
if (free_peer_caps && peer_caps) {
gst_caps_unref (peer_caps);
}
gst_caps_unref (peer_caps);
gst_caps_unref (caps);
}
pad_name = debug_dump_make_object_name (GST_OBJECT (pad));
if (element) {
element_name = debug_dump_make_object_name (GST_OBJECT (element));
} else {
element_name = "";
element_name = g_strdup ("");
}
peer_pad_name = debug_dump_make_object_name (GST_OBJECT (peer_pad));
if ((peer_element = gst_pad_get_parent_element (peer_pad))) {
peer_element_name =
debug_dump_make_object_name (GST_OBJECT (peer_element));
} else {
peer_element_name = "";
peer_element_name = g_strdup ("");
}
if (GST_IS_GHOST_PAD (pad)) {
@ -402,17 +375,16 @@ debug_dump_element_pad_link (GstPad * pad, GstElement * element,
target_element_name =
debug_dump_make_object_name (GST_OBJECT (target_element));
} else {
target_element_name = "";
target_element_name = g_strdup ("");
}
/* src ghostpad relationship */
fprintf (out, "%s%s_%s -> %s_%s [style=dashed, minlen=0]\n", spc,
target_element_name, target_pad_name, element_name, pad_name);
g_free (target_pad_name);
if (target_element) {
g_free (target_element_name);
g_free (target_element_name);
if (target_element)
gst_object_unref (target_element);
}
gst_object_unref (target_pad);
}
gst_object_unref (tmp_pad);
@ -427,7 +399,7 @@ debug_dump_element_pad_link (GstPad * pad, GstElement * element,
target_element_name =
debug_dump_make_object_name (GST_OBJECT (target_element));
} else {
target_element_name = "";
target_element_name = g_strdup ("");
}
/* sink ghostpad relationship */
fprintf (out, "%s%s_%s -> %s_%s [style=dashed, minlen=0]\n", spc,
@ -442,10 +414,9 @@ debug_dump_element_pad_link (GstPad * pad, GstElement * element,
debug_dump_element_pad_link (target_pad, target_element, details, out,
indent);
g_free (target_pad_name);
if (target_element) {
g_free (target_element_name);
g_free (target_element_name);
if (target_element)
gst_object_unref (target_element);
}
gst_object_unref (target_pad);
}
gst_object_unref (tmp_pad);
@ -456,9 +427,7 @@ debug_dump_element_pad_link (GstPad * pad, GstElement * element,
if (media) {
fprintf (out, "%s%s_%s -> %s_%s [label=\"%s\"]\n", spc,
element_name, pad_name, peer_element_name, peer_pad_name, media);
if (free_media) {
g_free (media);
}
g_free (media);
} else if (media_src && media_sink) {
/* dot has some issues with placement of head and taillabels,
* we need an empty label to make space */
@ -467,24 +436,19 @@ debug_dump_element_pad_link (GstPad * pad, GstElement * element,
"headlabel=\"%s\", taillabel=\"%s\"]\n",
spc, element_name, pad_name, peer_element_name, peer_pad_name,
media_src, media_sink);
if (free_media_src)
g_free (media_src);
if (free_media_sink)
g_free (media_sink);
g_free (media_src);
g_free (media_sink);
} else {
fprintf (out, "%s%s_%s -> %s_%s\n", spc,
element_name, pad_name, peer_element_name, peer_pad_name);
}
g_free (pad_name);
if (element) {
g_free (element_name);
}
g_free (element_name);
g_free (peer_pad_name);
if (peer_element) {
g_free (peer_element_name);
g_free (peer_element_name);
if (peer_element)
gst_object_unref (peer_element);
}
gst_object_unref (peer_pad);
}
}

View file

@ -65,7 +65,8 @@ _gst_format_initialize (void)
while (standards->nick) {
standards->quark = g_quark_from_static_string (standards->nick);
g_hash_table_insert (_nick_to_format, standards->nick, standards);
g_hash_table_insert (_nick_to_format, (gpointer) standards->nick,
standards);
g_hash_table_insert (_format_to_nick, GINT_TO_POINTER (standards->value),
standards);
@ -157,7 +158,7 @@ gst_format_register (const gchar * nick, const gchar * description)
format->description = g_strdup (description);
format->quark = g_quark_from_static_string (format->nick);
g_hash_table_insert (_nick_to_format, format->nick, format);
g_hash_table_insert (_nick_to_format, (gpointer) format->nick, format);
g_hash_table_insert (_format_to_nick, GINT_TO_POINTER (format->value),
format);
_gst_formats = g_list_append (_gst_formats, format);

View file

@ -86,10 +86,10 @@ typedef struct _GstFormatDefinition GstFormatDefinition;
*/
struct _GstFormatDefinition
{
GstFormat value;
gchar *nick;
gchar *description;
GQuark quark;
GstFormat value;
const gchar *nick;
const gchar *description;
GQuark quark;
};
const gchar* gst_format_get_name (GstFormat format);

View file

@ -866,7 +866,6 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
gint pid;
GstClockTime elapsed;
gchar *obj = NULL;
gboolean free_obj = TRUE;
gboolean is_colored;
if (level > gst_debug_category_get_threshold (category))
@ -881,15 +880,14 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
if (object) {
obj = gst_debug_print_object (object);
} else {
obj = "\0";
free_obj = FALSE;
obj = g_strdup ("");
}
if (is_colored) {
#ifndef G_OS_WIN32
/* colors, non-windows */
gchar *color = NULL;
gchar *clear;
const gchar *clear;
gchar pidcolor[10];
const gchar *levelcolor;
@ -947,8 +945,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
#undef PRINT_FMT
}
if (free_obj)
g_free (obj);
g_free (obj);
}
/**

View file

@ -76,9 +76,9 @@ gst_mini_object_get_type (void)
gst_value_mini_object_free,
gst_value_mini_object_copy,
gst_value_mini_object_peek_pointer,
"p",
(char *) "p",
gst_value_mini_object_collect,
"p",
(char *) "p",
gst_value_mini_object_lcopy
};
GTypeInfo mini_object_info = {

View file

@ -501,7 +501,8 @@ gst_object_dispatch_properties_changed (GObject * object,
{
GstObject *gst_object, *parent, *old_parent;
guint i;
gchar *name, *debug_name;
gchar *name;
const gchar *debug_name;
/* do the standard dispatching */
parent_class->dispatch_properties_changed (object, n_pspecs, pspecs);
@ -1075,7 +1076,7 @@ gst_object_get_path_string (GstObject * object)
gchar *prevpath, *path;
const gchar *typename;
gchar *component;
gchar *separator;
const gchar *separator;
/* ref object before adding to list */
gst_object_ref (object);

View file

@ -257,7 +257,7 @@ struct _GstObject {
struct _GstObjectClass {
GObjectClass parent_class;
gchar *path_string_separator;
const gchar *path_string_separator;
GObject *signal_object;
/* FIXME-0.11: remove this, plus the above GST_CLASS_*_LOCK macros */

View file

@ -105,7 +105,6 @@ static GstPlugin *gst_plugin_register_func (GstPlugin * plugin,
const GstPluginDesc * desc, gpointer user_data);
static void gst_plugin_desc_copy (GstPluginDesc * dest,
const GstPluginDesc * src);
static void gst_plugin_desc_free (GstPluginDesc * desc);
static void gst_plugin_ext_dep_free (GstPluginDep * dep);
@ -133,7 +132,6 @@ gst_plugin_finalize (GObject * object)
}
g_free (plugin->filename);
g_free (plugin->basename);
gst_plugin_desc_free (&plugin->desc);
g_list_foreach (plugin->priv->deps, (GFunc) gst_plugin_ext_dep_free, NULL);
g_list_free (plugin->priv->deps);
@ -224,7 +222,7 @@ _gst_plugin_register_static (GstPluginDesc * desc)
*/
gboolean
gst_plugin_register_static (gint major_version, gint minor_version,
const gchar * name, gchar * description, GstPluginInitFunc init_func,
const gchar * name, const gchar * description, GstPluginInitFunc init_func,
const gchar * version, const gchar * license, const gchar * source,
const gchar * package, const gchar * origin)
{
@ -291,7 +289,7 @@ gst_plugin_register_static (gint major_version, gint minor_version,
*/
gboolean
gst_plugin_register_static_full (gint major_version, gint minor_version,
const gchar * name, gchar * description,
const gchar * name, const gchar * description,
GstPluginInitFullFunc init_full_func, const gchar * version,
const gchar * license, const gchar * source, const gchar * package,
const gchar * origin, gpointer user_data)
@ -623,9 +621,6 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, source, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, package, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, origin, filename);
} else {
/* this is overwritten by gst_plugin_register_func() */
g_free (plugin->desc.description);
}
GST_LOG ("Plugin %p for file \"%s\" prepared, calling entry function...",
@ -680,8 +675,7 @@ gst_plugin_desc_copy (GstPluginDesc * dest, const GstPluginDesc * src)
dest->major_version = src->major_version;
dest->minor_version = src->minor_version;
dest->name = g_intern_string (src->name);
/* maybe intern the description too, just for convenience? */
dest->description = g_strdup (src->description);
dest->description = g_intern_string (src->description);
dest->plugin_init = src->plugin_init;
dest->version = g_intern_string (src->version);
dest->license = g_intern_string (src->license);
@ -690,14 +684,6 @@ gst_plugin_desc_copy (GstPluginDesc * dest, const GstPluginDesc * src)
dest->origin = g_intern_string (src->origin);
}
/* unused */
static void
gst_plugin_desc_free (GstPluginDesc * desc)
{
g_free (desc->description);
memset (desc, 0, sizeof (GstPluginDesc));
}
/**
* gst_plugin_get_name:
* @plugin: plugin to get the name of

View file

@ -160,7 +160,7 @@ struct _GstPluginDesc {
gint major_version;
gint minor_version;
const gchar *name;
gchar *description;
const gchar *description;
GstPluginInitFunc plugin_init;
const gchar *version;
const gchar *license;
@ -329,7 +329,7 @@ void _gst_plugin_register_static (GstPluginDesc *desc);
gboolean gst_plugin_register_static (gint major_version,
gint minor_version,
const gchar *name,
gchar *description,
const gchar *description,
GstPluginInitFunc init_func,
const gchar *version,
const gchar *license,
@ -340,7 +340,7 @@ gboolean gst_plugin_register_static (gint major_version,
gboolean gst_plugin_register_static_full (gint major_version,
gint minor_version,
const gchar *name,
gchar *description,
const gchar *description,
GstPluginInitFullFunc init_full_func,
const gchar *version,
const gchar *license,

View file

@ -348,7 +348,7 @@ plugin_loader_create_blacklist_plugin (GstPluginLoader * l,
static gboolean
gst_plugin_loader_try_helper (GstPluginLoader * loader, gchar * location)
{
char *argv[] = { location, "-l", NULL };
char *argv[] = { location, (char *) "-l", NULL };
GST_LOG ("Trying to spawn gst-plugin-scanner helper at %s", location);
if (!g_spawn_async_with_pipes (NULL, argv, NULL,

View file

@ -114,7 +114,7 @@ _gst_query_initialize (void)
while (standards->nick) {
standards->quark = g_quark_from_static_string (standards->nick);
g_hash_table_insert (_nick_to_query, standards->nick, standards);
g_hash_table_insert (_nick_to_query, (gpointer) standards->nick, standards);
g_hash_table_insert (_query_type_to_nick,
GINT_TO_POINTER (standards->value), standards);
@ -245,7 +245,7 @@ gst_query_type_register (const gchar * nick, const gchar * description)
query->quark = g_quark_from_static_string (query->nick);
g_static_mutex_lock (&mutex);
g_hash_table_insert (_nick_to_query, query->nick, query);
g_hash_table_insert (_nick_to_query, (gpointer) query->nick, query);
g_hash_table_insert (_query_type_to_nick, GINT_TO_POINTER (query->value),
query);
_gst_queries = g_list_append (_gst_queries, query);

View file

@ -104,8 +104,8 @@ typedef struct _GstQueryClass GstQueryClass;
struct _GstQueryTypeDefinition
{
GstQueryType value;
gchar *nick;
gchar *description;
const gchar *nick;
const gchar *description;
GQuark quark;
};

View file

@ -1488,7 +1488,7 @@ gst_structure_get_fraction (const GstStructure * structure,
typedef struct _GstStructureAbbreviation
{
gchar *type_name;
const gchar *type_name;
GType type;
}
GstStructureAbbreviation;

View file

@ -111,7 +111,7 @@ gint _gst_trace_on = 1;
* Returns: a new #GstTrace.
*/
GstTrace *
gst_trace_new (gchar * filename, gint size)
gst_trace_new (const gchar * filename, gint size)
{
GstTrace *trace = g_malloc (sizeof (GstTrace));

View file

@ -88,7 +88,7 @@ struct _GstTraceEntry {
gchar message[112];
};
GstTrace* gst_trace_new (gchar *filename, gint size);
GstTrace* gst_trace_new (const gchar *filename, gint size);
void gst_trace_destroy (GstTrace *trace);
void gst_trace_flush (GstTrace *trace);

View file

@ -3986,9 +3986,9 @@ static const GTypeValueTable _gst_fourcc_value_table = {
NULL,
gst_value_copy_fourcc,
NULL,
"i",
(char *) "i",
gst_value_collect_fourcc,
"p",
(char *) "p",
gst_value_lcopy_fourcc
};
@ -3999,9 +3999,9 @@ static const GTypeValueTable _gst_int_range_value_table = {
NULL,
gst_value_copy_int_range,
NULL,
"ii",
(char *) "ii",
gst_value_collect_int_range,
"pp",
(char *) "pp",
gst_value_lcopy_int_range
};
@ -4012,9 +4012,9 @@ static const GTypeValueTable _gst_double_range_value_table = {
NULL,
gst_value_copy_double_range,
NULL,
"dd",
(char *) "dd",
gst_value_collect_double_range,
"pp",
(char *) "pp",
gst_value_lcopy_double_range
};
@ -4025,9 +4025,9 @@ static const GTypeValueTable _gst_fraction_range_value_table = {
gst_value_free_fraction_range,
gst_value_copy_fraction_range,
NULL,
"iiii",
(char *) "iiii",
gst_value_collect_fraction_range,
"pppp",
(char *) "pppp",
gst_value_lcopy_fraction_range
};
@ -4038,9 +4038,9 @@ static const GTypeValueTable _gst_value_list_value_table = {
gst_value_free_list_or_array,
gst_value_copy_list_or_array,
gst_value_list_or_array_peek_pointer,
"p",
(char *) "p",
gst_value_collect_list_or_array,
"p",
(char *) "p",
gst_value_lcopy_list_or_array
};
@ -4051,9 +4051,9 @@ static const GTypeValueTable _gst_value_array_value_table = {
gst_value_free_list_or_array,
gst_value_copy_list_or_array,
gst_value_list_or_array_peek_pointer,
"p",
(char *) "p",
gst_value_collect_list_or_array,
"p",
(char *) "p",
gst_value_lcopy_list_or_array
};
@ -4064,9 +4064,9 @@ static const GTypeValueTable _gst_fraction_value_table = {
NULL,
gst_value_copy_fraction,
NULL,
"ii",
(char *) "ii",
gst_value_collect_fraction,
"pp",
(char *) "pp",
gst_value_lcopy_fraction
};

View file

@ -182,7 +182,7 @@ gst_check_setup_src_pad (GstElement * element,
GstPad *
gst_check_setup_src_pad_by_name (GstElement * element,
GstStaticPadTemplate * template, gchar * name)
GstStaticPadTemplate * template, const gchar * name)
{
GstPad *srcpad, *sinkpad;
@ -207,7 +207,7 @@ gst_check_setup_src_pad_by_name (GstElement * element,
}
void
gst_check_teardown_pad_by_name (GstElement * element, gchar * name)
gst_check_teardown_pad_by_name (GstElement * element, const gchar * name)
{
GstPad *pad_peer, *pad_element;
@ -261,7 +261,7 @@ gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * template,
GstPad *
gst_check_setup_sink_pad_by_name (GstElement * element,
GstStaticPadTemplate * template, gchar * name)
GstStaticPadTemplate * template, const gchar * name)
{
GstPad *srcpad, *sinkpad;

View file

@ -56,7 +56,7 @@ extern GCond *check_cond;
typedef struct
{
char *name;
const char *name;
int size;
int abi_size;
}
@ -74,10 +74,10 @@ void gst_check_teardown_element (GstElement * element);
GstPad *gst_check_setup_src_pad (GstElement * element,
GstStaticPadTemplate * template, GstCaps * caps);
GstPad * gst_check_setup_src_pad_by_name (GstElement * element,
GstStaticPadTemplate * template, gchar *name);
GstStaticPadTemplate * template, const gchar *name);
GstPad * gst_check_setup_sink_pad_by_name (GstElement * element,
GstStaticPadTemplate * template, gchar *name);
void gst_check_teardown_pad_by_name (GstElement * element, gchar *name);
GstStaticPadTemplate * template, const gchar *name);
void gst_check_teardown_pad_by_name (GstElement * element, const gchar *name);
void gst_check_teardown_src_pad (GstElement * element);
void gst_check_drop_buffers ();
void gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2);

View file

@ -217,7 +217,7 @@ gst_controller_find_controlled_property (GstController * self,
*/
static GstController *
gst_controller_add_property (GstController * self, GObject * object,
gchar * name, gboolean * ref_existing)
const gchar * name, gboolean * ref_existing)
{
/* test if this property isn't yet controlled */
if (!self || !gst_controller_find_controlled_property (self, name)) {
@ -454,7 +454,7 @@ gst_controller_remove_properties (GstController * self, ...)
void
gst_controller_set_property_disabled (GstController * self,
gchar * property_name, gboolean disabled)
const gchar * property_name, gboolean disabled)
{
GstControlledProperty *prop;
@ -512,8 +512,8 @@ gst_controller_set_disabled (GstController * self, gboolean disabled)
* Since: 0.10.14
*/
gboolean
gst_controller_set_control_source (GstController * self, gchar * property_name,
GstControlSource * csource)
gst_controller_set_control_source (GstController * self,
const gchar * property_name, GstControlSource * csource)
{
GstControlledProperty *prop;
gboolean ret = FALSE;
@ -552,7 +552,8 @@ gst_controller_set_control_source (GstController * self, gchar * property_name,
* Since: 0.10.14
*/
GstControlSource *
gst_controller_get_control_source (GstController * self, gchar * property_name)
gst_controller_get_control_source (GstController * self,
const gchar * property_name)
{
GstControlledProperty *prop;
GstControlSource *ret = NULL;
@ -585,7 +586,7 @@ gst_controller_get_control_source (GstController * self, gchar * property_name)
* property isn't handled by the controller
*/
GValue *
gst_controller_get (GstController * self, gchar * property_name,
gst_controller_get (GstController * self, const gchar * property_name,
GstClockTime timestamp)
{
GstControlledProperty *prop;
@ -1021,7 +1022,7 @@ gst_controlled_property_set_interpolation_mode (GstControlledProperty * self,
*/
#ifndef GST_REMOVE_DEPRECATED
gboolean
gst_controller_set (GstController * self, gchar * property_name,
gst_controller_set (GstController * self, const gchar * property_name,
GstClockTime timestamp, GValue * value)
{
gboolean res = FALSE;
@ -1065,7 +1066,7 @@ out:
*/
#ifndef GST_REMOVE_DEPRECATED
gboolean
gst_controller_set_from_list (GstController * self, gchar * property_name,
gst_controller_set_from_list (GstController * self, const gchar * property_name,
GSList * timedvalues)
{
gboolean res = FALSE;
@ -1111,7 +1112,7 @@ out:
*/
#ifndef GST_REMOVE_DEPRECATED
gboolean
gst_controller_unset (GstController * self, gchar * property_name,
gst_controller_unset (GstController * self, const gchar * property_name,
GstClockTime timestamp)
{
gboolean res = FALSE;
@ -1154,7 +1155,7 @@ out:
*/
#ifndef GST_REMOVE_DEPRECATED
gboolean
gst_controller_unset_all (GstController * self, gchar * property_name)
gst_controller_unset_all (GstController * self, const gchar * property_name)
{
GstControlledProperty *prop;
@ -1194,7 +1195,7 @@ out:
*/
#ifndef GST_REMOVE_DEPRECATED
const GList *
gst_controller_get_all (GstController * self, gchar * property_name)
gst_controller_get_all (GstController * self, const gchar * property_name)
{
const GList *res = NULL;
GstControlledProperty *prop;
@ -1238,7 +1239,7 @@ out:
#ifndef GST_REMOVE_DEPRECATED
gboolean
gst_controller_set_interpolation_mode (GstController * self,
gchar * property_name, GstInterpolateMode mode)
const gchar * property_name, GstInterpolateMode mode)
{
gboolean res = FALSE;
GstControlledProperty *prop;

View file

@ -90,15 +90,15 @@ gboolean gst_controller_remove_properties_list (GstController * self,
gboolean gst_controller_remove_properties (GstController * self, ...) G_GNUC_NULL_TERMINATED;
void gst_controller_set_disabled (GstController *self, gboolean disabled);
void gst_controller_set_property_disabled (GstController *self, gchar * property_name, gboolean disabled);
gboolean gst_controller_set_control_source (GstController *self, gchar * property_name, GstControlSource *csource);
GstControlSource * gst_controller_get_control_source (GstController *self, gchar * property_name);
void gst_controller_set_property_disabled (GstController *self, const gchar * property_name, gboolean disabled);
gboolean gst_controller_set_control_source (GstController *self, const gchar * property_name, GstControlSource *csource);
GstControlSource * gst_controller_get_control_source (GstController *self, const gchar * property_name);
GstClockTime gst_controller_suggest_next_sync (GstController *self);
gboolean gst_controller_sync_values (GstController * self,
GstClockTime timestamp);
GValue *gst_controller_get (GstController * self, gchar * property_name,
GValue *gst_controller_get (GstController * self, const gchar * property_name,
GstClockTime timestamp);
gboolean gst_controller_get_value_arrays (GstController * self,
GstClockTime timestamp, GSList * value_arrays);
@ -116,8 +116,8 @@ gboolean gst_object_set_controller (GObject * object, GstController * controller
GstClockTime gst_object_suggest_next_sync (GObject * object);
gboolean gst_object_sync_values (GObject * object, GstClockTime timestamp);
gboolean gst_object_set_control_source (GObject *object, gchar * property_name, GstControlSource *csource);
GstControlSource * gst_object_get_control_source (GObject *object, gchar * property_name);
gboolean gst_object_set_control_source (GObject *object, const gchar * property_name, GstControlSource *csource);
GstControlSource * gst_object_get_control_source (GObject *object, const gchar * property_name);
gboolean gst_object_get_value_arrays (GObject * object,
GstClockTime timestamp, GSList * value_arrays);
@ -134,20 +134,20 @@ gboolean gst_controller_init (int * argc, char ***argv);
/* FIXME: deprecated functions */
#ifndef GST_DISABLE_DEPRECATED
gboolean gst_controller_set (GstController * self, gchar * property_name,
gboolean gst_controller_set (GstController * self, const gchar * property_name,
GstClockTime timestamp, GValue * value);
gboolean gst_controller_set_from_list (GstController * self,
gchar * property_name, GSList * timedvalues);
const gchar * property_name, GSList * timedvalues);
gboolean gst_controller_unset (GstController * self, gchar * property_name,
gboolean gst_controller_unset (GstController * self, const gchar * property_name,
GstClockTime timestamp);
gboolean gst_controller_unset_all (GstController * self, gchar * property_name);
gboolean gst_controller_unset_all (GstController * self, const gchar * property_name);
const GList *gst_controller_get_all (GstController * self,
gchar * property_name);
const gchar * property_name);
gboolean gst_controller_set_interpolation_mode (GstController * self,
gchar * property_name, GstInterpolateMode mode);
const gchar * property_name, GstInterpolateMode mode);
#endif /* GST_DISABLE_DEPRECATED */
G_END_DECLS

View file

@ -206,7 +206,7 @@ gst_object_sync_values (GObject * object, GstClockTime timestamp)
* Since: 0.10.14
*/
gboolean
gst_object_set_control_source (GObject * object, gchar * property_name,
gst_object_set_control_source (GObject * object, const gchar * property_name,
GstControlSource * csource)
{
GstController *ctrl = NULL;
@ -234,7 +234,7 @@ gst_object_set_control_source (GObject * object, gchar * property_name,
* Since: 0.10.14
*/
GstControlSource *
gst_object_get_control_source (GObject * object, gchar * property_name)
gst_object_get_control_source (GObject * object, const gchar * property_name)
{
GstController *ctrl = NULL;

View file

@ -47,7 +47,7 @@ main (int argc, char *argv[])
my_argc = 2;
my_argv = g_malloc (my_argc * sizeof (char *));
my_argv[0] = argv[0];
my_argv[1] = "--gst-disable-registry-update";
my_argv[1] = (char *) "--gst-disable-registry-update";
#ifndef GST_DISABLE_REGISTRY
_gst_disable_registry_cache = TRUE;

View file

@ -601,7 +601,7 @@ gst_fd_sink_uri_get_type (void)
static gchar **
gst_fd_sink_uri_get_protocols (void)
{
static gchar *protocols[] = { "fd", NULL };
static gchar *protocols[] = { (char *) "fd", NULL };
return protocols;
}

View file

@ -604,7 +604,7 @@ gst_fd_src_uri_get_type (void)
static gchar **
gst_fd_src_uri_get_protocols (void)
{
static gchar *protocols[] = { "fd", NULL };
static gchar *protocols[] = { (char *) "fd", NULL };
return protocols;
}

View file

@ -693,7 +693,7 @@ gst_file_sink_uri_get_type (void)
static gchar **
gst_file_sink_uri_get_protocols (void)
{
static gchar *protocols[] = { "file", NULL };
static gchar *protocols[] = { (char *) "file", NULL };
return protocols;
}

View file

@ -1117,7 +1117,7 @@ gst_file_src_uri_get_type (void)
static gchar **
gst_file_src_uri_get_protocols (void)
{
static gchar *protocols[] = { "file", NULL };
static gchar *protocols[] = { (char *) "file", NULL };
return protocols;
}

View file

@ -150,7 +150,7 @@ main (gint argc, gchar * argv[])
{
GstClockTime sample_duration =
gst_util_uint64_scale_int (1, GST_SECOND, 44100);
GstValueArray va = { "freq",
GstValueArray va = { (char *) "freq",
BLOCK_SIZE * NUM_CP,
sample_duration,
NULL

View file

@ -42,7 +42,7 @@ main (gint argc, gchar * argv[])
GstElement *pipeline, *src, *sink, *current, *last;
guint i, buffers = BUFFER_COUNT, identities = IDENTITY_COUNT;
GstClockTime start, end;
gchar *src_name = SRC_ELEMENT, *sink_name = SINK_ELEMENT;
const gchar *src_name = SRC_ELEMENT, *sink_name = SINK_ELEMENT;
gst_init (&argc, &argv);

View file

@ -116,7 +116,7 @@ GST_START_TEST (test_stress)
{
GstElement *pipeline;
GstElement *tee;
gchar *desc;
const gchar *desc;
GstBus *bus;
GstMessage *msg;
gint i;

View file

@ -45,7 +45,7 @@ cleanup (void)
}
static GstBuffer *
buffer_from_string (gchar * str)
buffer_from_string (const gchar * str)
{
guint size;
GstBuffer *buf;
@ -472,7 +472,7 @@ GST_START_TEST (test_do)
gst_buffer_list_iterator_do (it,
(GstBufferListDoFunction) gst_buffer_ref, NULL)));
fail_unless (buf == NULL);
data = "data";
data = (char *) "data";
ASSERT_CRITICAL ((buf = gst_buffer_list_iterator_do (it, do_data_func,
data)));
fail_unless (buf == NULL);

View file

@ -400,7 +400,7 @@ GST_START_TEST (test_push_linked)
GST_END_TEST;
static GstBuffer *
buffer_from_string (gchar * str)
buffer_from_string (const gchar * str)
{
guint size;
GstBuffer *buf;

View file

@ -102,15 +102,11 @@ gst_preset_test_class_init (GObjectClass * klass)
static void
gst_preset_test_base_init (GstPresetTestClass * klass)
{
static const GstElementDetails details = {
"Element for unit tests",
"Testing",
"Use in unit tests",
"Stefan Kost <stefan.kost@nokia.com>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details (element_class, &details);
gst_element_class_set_details_simple (element_class,
"Element for unit tests",
"Testing", "Use in unit tests", "Stefan Kost <stefan.kost@nokia.com>");
}
static GType

View file

@ -424,7 +424,8 @@ GST_END_TEST;
GST_START_TEST (test_structure_nested_from_and_to_string)
{
GstStructure *s;
gchar *str1, *str2, *end = NULL;
const gchar *str1;
gchar *str2, *end = NULL;
str1 = "main"
", main-sub1=(structure)\"type-b\\,\\ machine-type\\=\\(int\\)0\\;\""

View file

@ -37,7 +37,8 @@
/* checks that a tag contains the given values and not more values */
static void
check_tags (const GstTagList * list, const gchar * tag, gchar * value, ...)
check_tags (const GstTagList * list, const gchar * tag, const gchar * value,
...)
{
va_list args;
gchar *str;

View file

@ -425,7 +425,7 @@ GST_END_TEST;
GST_START_TEST (test_string)
{
gchar *try[] = {
const gchar *try[] = {
"Dude",
"Hi, I'm a string",
"tüüüt!",
@ -460,8 +460,8 @@ GST_START_TEST (test_deserialize_string)
{
struct
{
gchar *from;
gchar *to;
const gchar *from;
const gchar *to;
} tests[] = {
{
"", ""}, /* empty strings */

View file

@ -180,15 +180,12 @@ gst_test_mono_source_class_init (GstTestMonoSourceClass * klass)
static void
gst_test_mono_source_base_init (GstTestMonoSourceClass * klass)
{
static const GstElementDetails details = {
"Monophonic source for unit tests",
"Source/Audio/MonoSource",
"Use in unit tests",
"Stefan Kost <ensonic@users.sf.net>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details (element_class, &details);
gst_element_class_set_details_simple (element_class,
"Monophonic source for unit tests",
"Source/Audio/MonoSource",
"Use in unit tests", "Stefan Kost <ensonic@users.sf.net>");
}
static GType
@ -1079,7 +1076,7 @@ GST_START_TEST (controller_interpolation_linear_value_array)
fail_unless (res, NULL);
/* now pull in values for some timestamps */
values.property_name = "ulong";
values.property_name = (char *) "ulong";
values.nbsamples = 3;
values.sample_interval = GST_SECOND;
values.values = (gpointer) g_new (gulong, 3);
@ -1987,7 +1984,7 @@ GST_START_TEST (controller_refcount_new_list)
/* that property should exist and should be controllable */
elem = gst_element_factory_make ("testmonosource", "test_source");
list = g_list_append (NULL, "ulong");
list = g_list_append (NULL, (char *) "ulong");
ctrl = gst_controller_new_list (G_OBJECT (elem), list);
fail_unless (ctrl != NULL, NULL);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
@ -1998,8 +1995,8 @@ GST_START_TEST (controller_refcount_new_list)
/* try the same property twice, make sure the refcount is still 1 */
elem = gst_element_factory_make ("testmonosource", "test_source");
list = g_list_append (NULL, "ulong");
list = g_list_append (list, "ulong");
list = g_list_append (NULL, (char *) "ulong");
list = g_list_append (list, (char *) "ulong");
ctrl = gst_controller_new_list (G_OBJECT (elem), list);
fail_unless (ctrl != NULL, NULL);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
@ -2010,8 +2007,8 @@ GST_START_TEST (controller_refcount_new_list)
/* try two properties, make sure the refcount is still 1 */
elem = gst_element_factory_make ("testmonosource", "test_source");
list = g_list_append (NULL, "ulong");
list = g_list_append (list, "boolean");
list = g_list_append (NULL, (char *) "ulong");
list = g_list_append (list, (char *) "boolean");
ctrl = gst_controller_new_list (G_OBJECT (elem), list);
fail_unless (ctrl != NULL, NULL);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
@ -2025,7 +2022,7 @@ GST_START_TEST (controller_refcount_new_list)
ctrl = gst_controller_new (G_OBJECT (elem), "ulong", NULL);
fail_unless (ctrl != NULL, NULL);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);
list = g_list_append (NULL, "ulong");
list = g_list_append (NULL, (char *) "ulong");
ctrl2 = gst_controller_new_list (G_OBJECT (elem), list);
fail_unless (ctrl2 != NULL, NULL);
fail_unless (ctrl == ctrl2, NULL);
@ -2038,7 +2035,7 @@ GST_START_TEST (controller_refcount_new_list)
/* try _new_list first and then _new */
elem = gst_element_factory_make ("testmonosource", "test_source");
list = g_list_append (NULL, "ulong");
list = g_list_append (NULL, (char *) "ulong");
ctrl = gst_controller_new_list (G_OBJECT (elem), list);
fail_unless (ctrl != NULL, NULL);
GST_INFO ("controller->ref_count=%d", G_OBJECT (ctrl)->ref_count);

View file

@ -42,7 +42,7 @@ static GstStaticCaps foobar_caps = GST_STATIC_CAPS ("foo/x-bar");
/* make sure the entire data in the buffer is available for peeking */
GST_START_TEST (test_buffer_range)
{
static gchar *foobar_exts[] = { "foobar", NULL };
static const gchar *foobar_exts[] = { "foobar", NULL };
GstStructure *s;
GstBuffer *buf;

View file

@ -24,7 +24,7 @@
static GstElement *
setup_pipeline (gchar * pipe_descr)
setup_pipeline (const gchar * pipe_descr)
{
GstElement *pipeline;
@ -37,7 +37,7 @@ setup_pipeline (gchar * pipe_descr)
the poll call will time out after half a second.
*/
static void
run_pipeline (GstElement * pipeline, gchar * descr,
run_pipeline (GstElement * pipeline, const gchar * descr,
GstMessageType events, GstMessageType tevent)
{
GstBus *bus;
@ -78,7 +78,7 @@ run_pipeline (GstElement * pipeline, gchar * descr,
GST_START_TEST (test_pipeline_unref)
{
gchar *s;
const gchar *s;
GstElement *pipeline, *src, *sink;
s = "fakesrc name=src num-buffers=20 ! fakesink name=sink";

View file

@ -478,10 +478,10 @@ static void
gst_parse_test_element_base_init (gpointer g_class)
{
static const GstElementDetails cdfoo_details =
GST_ELEMENT_DETAILS ("Test element for parse launch tests",
"Source",
"Test element for parse launch tests in core",
"GStreamer Devel <gstreamer-devel@lists.sf.net>");
GST_ELEMENT_DETAILS ((char *) "Test element for parse launch tests",
(char *) "Source",
(char *) "Test element for parse launch tests in core",
(char *) "GStreamer Devel <gstreamer-devel@lists.sf.net>");
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &cdfoo_details);

View file

@ -24,7 +24,7 @@
static GstElement *
setup_pipeline (gchar * pipe_descr)
setup_pipeline (const gchar * pipe_descr)
{
GstElement *pipeline;
@ -43,7 +43,7 @@ setup_pipeline (gchar * pipe_descr)
* the poll call will time out after half a second.
*/
static void
run_pipeline (GstElement * pipeline, gchar * descr,
run_pipeline (GstElement * pipeline, const gchar * descr,
GstMessageType message_types, GstMessageType tmessage)
{
GstBus *bus;
@ -97,7 +97,7 @@ done:
GST_START_TEST (test_2_elements)
{
gchar *s;
const gchar *s;
s = "fakesrc can-activate-push=false ! fakesink can-activate-pull=true";
run_pipeline (setup_pipeline (s), s,
@ -147,7 +147,7 @@ check_state_change_return (GstElement * pipeline, GstState state,
GST_START_TEST (test_state_change_returns)
{
gchar *s;
const gchar *s;
GstElement *pipeline;
s = "fakesrc can-activate-pull=false ! fakesink";
@ -188,7 +188,7 @@ GST_END_TEST;
G_GNUC_UNUSED
GST_START_TEST (test_tee)
{
gchar *s;
const gchar *s;
s = "fakesrc can-activate-push=true ! tee ! fakesink can-activate-push=true";
run_pipeline (setup_pipeline (s), s,

View file

@ -171,7 +171,7 @@ print_event_masks (const GstEventMask * masks)
}
#endif
static char *
static const char *
get_rank_name (gint rank)
{
switch (rank) {