Commit 47ef3be1 authored by Michael Natterer's avatar Michael Natterer 😴

Initialize GValues with G_VALUE_INIT instead of { 0, }

parent d1d3a5e2
......@@ -47,7 +47,7 @@ gimp_config_connect_notify (GObject *src,
(dest_spec->flags & G_PARAM_WRITABLE) &&
(dest_spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, param_spec->value_type);
......@@ -128,7 +128,7 @@ gimp_config_connect_full_notify (GObject *src,
(dest_spec->flags & G_PARAM_WRITABLE) &&
(dest_spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, param_spec->value_type);
......
......@@ -407,7 +407,7 @@ gimp_rc_query (GimpRc *rc,
if (prop_spec)
{
GString *str = g_string_new (NULL);
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, prop_spec->value_type);
g_object_get_property (rc_object, prop_spec->name, &value);
......@@ -556,7 +556,7 @@ gimp_rc_migrate (GimpRc *rc)
if (GIMP_IS_PARAM_SPEC_CONFIG_PATH (pspec))
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, pspec->value_type);
......
......@@ -194,7 +194,7 @@ notify_callback (GObject *object,
GParamSpec *pspec)
{
GString *str;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
......
......@@ -957,8 +957,8 @@ gimp_global_config_notify (GObject *global_config,
GParamSpec *param_spec,
GObject *edit_config)
{
GValue global_value = { 0, };
GValue edit_value = { 0, };
GValue global_value = G_VALUE_INIT;
GValue edit_value = G_VALUE_INIT;
g_value_init (&global_value, param_spec->value_type);
g_value_init (&edit_value, param_spec->value_type);
......@@ -988,8 +988,8 @@ gimp_edit_config_notify (GObject *edit_config,
GParamSpec *param_spec,
GObject *global_config)
{
GValue edit_value = { 0, };
GValue global_value = { 0, };
GValue edit_value = G_VALUE_INIT;
GValue global_value = G_VALUE_INIT;
g_value_init (&edit_value, param_spec->value_type);
g_value_init (&global_value, param_spec->value_type);
......
......@@ -312,7 +312,7 @@ gimp_curve_get_property (GObject *object,
case PROP_POINTS:
{
GimpValueArray *array = gimp_value_array_new (curve->n_points * 2);
GValue v = { 0, };
GValue v = G_VALUE_INIT;
gint i;
g_value_init (&v, G_TYPE_DOUBLE);
......@@ -339,7 +339,7 @@ gimp_curve_get_property (GObject *object,
case PROP_SAMPLES:
{
GimpValueArray *array = gimp_value_array_new (curve->n_samples);
GValue v = { 0, };
GValue v = G_VALUE_INIT;
gint i;
g_value_init (&v, G_TYPE_DOUBLE);
......
......@@ -254,7 +254,7 @@ gimp_dash_pattern_to_value_array (GArray *pattern)
if (pattern != NULL && pattern->len > 0)
{
GimpValueArray *value_array = gimp_value_array_new (pattern->len);
GValue item = { 0, };
GValue item = G_VALUE_INIT;
gint i;
g_value_init (&item, G_TYPE_DOUBLE);
......
......@@ -215,7 +215,7 @@ gimp_param_spec_duplicate (GParamSpec *pspec)
gdouble g = 0.0;
gdouble b = 0.0;
gdouble a = 1.0;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, GEGL_TYPE_COLOR);
g_param_value_set_default (pspec, &value);
......
......@@ -204,7 +204,7 @@ gimp_tiling_set_property (GObject *object,
if (tiling->interval_x <= tiling->shift + G_DOUBLE_EPSILON)
{
GValue val = {0,};
GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_DOUBLE);
g_value_set_double (&val, 0.0);
......@@ -225,7 +225,7 @@ gimp_tiling_set_property (GObject *object,
if (tiling->interval_y <= G_DOUBLE_EPSILON)
{
GValue val = {0,};
GValue val = G_VALUE_INIT;
g_value_init (&val, G_TYPE_DOUBLE);
g_value_set_double (&val, 0.0);
......
......@@ -180,8 +180,8 @@ prefs_config_notify (GObject *config,
GParamSpec *param_spec,
GObject *config_copy)
{
GValue global_value = { 0, };
GValue copy_value = { 0, };
GValue global_value = G_VALUE_INIT;
GValue copy_value = G_VALUE_INIT;
g_value_init (&global_value, param_spec->value_type);
g_value_init (&copy_value, param_spec->value_type);
......@@ -211,8 +211,8 @@ prefs_config_copy_notify (GObject *config_copy,
GParamSpec *param_spec,
GObject *config)
{
GValue copy_value = { 0, };
GValue global_value = { 0, };
GValue copy_value = G_VALUE_INIT;
GValue global_value = G_VALUE_INIT;
g_value_init (&copy_value, param_spec->value_type);
g_value_init (&global_value, param_spec->value_type);
......@@ -324,7 +324,7 @@ prefs_response (GtkWidget *widget,
for (list = confirm_diff; list; list = g_list_next (list))
{
GParamSpec *param_spec = list->data;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, param_spec->value_type);
......@@ -395,7 +395,7 @@ prefs_response (GtkWidget *widget,
for (list = diff; list; list = g_list_next (list))
{
GParamSpec *param_spec = list->data;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, param_spec->value_type);
......@@ -704,7 +704,7 @@ prefs_format_string_select_callback (GtkTreeSelection *sel,
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
GValue val = { 0, };
GValue val = G_VALUE_INIT;
gtk_tree_model_get_value (model, &iter, 1, &val);
gtk_entry_set_text (entry, g_value_get_string (&val));
......@@ -721,7 +721,7 @@ prefs_theme_select_callback (GtkTreeSelection *sel,
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
GValue val = { 0, };
GValue val = G_VALUE_INIT;
gtk_tree_model_get_value (model, &iter, 0, &val);
g_object_set_property (G_OBJECT (gimp->config), "theme", &val);
......@@ -745,7 +745,7 @@ prefs_icon_theme_select_callback (GtkTreeSelection *sel,
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
GValue val = { 0, };
GValue val = G_VALUE_INIT;
gtk_tree_model_get_value (model, &iter, 1, &val);
g_object_set_property (G_OBJECT (gimp->config), "icon-theme", &val);
......
......@@ -376,7 +376,7 @@ gimp_gegl_config_sync_node (GimpObject *config,
if (gimp_pspec)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, gimp_pspec->value_type);
......
......@@ -511,7 +511,7 @@ GimpValueArray *
gimp_procedure_get_arguments (GimpProcedure *procedure)
{
GimpValueArray *args;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gint i;
g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
......@@ -534,7 +534,7 @@ gimp_procedure_get_return_values (GimpProcedure *procedure,
const GError *error)
{
GimpValueArray *args;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gint i;
g_return_val_if_fail (success == FALSE || GIMP_IS_PROCEDURE (procedure),
......@@ -753,7 +753,7 @@ gimp_procedure_validate_args (GimpProcedure *procedure,
}
else if (! (pspec->flags & GIMP_PARAM_NO_VALIDATE))
{
GValue string_value = { 0, };
GValue string_value = G_VALUE_INIT;
g_value_init (&string_value, G_TYPE_STRING);
......
......@@ -54,7 +54,7 @@ plug_in_params_to_args (GParamSpec **pspecs,
for (i = 0; i < n_params; i++)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
GType type;
gint count;
......
......@@ -1126,12 +1126,12 @@ static void
gimp_number_pair_entry_history_add (GtkWidget *entry,
GtkTreeModel *model)
{
GValue value = { 0, };
GtkTreeIter iter;
gboolean iter_valid;
gdouble left_number;
gdouble right_number;
const gchar *text;
GValue value = G_VALUE_INIT;
GtkTreeIter iter;
gboolean iter_valid;
gdouble left_number;
gdouble right_number;
const gchar *text;
text = gtk_entry_get_text (GTK_ENTRY (entry));
gimp_number_pair_entry_get_values (GIMP_NUMBER_PAIR_ENTRY (entry),
......
......@@ -1155,7 +1155,7 @@ gimp_text_tool_text_notify (GimpText *text,
if ((pspec->flags & G_PARAM_READWRITE) == G_PARAM_READWRITE)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, pspec->value_type);
......@@ -1313,7 +1313,7 @@ gimp_text_tool_apply (GimpTextTool *text_tool,
for (; list; list = g_list_next (list))
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
/* look ahead and compress changes */
if (list->next && list->next->data == list->data)
......
......@@ -521,7 +521,7 @@ gimp_color_display_editor_src_changed (GtkTreeSelection *sel,
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
GValue val = { 0, };
GValue val = G_VALUE_INIT;
gtk_tree_model_get_value (model, &iter, SRC_COLUMN_NAME, &val);
......@@ -556,7 +556,7 @@ gimp_color_display_editor_dest_changed (GtkTreeSelection *sel,
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
GValue val = { 0, };
GValue val = G_VALUE_INIT;
gtk_tree_model_get_value (model, &iter, DEST_COLUMN_FILTER, &val);
......
......@@ -410,7 +410,7 @@ gimp_device_info_get_property (GObject *object,
case PROP_AXES:
{
GimpValueArray *array;
GValue enum_value = { 0, };
GValue enum_value = G_VALUE_INIT;
gint n_axes;
gint i;
......@@ -436,7 +436,7 @@ gimp_device_info_get_property (GObject *object,
case PROP_KEYS:
{
GimpValueArray *array;
GValue string_value = { 0, };
GValue string_value = G_VALUE_INIT;
gint n_keys;
gint i;
......
......@@ -113,8 +113,8 @@ gimp_language_store_sort (GtkTreeModel *model,
GtkTreeIter *b,
gpointer userdata)
{
GValue avalue = { 0, };
GValue bvalue = { 0, };
GValue avalue = G_VALUE_INIT;
GValue bvalue = G_VALUE_INIT;
gint cmp = 0;
/* keep system language at the top of the list */
......
......@@ -87,7 +87,7 @@ gimp_session_info_aux_new_from_props (GObject *object,
if (pspec)
{
GString *str = g_string_new (NULL);
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, pspec->value_type);
g_object_get_property (object, pspec->name, &value);
......@@ -146,7 +146,7 @@ gimp_session_info_aux_set_props (GObject *object,
if (pspec)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, pspec->value_type);
......@@ -173,7 +173,7 @@ gimp_session_info_aux_set_props (GObject *object,
}
else
{
GValue str_value = { 0, };
GValue str_value = G_VALUE_INIT;
g_value_init (&str_value, G_TYPE_STRING);
g_value_set_static_string (&str_value, aux->value);
......
......@@ -2386,7 +2386,7 @@ xcf_load_vector (XcfInfo *info,
gint j;
GimpValueArray *control_points;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
GimpAnchor anchor = { { 0, } };
GType stroke_type;
......
......@@ -238,8 +238,8 @@ gimp_config_deserialize_property (GimpConfig *config,
GimpConfigInterface *config_iface = NULL;
GimpConfigInterface *parent_iface = NULL;
GParamSpec *prop_spec;
GTokenType token = G_TOKEN_RIGHT_PAREN;
GValue value = { 0, };
GTokenType token = G_TOKEN_RIGHT_PAREN;
GValue value = G_VALUE_INIT;
guint old_scope_id;
old_scope_id = g_scanner_set_scope (scanner, 0);
......@@ -714,7 +714,7 @@ gimp_config_deserialize_value_array (GValue *value,
{
GimpParamSpecValueArray *array_spec;
GimpValueArray *array;
GValue array_value = { 0, };
GValue array_value = G_VALUE_INIT;
gint n_values;
GTokenType token;
gint i;
......
......@@ -201,8 +201,8 @@ gimp_config_iface_equal (GimpConfig *a,
for (i = 0; equal && i < n_property_specs; i++)
{
GParamSpec *prop_spec;
GValue a_value = { 0, };
GValue b_value = { 0, };
GValue a_value = G_VALUE_INIT;
GValue b_value = G_VALUE_INIT;
prop_spec = property_specs[i];
......
......@@ -117,7 +117,7 @@ gimp_config_serialize_changed_properties (GimpConfig *config,
GParamSpec **property_specs;
guint n_property_specs;
guint i;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_return_val_if_fail (G_IS_OBJECT (config), FALSE);
......@@ -171,8 +171,8 @@ gimp_config_serialize_property (GimpConfig *config,
{
GimpConfigInterface *config_iface = NULL;
GimpConfigInterface *parent_iface = NULL;
GValue value = { 0, };
gboolean success = FALSE;
GValue value = G_VALUE_INIT;
gboolean success = FALSE;
if (! (param_spec->flags & GIMP_CONFIG_PARAM_SERIALIZE))
return FALSE;
......@@ -486,7 +486,7 @@ gimp_config_serialize_value (const GValue *value,
if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING))
{
GValue tmp_value = { 0, };
GValue tmp_value = G_VALUE_INIT;
g_value_init (&tmp_value, G_TYPE_STRING);
g_value_transform (value, &tmp_value);
......
......@@ -47,8 +47,8 @@ gimp_config_diff_property (GObject *a,
GObject *b,
GParamSpec *prop_spec)
{
GValue a_value = { 0, };
GValue b_value = { 0, };
GValue a_value = G_VALUE_INIT;
GValue b_value = G_VALUE_INIT;
gboolean retval = FALSE;
g_value_init (&a_value, prop_spec->value_type);
......@@ -231,7 +231,7 @@ gimp_config_sync (GObject *src,
if (! (prop_spec->flags & G_PARAM_CONSTRUCT_ONLY))
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, prop_spec->value_type);
......@@ -266,7 +266,7 @@ gimp_config_reset_properties (GObject *object)
{
GObjectClass *klass;
GParamSpec **property_specs;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
guint n_property_specs;
guint i;
......@@ -353,7 +353,7 @@ gimp_config_reset_property (GObject *object,
if ((prop_spec->flags & G_PARAM_WRITABLE) &&
! (prop_spec->flags & G_PARAM_CONSTRUCT_ONLY))
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
if (G_IS_PARAM_SPEC_OBJECT (prop_spec))
{
......
......@@ -944,7 +944,7 @@ static void
gimp_thumbnail_debug_notify (GObject *object,
GParamSpec *pspec)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gchar *str = NULL;
const gchar *name;
......@@ -957,7 +957,7 @@ gimp_thumbnail_debug_notify (GObject *object,
}
else if (g_value_type_transformable (pspec->value_type, G_TYPE_STRING))
{
GValue tmp = { 0, };
GValue tmp = G_VALUE_INIT;
g_value_init (&tmp, G_TYPE_STRING);
g_value_transform (&value, &tmp);
......
......@@ -1862,7 +1862,7 @@ gimp_prop_label_notify (GObject *config,
GParamSpec *param_spec,
GtkWidget *label)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, param_spec->value_type);
......@@ -1876,7 +1876,7 @@ gimp_prop_label_notify (GObject *config,
}
else
{
GValue str_value = { 0, };
GValue str_value = G_VALUE_INIT;
const gchar *str;
g_value_init (&str_value, G_TYPE_STRING);
......@@ -2787,7 +2787,7 @@ gimp_prop_size_entry_new (GObject *config,
if (unit_property_name)
{
GValue value = { 0 };
GValue value = G_VALUE_INIT;
unit_param_spec = check_param_spec_w (config, unit_property_name,
GIMP_TYPE_PARAM_UNIT, G_STRFUNC);
......@@ -3645,7 +3645,7 @@ gimp_prop_unit_combo_box_new (GObject *config,
GtkWidget *combo;
GtkTreeModel *model;
GimpUnit unit;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gboolean show_pixels;
gboolean show_percent;
......@@ -3773,7 +3773,7 @@ gimp_prop_unit_menu_new (GObject *config,
GParamSpec *param_spec;
GtkWidget *menu;
GimpUnit unit;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gboolean show_pixels;
gboolean show_percent;
......
......@@ -220,7 +220,7 @@ gimp_string_model_lookup (GtkTreeModel *model,
const gchar *id,
GtkTreeIter *iter)
{
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gboolean iter_valid;
/* This lookup could be backed up by a hash table or some other
......
......@@ -447,7 +447,7 @@ gimp_unit_menu_selection_response (GtkWidget *widget,
if (menu->selection && gtk_tree_selection_get_selected (sel, &model,
&iter))
{
GValue val = { 0, };
GValue val = G_VALUE_INIT;
GimpUnit unit;
gtk_tree_model_get_value (model, &iter, 2, &val);
......
......@@ -854,7 +854,7 @@ gimp_unit_store_get_value (GimpUnitStore *store,
{
GimpUnitStorePrivate *private;
GtkTreeIter iter;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_return_val_if_fail (GIMP_IS_UNIT_STORE (store), 0.0);
......
......@@ -283,7 +283,7 @@ gimp_input_device_store_lookup (GimpInputDeviceStore *store,
GtkTreeIter *iter)
{
GtkTreeModel *model = GTK_TREE_MODEL (store);
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gboolean iter_valid;
for (iter_valid = gtk_tree_model_get_iter_first (model, iter);
......@@ -317,7 +317,7 @@ gimp_input_device_store_insert (GimpInputDeviceStore *store,
{
GtkTreeModel *model = GTK_TREE_MODEL (store);
GtkTreeIter iter;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gint pos = 0;
gboolean iter_valid;
......@@ -453,7 +453,7 @@ gimp_input_device_store_get_device_file (GimpInputDeviceStore *store,
const gchar *udi)
{
GtkTreeIter iter;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_return_val_if_fail (GIMP_IS_INPUT_DEVICE_STORE (store), NULL);
g_return_val_if_fail (udi != NULL, NULL);
......
......@@ -193,7 +193,7 @@ gimp_input_device_store_lookup (GimpInputDeviceStore *store,
GtkTreeIter *iter)
{
GtkTreeModel *model = GTK_TREE_MODEL (store);
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gboolean iter_valid;
for (iter_valid = gtk_tree_model_get_iter_first (model, iter);
......@@ -227,7 +227,7 @@ gimp_input_device_store_insert (GimpInputDeviceStore *store,
{
GtkTreeModel *model = GTK_TREE_MODEL (store);
GtkTreeIter iter;
GValue value = { 0, };
GValue value = G_VALUE_INIT;
gint pos = 0;
gboolean iter_valid;
......
......@@ -1031,7 +1031,7 @@ save_dialog (const gint32 image_ID,
GtkWidget *tmpwidget;
GtkWidget *label;
GtkTextBuffer *textbuffer;
GValue val = {0,};
GValue val = G_VALUE_INIT;
gint x1, x2, y1, y2;
gboolean run;
......
......@@ -109,7 +109,7 @@ gimp_throbber_action_sync_property (GtkAction *action,
GtkWidget *proxy)
{
const gchar *property = g_param_spec_get_name (pspec);
GValue value = { 0, };
GValue value = G_VALUE_INIT;
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_object_get_property (G_OBJECT (action), property, &value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment