aboutsummaryrefslogtreecommitdiff
path: root/src/datetime-prefs.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-08 16:57:20 -0600
committerTed Gould <ted@gould.cx>2012-03-08 16:57:20 -0600
commit3c12ac558602ec74e99cde48ddc6e59ea62cc6aa (patch)
tree1f5963d3de20cf696660c1f601f51a4d73f3c16e /src/datetime-prefs.c
parentade1e121d41dd07ccc81a641862d81798e38b145 (diff)
parentb5c19e04a9b46cfe5f14110a307d37d77cfe29da (diff)
downloadayatana-indicator-datetime-3c12ac558602ec74e99cde48ddc6e59ea62cc6aa.tar.gz
ayatana-indicator-datetime-3c12ac558602ec74e99cde48ddc6e59ea62cc6aa.tar.bz2
ayatana-indicator-datetime-3c12ac558602ec74e99cde48ddc6e59ea62cc6aa.zip
* New upstream release.
* Make GSettings readonly to fix DConf service starting on boot * Explicitly give types to GVariant Builder * Confirm scanf usage for Coverity (LP: #943747) * Remove unused code (LP: #943746) * Fix timezone ordering in the menu (LP: #833325, LP: #833337)
Diffstat (limited to 'src/datetime-prefs.c')
-rw-r--r--src/datetime-prefs.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index 9fdfbed..bfe75c0 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -405,6 +405,7 @@ input_time_text (GtkWidget * spinner, gdouble * value, IndicatorDatetimePanel *
if (is_locale_12h ()) { // TODO: make this look-at/watch gsettings?
char ampm[51];
+ /* coverity[secure_coding] */
scanned = sscanf (text, "%u:%u:%u %50s", &hour_in, &minute_in, &second_in, ampm);
passed = (scanned == 4);
@@ -415,6 +416,7 @@ input_time_text (GtkWidget * spinner, gdouble * value, IndicatorDatetimePanel *
}
}
} else {
+ /* coverity[secure_coding] */
scanned = sscanf (text, "%u:%u:%u", &hour_in, &minute_in, &second_in);
passed = (scanned == 3);
}
@@ -433,6 +435,7 @@ input_time_text (GtkWidget * spinner, gdouble * value, IndicatorDatetimePanel *
else {
gint year_in, month_in, day_in;
+ /* coverity[secure_coding] */
scanned = sscanf (text, "%u-%u-%u", &year_in, &month_in, &day_in);
if (scanned != 3 || year_in < 1 || year_in > 9999 ||
@@ -776,46 +779,39 @@ static void
indicator_datetime_panel_dispose (GObject * object)
{
IndicatorDatetimePanel * self = (IndicatorDatetimePanel *) object;
+ IndicatorDatetimePanelPrivate * priv = self->priv;
- if (self->priv->builder) {
- g_object_unref (self->priv->builder);
- self->priv->builder = NULL;
- }
-
- if (self->priv->proxy) {
- g_object_unref (self->priv->proxy);
- self->priv->proxy = NULL;
- }
+ g_clear_object (&priv->builder);
+ g_clear_object (&priv->proxy);
- if (self->priv->loc_dlg) {
- gtk_widget_destroy (self->priv->loc_dlg);
- self->priv->loc_dlg = NULL;
+ if (priv->loc_dlg) {
+ gtk_widget_destroy (priv->loc_dlg);
+ priv->loc_dlg = NULL;
}
- if (self->priv->save_time_id) {
- g_source_remove (self->priv->save_time_id);
- self->priv->save_time_id = 0;
+ if (priv->save_time_id) {
+ g_source_remove (priv->save_time_id);
+ priv->save_time_id = 0;
}
- if (self->priv->completion) {
- cc_timezone_completion_watch_entry (self->priv->completion, NULL);
- g_object_unref (self->priv->completion);
- self->priv->completion = NULL;
+ if (priv->completion) {
+ cc_timezone_completion_watch_entry (priv->completion, NULL);
+ g_clear_object (&priv->completion);
}
- if (self->priv->tz_entry) {
- gtk_widget_destroy (self->priv->tz_entry);
- self->priv->tz_entry = NULL;
+ if (priv->tz_entry) {
+ gtk_widget_destroy (priv->tz_entry);
+ priv->tz_entry = NULL;
}
- if (self->priv->time_spin) {
- gtk_widget_destroy (self->priv->time_spin);
- self->priv->time_spin = NULL;
+ if (priv->time_spin) {
+ gtk_widget_destroy (priv->time_spin);
+ priv->time_spin = NULL;
}
- if (self->priv->date_spin) {
- gtk_widget_destroy (self->priv->date_spin);
- self->priv->date_spin = NULL;
+ if (priv->date_spin) {
+ gtk_widget_destroy (priv->date_spin);
+ priv->date_spin = NULL;
}
}