aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/summary_dlg.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-07-09 11:28:13 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-07-09 11:28:13 +0000
commitdc6b471aad3429e2a03455c99b19ed307c3d220b (patch)
tree892493aaee770d3b8188d19ed344bb3bd2d9e005 /gtk/summary_dlg.c
parent832fc14ad8fcfeec2ceea9cbd8eefede24bcadba (diff)
MSVC: fix some guint64 related compiler errors
strange enough, MSVC cannot convert from guint64 to float, so cast guint64 -> gint64 -> float However, even gint64 might be big enough to prevent us from an overflow :-) svn path=/trunk/; revision=14888
Diffstat (limited to 'gtk/summary_dlg.c')
-rw-r--r--gtk/summary_dlg.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c
index 2fd1317f6d..bb38426407 100644
--- a/gtk/summary_dlg.c
+++ b/gtk/summary_dlg.c
@@ -306,13 +306,15 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* Packet size */
if (summary.packet_count > 0){
g_snprintf(string_buff, SUM_STR_MAX, "%.3f bytes",
- (float)summary.bytes/summary.packet_count);
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ (float) (gint64) (summary.bytes/summary.packet_count) );
} else {
strcpy(string_buff, "");
}
if (summary.dfilter && summary.filtered_count > 0){
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f bytes",
- (float) summary.filtered_bytes/summary.filtered_count);
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ (float) (gint64) summary.filtered_bytes/summary.filtered_count);
} else {
strcpy(string_buff2, "");
}
@@ -329,12 +331,14 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* Bytes per second */
if (seconds > 0){
- g_snprintf(string_buff, SUM_STR_MAX, "%.3f", summary.bytes/seconds);
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ g_snprintf(string_buff, SUM_STR_MAX, "%.3f", ((gint64) summary.bytes)/seconds );
} else {
strcpy(string_buff, "");
}
if (summary.dfilter && disp_seconds > 0){
- g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", summary.filtered_bytes/disp_seconds);
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ g_snprintf(string_buff2, SUM_STR_MAX, "%.3f", ((gint64) summary.filtered_bytes)/disp_seconds );
} else {
strcpy(string_buff2, "");
}
@@ -342,13 +346,15 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* MBit per second */
if (seconds > 0){
- g_snprintf(string_buff, SUM_STR_MAX, "%.3f", summary.bytes * 8.0 / (seconds * 1000.0 * 1000.0));
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ g_snprintf(string_buff, SUM_STR_MAX, "%.3f", ((gint64) summary.bytes) * 8.0 / (seconds * 1000.0 * 1000.0));
} else {
strcpy(string_buff, "");
}
if (summary.dfilter && disp_seconds > 0){
g_snprintf(string_buff2, SUM_STR_MAX, "%.3f",
- summary.filtered_bytes * 8.0 / (disp_seconds * 1000.0 * 1000.0));
+ /* MSVC cannot convert from unsigned __int64 to float, so first convert to signed __int64 */
+ ((gint64) summary.filtered_bytes) * 8.0 / (disp_seconds * 1000.0 * 1000.0));
} else {
strcpy(string_buff2, "");
}