diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2003-12-23 00:16:46 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2003-12-23 00:16:46 +0000 |
commit | 467c05b3eab962751172f9b4ae60717bb9b5a9a7 (patch) | |
tree | c1e494ef15d9d99575a97407dbcb12275ec5b1f0 | |
parent | 447e29ec3615efb66fb733f21dc02a91d30fe0fa (diff) |
removed some MSVC warnings (conversions between double/float and int)
svn path=/trunk/; revision=9422
-rw-r--r-- | gtk/capture_dlg.c | 22 | ||||
-rw-r--r-- | gtk/gui_prefs.c | 6 | ||||
-rw-r--r-- | gtk/io_stat.c | 14 | ||||
-rw-r--r-- | gtk/progress_dlg.c | 16 | ||||
-rw-r--r-- | gtk/tcp_graph.c | 60 | ||||
-rw-r--r-- | wiretap/netmon.c | 6 |
6 files changed, 62 insertions, 62 deletions
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c index 718e757bbe..1b58b2b746 100644 --- a/gtk/capture_dlg.c +++ b/gtk/capture_dlg.c @@ -1,7 +1,7 @@ /* capture_dlg.c * Routines for packet capture windows * - * $Id: capture_dlg.c,v 1.90 2003/12/21 12:17:58 ulfl Exp $ + * $Id: capture_dlg.c,v 1.91 2003/12/23 00:16:45 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -382,7 +382,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_box_pack_start(GTK_BOX(snap_hb), snap_cb, FALSE, FALSE, 0); gtk_widget_show(snap_cb); - snap_adj = (GtkAdjustment *) gtk_adjustment_new((float) capture_opts.snaplen, + snap_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat) capture_opts.snaplen, MIN_PACKET_SIZE, WTAP_MAX_PACKET_SIZE, 1.0, 10.0, 0.0); snap_sb = gtk_spin_button_new (snap_adj, 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (snap_sb), TRUE); @@ -477,7 +477,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_box_pack_start(GTK_BOX(ringbuffer_hb), ringbuffer_nbf_lb, FALSE, FALSE, 6); gtk_widget_show(ringbuffer_nbf_lb); - ringbuffer_nbf_adj = (GtkAdjustment *) gtk_adjustment_new((float) capture_opts.ringbuffer_num_files, + ringbuffer_nbf_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat) capture_opts.ringbuffer_num_files, RINGBUFFER_MIN_NUM_FILES, RINGBUFFER_MAX_NUM_FILES, 1.0, 10.0, 0.0); ringbuffer_nbf_sb = gtk_spin_button_new (ringbuffer_nbf_adj, 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (ringbuffer_nbf_sb), TRUE); @@ -499,8 +499,8 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) FALSE, FALSE, 0); gtk_widget_show(ring_duration_cb); - ring_duration_adj = (GtkAdjustment *)gtk_adjustment_new(capture_opts.ringbuffer_duration, - 1, INT_MAX, 1.0, 10.0, 0.0); + ring_duration_adj = (GtkAdjustment *)gtk_adjustment_new((gfloat)capture_opts.ringbuffer_duration, + 1, (gfloat)INT_MAX, 1.0, 10.0, 0.0); ring_duration_sb = gtk_spin_button_new (ring_duration_adj, 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (ring_duration_sb), TRUE); WIDGET_SET_SIZE(ring_duration_sb, 80, -1); @@ -570,8 +570,8 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_box_pack_start(GTK_BOX(count_hb), count_cb, FALSE, FALSE, 0); gtk_widget_show(count_cb); - count_adj = (GtkAdjustment *) gtk_adjustment_new(capture_opts.autostop_count, - 1, INT_MAX, 1.0, 10.0, 0.0); + count_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat)capture_opts.autostop_count, + 1, (gfloat)INT_MAX, 1.0, 10.0, 0.0); count_sb = gtk_spin_button_new (count_adj, 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (count_sb), TRUE); WIDGET_SET_SIZE(count_sb, 80, -1); @@ -595,8 +595,8 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_box_pack_start(GTK_BOX(filesize_hb), filesize_cb, FALSE, FALSE, 0); gtk_widget_show(filesize_cb); - filesize_adj = (GtkAdjustment *) gtk_adjustment_new(capture_opts.autostop_filesize, - 1, INT_MAX, 1.0, 10.0, 0.0); + filesize_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat)capture_opts.autostop_filesize, + 1, (gfloat)INT_MAX, 1.0, 10.0, 0.0); filesize_sb = gtk_spin_button_new (filesize_adj, 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (filesize_sb), TRUE); WIDGET_SET_SIZE(filesize_sb, 80, -1); @@ -620,8 +620,8 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_box_pack_start(GTK_BOX(duration_hb), duration_cb, FALSE, FALSE, 0); gtk_widget_show(duration_cb); - duration_adj = (GtkAdjustment *) gtk_adjustment_new(capture_opts.autostop_duration, - 1, INT_MAX, 1.0, 10.0, 0.0); + duration_adj = (GtkAdjustment *) gtk_adjustment_new((gfloat)capture_opts.autostop_duration, + 1, (gfloat)INT_MAX, 1.0, 10.0, 0.0); duration_sb = gtk_spin_button_new (duration_adj, 0, 0); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (duration_sb), TRUE); WIDGET_SET_SIZE(duration_sb, 80, -1); diff --git a/gtk/gui_prefs.c b/gtk/gui_prefs.c index 39933db2c0..6adbd6a6d3 100644 --- a/gtk/gui_prefs.c +++ b/gtk/gui_prefs.c @@ -1,7 +1,7 @@ /* gui_prefs.c * Dialog box for GUI preferences * - * $Id: gui_prefs.c,v 1.46 2003/11/19 00:10:25 ulfl Exp $ + * $Id: gui_prefs.c,v 1.47 2003/12/23 00:16:45 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -644,9 +644,9 @@ typedef struct { static color_info_t color_info[MAX_HANDLED_COL] = { #define MFG_IDX 0 - { {0.0, 0.0, 0.0, 0.0}, "Marked frame foreground" }, + { {0, 0, 0, 0}, "Marked frame foreground" }, #define MBG_IDX 1 - { {0.0, 0.0, 0.0, 0.0}, "Marked frame background" } + { {0, 0, 0, 0}, "Marked frame background" } }; #define SAMPLE_MARKED_TEXT "Sample marked frame text\n" diff --git a/gtk/io_stat.c b/gtk/io_stat.c index 41a31681ce..13e6701104 100644 --- a/gtk/io_stat.c +++ b/gtk/io_stat.c @@ -1,7 +1,7 @@ /* io_stat.c * io_stat 2002 Ronnie Sahlberg * - * $Id: io_stat.c,v 1.51 2003/12/17 22:13:07 guy Exp $ + * $Id: io_stat.c,v 1.52 2003/12/23 00:16:46 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -892,13 +892,13 @@ gtk_iostat_draw(void *g) /* update the scrollbar */ - io->scrollbar_adjustment->upper=io->max_interval; - io->scrollbar_adjustment->step_increment=(last_interval-first_interval)/10; - io->scrollbar_adjustment->page_increment=(last_interval-first_interval); + io->scrollbar_adjustment->upper=(gfloat) io->max_interval; + io->scrollbar_adjustment->step_increment=(gfloat) ((last_interval-first_interval)/10); + io->scrollbar_adjustment->page_increment=(gfloat) (last_interval-first_interval); if((last_interval-first_interval)*100 < io->max_interval){ - io->scrollbar_adjustment->page_size=io->max_interval/100; + io->scrollbar_adjustment->page_size=(gfloat) (io->max_interval/100); } else { - io->scrollbar_adjustment->page_size=(last_interval-first_interval); + io->scrollbar_adjustment->page_size=(gfloat) (last_interval-first_interval); } io->scrollbar_adjustment->value=last_interval-io->scrollbar_adjustment->page_size; gtk_adjustment_changed(io->scrollbar_adjustment); @@ -1081,7 +1081,7 @@ scrollbar_changed(GtkWidget *widget _U_, gpointer data) io_stat_t *io=(io_stat_t *)data; guint32 mi; - mi=io->scrollbar_adjustment->value+io->scrollbar_adjustment->page_size; + mi=(guint32) (io->scrollbar_adjustment->value+io->scrollbar_adjustment->page_size); if(io->last_interval==mi){ return TRUE; } diff --git a/gtk/progress_dlg.c b/gtk/progress_dlg.c index 38d9fb863e..e56dc8c36d 100644 --- a/gtk/progress_dlg.c +++ b/gtk/progress_dlg.c @@ -1,7 +1,7 @@ /* progress_dlg.c * Routines for progress-bar (modal) dialog * - * $Id: progress_dlg.c,v 1.17 2002/11/11 15:39:06 oabad Exp $ + * $Id: progress_dlg.c,v 1.18 2003/12/23 00:16:46 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -132,27 +132,27 @@ create_progress_dlg(const gchar *task_title, const gchar *item_title, title_lb = gtk_label_new(item_title); gtk_box_pack_start(GTK_BOX(dynamic_vb), title_lb, FALSE, TRUE, 3); gtk_misc_set_alignment(GTK_MISC(title_lb), 0.0, 0.0); - gtk_misc_set_padding(GTK_MISC(title_lb), 0.0, 0.0); + gtk_misc_set_padding(GTK_MISC(title_lb), 0, 0); /* same for "Status" */ status_lb = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(dynamic_vb), status_lb, FALSE, TRUE, 3); gtk_misc_set_alignment(GTK_MISC(status_lb), 0.0, 0.0); - gtk_misc_set_padding(GTK_MISC(status_lb), 0.0, 0.0); + gtk_misc_set_padding(GTK_MISC(status_lb), 0, 0); dlg->status_lb = (GtkLabel *) status_lb; /* same for "Elapsed Time" */ elapsed_lb = gtk_label_new("00:00"); gtk_box_pack_start(GTK_BOX(dynamic_vb), elapsed_lb, FALSE, TRUE, 3); gtk_misc_set_alignment(GTK_MISC(elapsed_lb), 0.0, 0.0); - gtk_misc_set_padding(GTK_MISC(elapsed_lb), 0.0, 0.0); + gtk_misc_set_padding(GTK_MISC(elapsed_lb), 0, 0); dlg->elapsed_lb = (GtkLabel *) elapsed_lb; /* same for "Time Left" */ time_left_lb = gtk_label_new("--:--"); gtk_box_pack_start(GTK_BOX(dynamic_vb), time_left_lb, FALSE, TRUE, 3); gtk_misc_set_alignment(GTK_MISC(time_left_lb), 0.0, 0.0); - gtk_misc_set_padding(GTK_MISC(time_left_lb), 0.0, 0.0); + gtk_misc_set_padding(GTK_MISC(time_left_lb), 0, 0); dlg->time_left_lb = (GtkLabel *) time_left_lb; /* @@ -336,8 +336,8 @@ update_progress_dlg(progdlg_t *dlg, gfloat percentage, gchar *status) delta_time = (time_now.tv_sec - dlg->start_time.tv_sec) * 1e6 + time_now.tv_usec - dlg->start_time.tv_usec; - ul_percentage = percentage * 100; - ul_elapsed = delta_time / 1000 / 1000; + ul_percentage = (gulong) (percentage * 100); + ul_elapsed = (gulong) (delta_time / 1000 / 1000); /* update labels */ g_snprintf(tmp, sizeof(tmp), "%lu%% of %s", ul_percentage, dlg->title); @@ -355,7 +355,7 @@ update_progress_dlg(progdlg_t *dlg, gfloat percentage, gchar *status) /* show "Time Left" only, * if at least 5% and 3 seconds running (to get a useful estimation) */ if (ul_percentage >= 5 && delta_time >= 3 * 1e6) { - ul_left = (delta_time / percentage - delta_time) / 1000 / 1000; + ul_left = (gulong) ((delta_time / percentage - delta_time) / 1000 / 1000); g_snprintf(tmp, sizeof(tmp), "%02lu:%02lu", ul_left / 60, ul_left % 60); diff --git a/gtk/tcp_graph.c b/gtk/tcp_graph.c index 91046a687d..9075582033 100644 --- a/gtk/tcp_graph.c +++ b/gtk/tcp_graph.c @@ -3,7 +3,7 @@ * By Pavel Mores <pvl@uh.cz> * Win32 port: rwh@unifiedtech.com * - * $Id: tcp_graph.c,v 1.39 2003/12/17 22:11:43 ulfl Exp $ + * $Id: tcp_graph.c,v 1.40 2003/12/23 00:16:46 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1115,12 +1115,12 @@ static GtkWidget *control_panel_create_zoom_group (struct graph *g) zoom_separator2 = gtk_hseparator_new (); - zoom_h_adj = (GtkAdjustment * )gtk_adjustment_new (1.2, 1.0, 5, 0.1, 1, 0); + zoom_h_adj = (GtkAdjustment * )gtk_adjustment_new ((gfloat)1.2, 1.0, 5, (gfloat)0.1, 1, 0); zoom_h_step = gtk_spin_button_new (zoom_h_adj, 0, 1); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (zoom_h_step), TRUE); zoom_h_step_label = gtk_label_new ("Horizontal step:"); - zoom_v_adj = (GtkAdjustment * )gtk_adjustment_new (1.2, 1.0, 5, 0.1, 1, 0); + zoom_v_adj = (GtkAdjustment * )gtk_adjustment_new ((gfloat)1.2, 1.0, 5, (gfloat)0.1, 1, 0); zoom_v_step = gtk_spin_button_new (zoom_v_adj, 0, 1); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (zoom_v_step), TRUE); zoom_v_step_label = gtk_label_new ("Vertical step:"); @@ -1296,11 +1296,11 @@ static GtkWidget *control_panel_create_magnify_group (struct graph *g) GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 5, 0); mag_h_zoom_label = gtk_label_new ("Horizontal:"); - mag_h_zoom_adj = (GtkAdjustment *)gtk_adjustment_new(10.0,1.0,25.0,0.1,1,0); + mag_h_zoom_adj = (GtkAdjustment *)gtk_adjustment_new(10.0, 1.0, 25.0, (gfloat)0.1, 1, 0); mag_h_zoom = gtk_spin_button_new (mag_h_zoom_adj, 0, 1); mag_v_zoom_label = gtk_label_new ("Vertical:"); - mag_v_zoom_adj = (GtkAdjustment *)gtk_adjustment_new(10.0,1.0,25.0,0.1,1,0); + mag_v_zoom_adj = (GtkAdjustment *)gtk_adjustment_new(10.0, 1.0, 25.0, (gfloat)0.1, 1, 0); mag_v_zoom = gtk_spin_button_new (mag_v_zoom_adj, 0, 1); mag_zoom_same = gtk_check_button_new_with_label ("Keep them the same"); @@ -2145,9 +2145,9 @@ static void draw_element_arc (struct graph *g, struct element *e) int x1, x2, y1, y2; x1 = (int )rint (e->p.arc.dim.x + g->geom.x - g->wp.x); - x2 = e->p.arc.dim.width; + x2 = (int )e->p.arc.dim.width; y1 = (int )rint (g->geom.height-1 - e->p.arc.dim.y + g->geom.y - g->wp.y); - y2 = e->p.arc.dim.height; + y2 = (int )e->p.arc.dim.height; if (x1<-x2 || x1>=g->wp.width || y1<-y2 || y1>=g->wp.height) return; debug(DBS_GRAPH_DRAWING) printf ("arc: (%d,%d)->(%d,%d)\n", x1, y1, x2, y2); @@ -2230,13 +2230,13 @@ static void v_axis_pixmap_draw (struct axis *axis) /* major ticks */ major_tick = axis->major * g->zoom.y; - imin = (g->geom.height - offset + corr - g->wp.height) / major_tick + 1; - imax = (g->geom.height - offset + corr) / major_tick; + imin = (int) ((g->geom.height - offset + corr - g->wp.height) / major_tick + 1); + imax = (int) ((g->geom.height - offset + corr) / major_tick); for (i=imin; i <= imax; i++) { gint w, h; char desc[32]; - int y = g->geom.height-1 - (int )rint (i * major_tick) - - offset + corr + axis->s.y; + int y = (int) (g->geom.height-1 - (int )rint (i * major_tick) - + offset + corr + axis->s.y); debug(DBS_AXES_DRAWING) printf("%f @ %d\n", i*axis->major + fl, y); @@ -2261,11 +2261,11 @@ static void v_axis_pixmap_draw (struct axis *axis) /* minor ticks */ if (axis->minor) { double minor_tick = axis->minor * g->zoom.y; - imin = (g->geom.height - offset + corr - g->wp.height)/minor_tick + 1; - imax = (g->geom.height - offset + corr) / minor_tick; + imin = (int) ((g->geom.height - offset + corr - g->wp.height)/minor_tick + 1); + imax = (int) ((g->geom.height - offset + corr) / minor_tick); for (i=imin; i <= imax; i++) { - int y = g->geom.height-1 - (int )rint (i*minor_tick) - - offset + corr + axis->s.y; + int y = (int) (g->geom.height-1 - (int )rint (i*minor_tick) - + offset + corr + axis->s.y); debug (DBS_AXES_DRAWING) printf ("%f @ %d\n", i*axis->minor+fl, y); if (y > 0 && y < axis->p.height) @@ -2336,12 +2336,12 @@ static void h_axis_pixmap_draw (struct axis *axis) /* major ticks */ major_tick = axis->major*g->zoom.x; - imin = (offset + corr) / major_tick + 1; - imax = (offset + corr + axis->s.width) / major_tick; + imin = (int) ((offset + corr) / major_tick + 1); + imax = (int) ((offset + corr + axis->s.width) / major_tick); for (i=imin; i <= imax; i++) { char desc[32]; int w, h; - int x = (int )rint (i * major_tick) - offset - corr; + int x = (int ) (rint (i * major_tick) - offset - corr); /* printf ("%f @ %d\n", i*axis->major + fl, x); */ if (x < 0 || x > axis->s.width) @@ -2364,10 +2364,10 @@ static void h_axis_pixmap_draw (struct axis *axis) if (axis->minor > 0) { /* minor ticks */ minor_tick = axis->minor*g->zoom.x; - imin = (offset + corr) / minor_tick + 1; - imax = (offset + corr + g->wp.width) / minor_tick; + imin = (int) ((offset + corr) / minor_tick + 1); + imax = (int) ((offset + corr + g->wp.width) / minor_tick); for (i=imin; i <= imax; i++) { - int x = (int )rint (i * minor_tick) - offset - corr; + int x = (int) (rint (i * minor_tick) - offset - corr); if (x > 0 && x < axis->s.width) gdk_draw_line (axis->pixmap[not_disp], g->fg_gc, x, 0, x, 8); } @@ -2859,10 +2859,10 @@ static gint configure_event (GtkWidget *widget, GdkEventConfigure *event) /* g->zoom.initial.x = g->zoom.x; */ /* g->zoom.initial.y = g->zoom.y; */ - g->geom.x = g->wp.x - (double )g->geom.width/cur_g_width * - (g->wp.x - g->geom.x); - g->geom.y = g->wp.y - (double )g->geom.height/cur_g_height * - (g->wp.y - g->geom.y); + g->geom.x = (int) (g->wp.x - (double )g->geom.width/cur_g_width * + (g->wp.x - g->geom.x)); + g->geom.y = (int) (g->wp.y - (double )g->geom.height/cur_g_height * + (g->wp.y - g->geom.y)); #if 0 printf ("configure: graph: (%d,%d), (%d,%d); viewport: (%d,%d), (%d,%d); " "zooms: (%f,%f)\n", g->geom.x, g->geom.y, g->geom.width, @@ -3029,8 +3029,8 @@ static gint motion_notify_event (GtkWidget *widget, GdkEventMotion *event) if (event->is_hint) gdk_window_get_pointer (event->window, &x, &y, &state); else { - x = event->x; - y = event->y; + x = (int) event->x; + y = (int) event->y; state = event->state; } @@ -3340,7 +3340,7 @@ static void tseq_stevens_make_elmtlist (struct graph *g) struct segment *tmp; struct element *elements, *e; double x0 = g->bounds.x0, y0 = g->bounds.y0; - guint32 seq_base = y0; + guint32 seq_base = (guint32) y0; guint32 seq_cur; debug(DBS_FENTRY) puts ("tseq_stevens_make_elmtlist()"); @@ -3500,7 +3500,7 @@ static void tseq_tcptrace_make_elmtlist (struct graph *g) x0 = g->bounds.x0; y0 = g->bounds.y0; - seq_base = y0; + seq_base = (guint32) y0; /* initialize "previous" values */ for (tmp=g->segments; tmp; tmp=tmp->next) if (!compare_headers (g->current, tmp, COMPARE_CURR_DIR)) @@ -3889,7 +3889,7 @@ static void rtt_make_elmtlist (struct graph *g) struct segment *tmp; struct unack *unack = NULL, *u; struct element *elements, *e; - guint32 seq_base = g->bounds.x0; + guint32 seq_base = (guint32) g->bounds.x0; debug(DBS_FENTRY) puts ("rtt_make_elmtlist()"); diff --git a/wiretap/netmon.c b/wiretap/netmon.c index 897ca5d669..2beefcdbe2 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -1,6 +1,6 @@ /* netmon.c * - * $Id: netmon.c,v 1.66 2003/11/06 22:45:28 guy Exp $ + * $Id: netmon.c,v 1.67 2003/12/23 00:15:02 ulfl Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -691,8 +691,8 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, */ t = (phdr->ts.tv_sec - netmon->first_record_time.tv_sec)*1000000.0 + (phdr->ts.tv_usec - netmon->first_record_time.tv_usec); - time_high = t/4294967296.0; - time_low = t - (time_high*4294967296.0); + time_high = (guint32) (t/4294967296.0); + time_low = (guint32) (t - (time_high*4294967296.0)); rec_2_x_hdr.ts_delta_lo = htolel(time_low); rec_2_x_hdr.ts_delta_hi = htolel(time_high); rec_2_x_hdr.orig_len = htolel(phdr->len + atm_hdrsize); |