aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog21
-rw-r--r--e-util/e-config-listener.c8
-rw-r--r--e-util/e-config.c11
-rw-r--r--e-util/e-dialog-widgets.c8
-rw-r--r--e-util/e-event.c5
-rw-r--r--e-util/e-import.c5
-rw-r--r--e-util/e-menu.c5
-rw-r--r--e-util/e-pilot-map.c8
-rw-r--r--e-util/e-popup.c5
-rw-r--r--e-util/e-util.c4
10 files changed, 58 insertions, 22 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 1214ac7caa..124506509e 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,24 @@
+2007-09-10 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #471791
+
+ * e-config-listener.c: Move away from g_asserts to g_crit*
+ (e_config_listener_get_boolean_with_default),
+ (e_config_listener_get_float_with_default),
+ (e_config_listener_get_long_with_default),
+ (e_config_listener_get_string_with_default):
+ * e-config.c: (e_config_construct), (ec_rebuild),
+ (e_config_create_widget), (e_config_target_new):
+ * e-dialog-widgets.c: (e_dialog_radio_get),
+ (e_dialog_option_menu_get), (e_dialog_get_values):
+ * e-event.c: (e_event_target_new):
+ * e-import.c: (e_import_target_new):
+ * e-menu.c: (e_menu_target_new):
+ * e-pilot-map.c: (map_sax_start_element),
+ (e_pilot_map_remove_by_pid), (e_pilot_map_lookup_uid):
+ * e-popup.c: (e_popup_target_new):
+ * e-util.c: (e_flexible_strtod), (e_ascii_dtostr):
+
2007-09-07 Milan Crha <mcrha@redhat.com>
** Fix for bug #473903
diff --git a/e-util/e-config-listener.c b/e-util/e-config-listener.c
index ecc1b45fce..53e2800464 100644
--- a/e-util/e-config-listener.c
+++ b/e-util/e-config-listener.c
@@ -281,7 +281,7 @@ e_config_listener_get_boolean_with_default (EConfigListener *cl,
}
} else {
kd = (KeyData *) orig_value;
- g_assert (kd != NULL);
+ g_return_val_if_fail (kd != NULL, FALSE);
if (kd->type == GCONF_VALUE_BOOL) {
value = kd->value.v_bool;
@@ -334,7 +334,7 @@ e_config_listener_get_float_with_default (EConfigListener *cl,
}
} else {
kd = (KeyData *) orig_value;
- g_assert (kd != NULL);
+ g_return_val_if_fail (kd != NULL, -1);
if (kd->type == GCONF_VALUE_FLOAT) {
value = kd->value.v_float;
@@ -387,7 +387,7 @@ e_config_listener_get_long_with_default (EConfigListener *cl,
}
} else {
kd = (KeyData *) orig_value;
- g_assert (kd != NULL);
+ g_return_val_if_fail (kd != NULL, -1);
if (kd->type == GCONF_VALUE_INT) {
value = kd->value.v_long;
@@ -440,7 +440,7 @@ e_config_listener_get_string_with_default (EConfigListener *cl,
}
} else {
kd = (KeyData *) orig_value;
- g_assert (kd != NULL);
+ g_return_val_if_fail (kd != NULL, NULL);
if (kd->type == GCONF_VALUE_STRING) {
str = g_strdup (kd->value.v_str);
diff --git a/e-util/e-config.c b/e-util/e-config.c
index e8d9a6e789..49e745b89b 100644
--- a/e-util/e-config.c
+++ b/e-util/e-config.c
@@ -218,7 +218,7 @@ e_config_get_type(void)
**/
EConfig *e_config_construct(EConfig *ep, int type, const char *id)
{
- g_assert(type == E_CONFIG_BOOK || type == E_CONFIG_DRUID);
+ g_return_val_if_fail (type == E_CONFIG_BOOK || type == E_CONFIG_DRUID, NULL);
ep->type = type;
ep->id = g_strdup(id);
@@ -568,7 +568,7 @@ ec_rebuild(EConfig *emp)
page = item->factory(emp, item, root, wn->frame, wn->context->data);
if (emp->type == E_CONFIG_DRUID) {
if (page) {
- g_assert(GNOME_IS_DRUID_PAGE_STANDARD(page));
+ g_return_if_fail (GNOME_IS_DRUID_PAGE_STANDARD(page));
connect = wn->frame != page;
wn->frame = page;
page = ((GnomeDruidPageStandard *)page)->vbox;
@@ -824,7 +824,7 @@ e_config_create_widget(EConfig *emp)
/*char *domain = NULL;*/
int i;
- g_assert(emp->target != NULL);
+ g_return_val_if_fail (emp->target != NULL, NULL);
ec_add_static_items(emp);
@@ -1195,7 +1195,10 @@ void *e_config_target_new(EConfig *ep, int type, size_t size)
{
EConfigTarget *t;
- g_assert(size >= sizeof(EConfigTarget));
+ if (size < sizeof(EConfigTarget)) {
+ g_warning ("Size is less than size of EConfigTarget\n");
+ size = sizeof (EConfigTarget);
+ }
t = g_malloc0(size);
t->config = ep;
diff --git a/e-util/e-dialog-widgets.c b/e-util/e-dialog-widgets.c
index 7ab4857e29..36ade95803 100644
--- a/e-util/e-dialog-widgets.c
+++ b/e-util/e-dialog-widgets.c
@@ -359,7 +359,7 @@ e_dialog_radio_get (GtkWidget *widget, const int *value_map)
break;
}
- g_assert (l != NULL);
+ g_return_val_if_fail (l != NULL, -1);
/* Groups are built by prepending items, so the list ends up in reverse
* order; we need to flip the index around.
@@ -530,7 +530,7 @@ e_dialog_option_menu_get (GtkWidget *widget, const int *value_map)
menu = GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (widget)));
active = gtk_menu_get_active (menu);
- g_assert (active != NULL);
+ g_return_val_if_fail (active != NULL, -1);
children = GTK_MENU_SHELL (menu)->children;
@@ -539,7 +539,7 @@ e_dialog_option_menu_get (GtkWidget *widget, const int *value_map)
break;
}
- g_assert (l != NULL);
+ g_return_val_if_fail (l != NULL, -1);
v = index_to_value (value_map, i);
if (v == -1) {
@@ -742,7 +742,7 @@ e_dialog_get_values (GtkWidget *dialog)
else if (GTK_IS_EDITABLE (wh->widget))
get_editable_value (GTK_EDITABLE (wh->widget), wh->value_var, wh->info);
else
- g_assert_not_reached ();
+ g_return_if_reached ();
}
}
diff --git a/e-util/e-event.c b/e-util/e-event.c
index 44e75d99fa..293347e7b6 100644
--- a/e-util/e-event.c
+++ b/e-util/e-event.c
@@ -321,7 +321,10 @@ void *e_event_target_new(EEvent *ep, int type, size_t size)
{
EEventTarget *t;
- g_assert(size >= sizeof(EEventTarget));
+ if (size < sizeof(EEventTarget)) {
+ g_warning ("Size is less than the size of EEventTarget\n");
+ size = sizeof(EEventTarget);
+ }
t = g_malloc0(size);
t->event = ep;
diff --git a/e-util/e-import.c b/e-util/e-import.c
index 144c62969f..2ca5ad5f1e 100644
--- a/e-util/e-import.c
+++ b/e-util/e-import.c
@@ -351,7 +351,10 @@ void *e_import_target_new(EImport *ep, int type, size_t size)
{
EImportTarget *t;
- g_assert(size >= sizeof(EImportTarget));
+ if (size < sizeof(EImportTarget)) {
+ g_warning ("Size less than size of EImportTarget\n");
+ size = sizeof (EImportTarget);
+ }
t = g_malloc0(size);
t->import = ep;
diff --git a/e-util/e-menu.c b/e-util/e-menu.c
index c4cfe894ed..4ef45dbe03 100644
--- a/e-util/e-menu.c
+++ b/e-util/e-menu.c
@@ -542,7 +542,10 @@ void *e_menu_target_new(EMenu *ep, int type, size_t size)
{
EMenuTarget *t;
- g_assert(size >= sizeof(EMenuTarget));
+ if (size < sizeof(EMenuTarget)) {
+ g_warning ("size less than size of EMenuTarget\n");
+ size = sizeof (EMenuTarget);
+ }
t = g_malloc0(size);
t->menu = ep;
diff --git a/e-util/e-pilot-map.c b/e-util/e-pilot-map.c
index dc3ae07670..6587368773 100644
--- a/e-util/e-pilot-map.c
+++ b/e-util/e-pilot-map.c
@@ -138,8 +138,8 @@ map_sax_start_element (void *data, const xmlChar *name,
attrs = ++val;
}
- g_assert (uid != NULL);
- g_assert (pid != 0 || archived);
+ g_return_if_fail (uid != NULL);
+ g_return_if_fail (pid != 0 || archived);
real_e_pilot_map_insert (map, pid, uid, archived, FALSE);
}
@@ -259,7 +259,7 @@ e_pilot_map_remove_by_pid (EPilotMap *map, guint32 pid)
g_hash_table_lookup_extended (map->uid_map, pnode->uid, &ukey,
(gpointer *)&unode);
- g_assert (unode != NULL);
+ g_return_if_fail (unode != NULL);
g_hash_table_remove (map->pid_map, &pid);
g_hash_table_remove (map->uid_map, pnode->uid);
@@ -339,7 +339,7 @@ e_pilot_map_lookup_uid (EPilotMap *map, guint32 pid, gboolean touch)
EPilotMapUidNode *unode = NULL;
unode = g_hash_table_lookup (map->uid_map, pnode->uid);
- g_assert (unode != NULL);
+ g_return_val_if_fail (unode != NULL, NULL);
unode->touched = TRUE;
pnode->touched = TRUE;
diff --git a/e-util/e-popup.c b/e-util/e-popup.c
index 8d6922404c..5492ca1067 100644
--- a/e-util/e-popup.c
+++ b/e-util/e-popup.c
@@ -645,7 +645,10 @@ void *e_popup_target_new(EPopup *ep, int type, size_t size)
{
EPopupTarget *t;
- g_assert(size >= sizeof(EPopupTarget));
+ if (size < sizeof(EPopupTarget)) {
+ g_warning ("Size is less than the size of EPopupTarget\n");
+ size = sizeof(EPopupTarget);
+ }
t = g_malloc0(size);
t->popup = ep;
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 659da6be7d..bbeb215ba9 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -574,7 +574,7 @@ e_flexible_strtod (const gchar *nptr, gchar **endptr)
decimal_point = locale_data->decimal_point;
decimal_point_len = strlen (decimal_point);
- g_assert (decimal_point_len != 0);
+ g_return_val_if_fail (decimal_point_len != 0, 0);
decimal_point_pos = NULL;
if (!strcmp (decimal_point, "."))
@@ -730,7 +730,7 @@ e_ascii_dtostr (gchar *buffer, gint buf_len, const gchar *format, gdouble d)
decimal_point = locale_data->decimal_point;
decimal_point_len = strlen (decimal_point);
- g_assert (decimal_point_len != 0);
+ g_return_val_if_fail (decimal_point_len != 0, NULL);
if (strcmp (decimal_point, ".")) {
p = buffer;