diff options
author | rbuj <[email protected]> | 2020-11-16 12:56:57 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-11-25 12:50:28 +0100 |
commit | 4de3e8ae87463027e5365018505748353dc44125 (patch) | |
tree | ab9bbcfe1b10c0c0b82def1bf6e25aaaacf3c059 /baobab/src | |
parent | afec076d38599ecf8005a0e645d65f532dad720e (diff) | |
download | mate-utils-4de3e8ae87463027e5365018505748353dc44125.tar.bz2 mate-utils-4de3e8ae87463027e5365018505748353dc44125.tar.xz |
baobab: Fix conversion warnings
Diffstat (limited to 'baobab/src')
-rw-r--r-- | baobab/src/baobab-cell-renderer-progress.c | 6 | ||||
-rw-r--r-- | baobab/src/baobab-chart.c | 26 | ||||
-rw-r--r-- | baobab/src/baobab-chart.h | 2 | ||||
-rw-r--r-- | baobab/src/baobab-remote-connect-dialog.c | 4 | ||||
-rw-r--r-- | baobab/src/baobab-ringschart.c | 26 | ||||
-rw-r--r-- | baobab/src/baobab-scan.c | 26 | ||||
-rw-r--r-- | baobab/src/baobab-treemap.c | 12 | ||||
-rw-r--r-- | baobab/src/baobab-treeview.c | 4 | ||||
-rw-r--r-- | baobab/src/baobab.c | 4 | ||||
-rw-r--r-- | baobab/src/baobab.h | 4 |
10 files changed, 60 insertions, 54 deletions
diff --git a/baobab/src/baobab-cell-renderer-progress.c b/baobab/src/baobab-cell-renderer-progress.c index 057c7e02..c8bf3ee9 100644 --- a/baobab/src/baobab-cell-renderer-progress.c +++ b/baobab/src/baobab-cell-renderer-progress.c @@ -123,13 +123,13 @@ baobab_cell_renderer_progress_get_size (GtkCellRenderer *cell, gtk_cell_renderer_get_alignment (cell, &xalign, &yalign); if (x_offset) { - *x_offset = xalign * (cell_area->width - calc_width); + *x_offset = (gint) (xalign * (gfloat) (cell_area->width - calc_width)); *x_offset = MAX (*x_offset, 0); } if (y_offset) { - *y_offset = yalign * (cell_area->height - calc_height); + *y_offset = (gint) (yalign * (gfloat) (cell_area->height - calc_height)); *y_offset = MAX (*y_offset, 0); } } @@ -223,7 +223,7 @@ baobab_cell_renderer_progress_render (GtkCellRenderer *cell, cairo_set_source_rgb (cr, 1, 1, 1); cairo_fill (cr); - perc_w = w * MAX (0, cellprogress->priv->perc) / 100; + perc_w = (gint) (w * MAX (0, cellprogress->priv->perc) / 100); cairo_rectangle (cr, is_rtl ? (x + w - perc_w) : x, y, perc_w, h); set_color_according_to_perc (cr, cellprogress->priv->perc); diff --git a/baobab/src/baobab-chart.c b/baobab/src/baobab-chart.c index e484f146..97dc2c77 100644 --- a/baobab/src/baobab-chart.c +++ b/baobab/src/baobab-chart.c @@ -377,7 +377,7 @@ baobab_chart_set_property (GObject *object, switch (prop_id) { case PROP_MAX_DEPTH: - baobab_chart_set_max_depth (GTK_WIDGET (chart), g_value_get_int (value)); + baobab_chart_set_max_depth (GTK_WIDGET (chart), g_value_get_uint (value)); break; case PROP_MODEL: baobab_chart_set_model (GTK_WIDGET (chart), g_value_get_object (value)); @@ -404,7 +404,7 @@ baobab_chart_get_property (GObject *object, switch (prop_id) { case PROP_MAX_DEPTH: - g_value_set_int (value, priv->max_depth); + g_value_set_uint (value, priv->max_depth); break; case PROP_MODEL: g_value_set_object (value, priv->model); @@ -747,7 +747,7 @@ baobab_chart_expose (GtkWidget *chart, cairo_t *cr) { BaobabChartPrivate *priv; gint w, h; - gdouble p, sx, sy; + gdouble p, sx, sy, aux; GtkTreePath *root_path = NULL; GtkTreePath *current_path = NULL; GtkAllocation allocation; @@ -755,10 +755,18 @@ baobab_chart_expose (GtkWidget *chart, cairo_t *cr) GdkRectangle area; gdouble x1, y1, x2, y2; cairo_clip_extents (cr, &x1, &y1, &x2, &y2); - area.x = floor (x1); - area.y = floor (y1); - area.width = ceil (x2) - area.x; - area.height = ceil (y2) - area.y; + + aux = floor (x1); + area.x = (int)aux; + + aux = floor (y1); + area.y = (int)aux; + + aux = ceil (x2); + area.width = (int)aux - area.x; + + aux = ceil (y2); + area.height = (int)aux - area.y; priv = BAOBAB_CHART (chart)->priv; @@ -864,7 +872,7 @@ baobab_chart_interpolate_colors (BaobabChartColor *color, void baobab_chart_get_item_color (BaobabChartColor *color, gdouble rel_position, - gint depth, + guint depth, gboolean highlighted) { gdouble intensity; @@ -880,7 +888,7 @@ baobab_chart_get_item_color (BaobabChartColor *color, *color = level_color; else { - color_number = rel_position / (100/3); + color_number = (int) (rel_position / (100.0/3.0)); next_color_number = (color_number + 1) % 6; baobab_chart_interpolate_colors (color, diff --git a/baobab/src/baobab-chart.h b/baobab/src/baobab-chart.h index 19773024..24f2a0eb 100644 --- a/baobab/src/baobab-chart.h +++ b/baobab/src/baobab-chart.h @@ -142,7 +142,7 @@ void baobab_chart_freeze_updates (GtkWidget *chart); void baobab_chart_thaw_updates (GtkWidget *chart); void baobab_chart_get_item_color (BaobabChartColor *color, gdouble position, - gint depth, + guint depth, gboolean highlighted); void baobab_chart_move_up_root (GtkWidget *chart); void baobab_chart_zoom_in (GtkWidget *chart); diff --git a/baobab/src/baobab-remote-connect-dialog.c b/baobab/src/baobab-remote-connect-dialog.c index e892e06d..9557fb2c 100644 --- a/baobab/src/baobab-remote-connect-dialog.c +++ b/baobab/src/baobab-remote-connect-dialog.c @@ -564,10 +564,6 @@ port_insert_text (GtkEditable *editable, { int pos; - if (new_text_length < 0) { - new_text_length = strlen (new_text); - } - /* Only allow digits to be inserted as port number */ for (pos = 0; pos < new_text_length; pos++) { if (!g_ascii_isdigit (new_text[pos])) { diff --git a/baobab/src/baobab-ringschart.c b/baobab/src/baobab-ringschart.c index cdb18a52..3408ecd5 100644 --- a/baobab/src/baobab-ringschart.c +++ b/baobab/src/baobab-ringschart.c @@ -69,7 +69,7 @@ struct _BaobabRingschartPrivate guint tips_timeout_event; GList *subtip_items; gboolean drawing_subtips; - gint subtip_timeout; + guint subtip_timeout; }; G_DEFINE_TYPE_WITH_PRIVATE (BaobabRingschart, baobab_ringschart, BAOBAB_CHART_TYPE); @@ -132,7 +132,7 @@ baobab_ringschart_init (BaobabRingschart *chart) settings = gtk_settings_get_default (); g_object_get (G_OBJECT (settings), "gtk-tooltip-timeout", &timeout, NULL); - priv->subtip_timeout = 2 * timeout; + priv->subtip_timeout = 2 * (guint)timeout; } static void @@ -308,10 +308,10 @@ baobab_ringschart_get_point_min_rect (gdouble cx, gdouble angle, GdkRectangle *rect) { - gdouble x, y; + int x, y; - x = cx + cos (angle) * radius; - y = cy + sin (angle) * radius; + x = (int) (cx + cos (angle) * radius); + y = (int) (cy + sin (angle) * radius); rect->x = MIN (rect->x, x); rect->y = MIN (rect->y, y); @@ -349,16 +349,16 @@ baobab_ringschart_get_item_rectangle (GtkWidget *chart, baobab_ringschart_get_point_min_rect (cx, cy, r2, a2, &rect); if ( (a1 <= M_PI/2) && (a2 >= M_PI/2) ) - rect.height = MAX (rect.height, cy + sin (M_PI/2) * r2); + rect.height = MAX (rect.height, (int) (cy + sin (M_PI/2) * r2)); if ( (a1 <= M_PI) && (a2 >= M_PI) ) - rect.x = MIN (rect.x, cx + cos (M_PI) * r2); + rect.x = MIN (rect.x, (int) (cx + cos (M_PI) * r2)); if ( (a1 <= M_PI*1.5) && (a2 >= M_PI*1.5) ) - rect.y = MIN (rect.y, cy + sin (M_PI*1.5) * r2); + rect.y = MIN (rect.y, (int) (cy + sin (M_PI*1.5) * r2)); if ( (a1 <= M_PI*2) && (a2 >= M_PI*2) ) - rect.width = MAX (rect.width, cx + cos (M_PI*2) * r2); + rect.width = MAX (rect.width, (int) (cx + cos (M_PI*2) * r2)); rect.width -= rect.x; rect.height -= rect.y; @@ -518,10 +518,10 @@ baobab_ringschart_draw_subfolder_tips (GtkWidget *chart, cairo_t *cr) } /* get the GdkRectangle of the tooltip (with a little padding) */ - _rect.x = tooltip_rect.x - 1; - _rect.y = tooltip_rect.y - 1; - _rect.width = tooltip_rect.width + 2; - _rect.height = tooltip_rect.height + 2; + _rect.x = (int) (tooltip_rect.x - 1.0); + _rect.y = (int) (tooltip_rect.y - 1.0); + _rect.width = (int) (tooltip_rect.width + 2,0); + _rect.height = (int) (tooltip_rect.height + 2.0); /* Check if tooltip overlaps */ if (! gdk_rectangle_intersect (&_rect, &last_rect, NULL)) diff --git a/baobab/src/baobab-scan.c b/baobab/src/baobab-scan.c index 824004ff..369186df 100644 --- a/baobab/src/baobab-scan.c +++ b/baobab/src/baobab-scan.c @@ -125,12 +125,12 @@ baobab_hardlinks_array_free (BaobabHardLinkArray *a) g_array_free (a, TRUE); } -#define BLOCK_SIZE 512 +#define BLOCK_SIZE 512UL struct allsizes { - goffset size; - goffset alloc_size; - gint depth; + guint64 size; + guint64 alloc_size; + guint depth; }; static const char *dir_attributes = \ @@ -213,8 +213,10 @@ loopdir (GFile *file, parse_name = g_file_get_parse_name (file); - if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE)) - retloop.size = g_file_info_get_size (info); + if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE)) { + goffset file_size = g_file_info_get_size (info); + retloop.size = (guint64) file_size; + } if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_BLOCKS)) retloop.alloc_size = BLOCK_SIZE * @@ -247,9 +249,9 @@ loopdir (GFile *file, will be part of the GUI. */ /* prefill the model */ - data.size = 1; - data.alloc_size = 1; - data.depth = count - 1; + data.size = 1UL; + data.alloc_size = 1UL; + data.depth = (gint) count - 1; data.elements = -1; data.display_name = display_name; data.parse_name = parse_name; @@ -289,9 +291,9 @@ loopdir (GFile *file, G_FILE_ATTRIBUTE_UNIX_NLINK) > 1) { if (!baobab_hardlinks_array_add (hla, temp_info)) { - /* we already acconted for it */ - tempHLsize += g_file_info_get_size (temp_info); + goffset file_size = g_file_info_get_size (temp_info); + tempHLsize += (guint64) file_size; g_object_unref (temp_info); continue; } @@ -321,7 +323,7 @@ loopdir (GFile *file, data.parse_name = parse_name; data.size = retloop.size; data.alloc_size = retloop.alloc_size; - data.depth = count - 1; + data.depth = (gint) count - 1; data.elements = elements; data.tempHLsize = tempHLsize; baobab_fill_model (&data); diff --git a/baobab/src/baobab-treemap.c b/baobab/src/baobab-treemap.c index ee25fd87..c86a584a 100644 --- a/baobab/src/baobab-treemap.c +++ b/baobab/src/baobab-treemap.c @@ -284,17 +284,17 @@ baobab_treemap_get_item_rectangle (GtkWidget *chart, _rect = (cairo_rectangle_t *) item->data; - item->rect.x = _rect->x; - item->rect.y = _rect->y; + item->rect.x = (int) _rect->x; + item->rect.y = (int) _rect->y; if (item->depth % 2 != 0) { - item->rect.width = _rect->width - ITEM_PADDING; - item->rect.height = _rect->height; + item->rect.width = (int) _rect->width - ITEM_PADDING; + item->rect.height = (int) _rect->height; } else { - item->rect.width = _rect->width; - item->rect.height = _rect->height - ITEM_PADDING; + item->rect.width = (int) _rect->width; + item->rect.height = (int) _rect->height - ITEM_PADDING; } } diff --git a/baobab/src/baobab-treeview.c b/baobab/src/baobab-treeview.c index 8e5b7839..ed132656 100644 --- a/baobab/src/baobab-treeview.c +++ b/baobab/src/baobab-treeview.c @@ -102,8 +102,8 @@ on_tv_button_press (GtkWidget *widget, GFile *file; gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), - event->x, event->y, - &path, NULL, NULL, NULL); + (gint) event->x, (gint) event->y, + &path, NULL, NULL, NULL); if (!path) return TRUE; diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c index 4ad034ed..78c56901 100644 --- a/baobab/src/baobab.c +++ b/baobab/src/baobab.c @@ -453,7 +453,7 @@ baobab_fill_model (struct chan_data *data) hardlinks = g_string_new (""); if (data->tempHLsize > 0) { - size = g_format_size (data->tempHLsize); + size = g_format_size (data->tempHLsize); g_string_assign (hardlinks, "<i>("); g_string_append (hardlinks, _("contains hardlinks for:")); @@ -1072,7 +1072,7 @@ static void on_chart_type_change (GtkWidget *combo, gpointer user_data) { GtkWidget *chart; - guint active; + gint active; active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo)); diff --git a/baobab/src/baobab.h b/baobab/src/baobab.h index 76b22d6a..97a10de6 100644 --- a/baobab/src/baobab.h +++ b/baobab/src/baobab.h @@ -92,7 +92,7 @@ struct _BaobabApplication { GVolumeMonitor *monitor_vol; GFileMonitor *monitor_home; - gint model_max_depth; + guint model_max_depth; GSettings *ui_settings; GSettings *prefs_settings; @@ -105,7 +105,7 @@ struct chan_data { guint64 size; guint64 alloc_size; guint64 tempHLsize; - guint depth; + gint depth; gint elements; gchar *display_name; gchar *parse_name; |