Real fix for Coverity 1372362.
[claws.git] / src / plugins / vcalendar / day-view.c
index 53cc7cb520ef7ffe37ddaf1d62809b3aa3f9e284..061da42665fc3b3e63cf20995b2b25d1bbd20822 100644 (file)
@@ -53,9 +53,7 @@
 struct _day_win
 {
     GtkAccelGroup *accel_group;
-#if !GTK_CHECK_VERSION(2,12,0)
-    GtkTooltips   *Tooltips;
-#endif
+
     GtkWidget *Window;
     GtkWidget *Vbox;
 
@@ -147,9 +145,6 @@ void dw_close_window(day_win *dw)
 {
     vcal_view_set_summary_page(dw->Vbox, dw->selsig);
 
-#if !(GTK_CHECK_VERSION(2,12,0))
-    gtk_object_destroy(G_OBJECT(dw->Tooltips));
-#endif
     g_free(dw);
     dw = NULL;
 }
@@ -245,7 +240,7 @@ static void dw_summary_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
                                localtime_r(&t_start, &tm_start);
                                if (tm_start.tm_hour > 2)
                                        gtk_adjustment_set_value(v_adj, 
-                                               (v_adj->upper-v_adj->page_size)/(24/(tm_start.tm_hour-2)));
+                                               ((v_adj->upper-v_adj->page_size)/((gdouble)24/(gdouble)(tm_start.tm_hour-2))));
                                else
                                        gtk_adjustment_set_value(v_adj, 0);
                                gtk_adjustment_changed(v_adj);
@@ -269,7 +264,7 @@ static void day_view_new_meeting_cb(day_win *dw, gpointer data_i, gpointer data_
             || ((tm_date.tm_year%400) == 0)))
         monthdays[1] = 29;
 
-    if (offset_d > monthdays[mon]) {
+    if (offset_d > (int)monthdays[mon]) {
        while (tm_date.tm_mday > 1)
                orage_move_day(&tm_date, 1);
        offset_d -= monthdays[mon];
@@ -365,9 +360,6 @@ static void add_row(day_win *dw, VCalEvent *event, gint days)
     GtkWidget *ev, *lab, *hb;
     time_t t_start, t_end;
     struct tm tm_first, tm_start, tm_end;
-#if !(GTK_CHECK_VERSION(2,12,0))
-       GtkTooltips *tips = dw->Tooltips;
-#endif
 
     /* First clarify timings */
     t_start = icaltime_as_timet(icaltime_from_string(event->dtstart));
@@ -682,20 +674,21 @@ static void build_day_view_colours(day_win *dw)
     gdk_colormap_alloc_color(pic1_cmap, &dw->bg2, FALSE, TRUE);
 
     if (!gdk_color_parse("white", &dw->line_color)) {
+        g_warning("color parse failed: white");
         dw->line_color.red =  239 * (65535/255);
         dw->line_color.green = 235 * (65535/255);
         dw->line_color.blue = 230 * (65535/255);
     }
 
     if (!gdk_color_parse("blue", &dw->fg_sunday)) {
-        g_warning("color parse failed: red\n");
+        g_warning("color parse failed: blue");
         dw->fg_sunday.red = 10 * (65535/255);
         dw->fg_sunday.green = 10 * (65535/255);
         dw->fg_sunday.blue = 255 * (65535/255);
     }
 
     if (!gdk_color_parse("gold", &dw->bg_today)) {
-        g_warning("color parse failed: gold\n");
+        g_warning("color parse failed: gold");
         dw->bg_today.red = 255 * (65535/255);
         dw->bg_today.green = 215 * (65535/255);
         dw->bg_today.blue = 115 * (65535/255);
@@ -749,9 +742,6 @@ static void build_day_view_table(day_win *dw)
     GtkWidget *arrow;
     gchar *tip;
     gint first_col_day = -1;
-#if !(GTK_CHECK_VERSION(2,12,0))
-       GtkTooltips *tips = dw->Tooltips;
-#endif
 
 #ifdef G_OS_WIN32
        if (t < 0)
@@ -824,7 +814,7 @@ static void build_day_view_table(day_win *dw)
         gtk_table_attach(GTK_TABLE(dw->dtable_h), button, i, i+1, 0, 1
                 , (GTK_FILL), (0), 0, 0);
 
-        if (++tm_date.tm_mday == (monthdays[tm_date.tm_mon]+1)) {
+        if (++tm_date.tm_mday == (int)(monthdays[tm_date.tm_mon]+1)) {
             if (++tm_date.tm_mon == 12) {
                 ++tm_date.tm_year;
                 tm_date.tm_mon = 0;
@@ -896,9 +886,7 @@ day_win *create_day_win(FolderItem *item, struct tm tmdate)
     /* initialisation + main window + base vbox */
     dw = g_new0(day_win, 1);
     dw->scroll_pos = -1; /* not set */
-#if !(GTK_CHECK_VERSION(2,12,0))
-    dw->Tooltips = tips;
-#endif
+
     dw->accel_group = gtk_accel_group_new();
     
     while (tmdate.tm_wday != 1)