aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-07-07 22:24:28 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-07-07 22:24:28 +0000
commit897a12c3054afad4f8811c8d439746552a848c17 (patch)
treeccf362dd21a2e4637bca0b9d9c7c36c9d5746dfa
parent5b7df3128b29b513a4a283cff496e41e8372f0f6 (diff)
make the packets/bytes counters 64bit integers to not wrap when using really large captures.
setting packet counter to 64bit is overkill but makes it consistent with the very similar bytes counter. svn path=/trunk/; revision=14872
-rw-r--r--gtk/conversations_table.c30
-rw-r--r--gtk/conversations_table.h8
-rw-r--r--gtk/hostlist_table.c30
-rw-r--r--gtk/hostlist_table.h8
4 files changed, 38 insertions, 38 deletions
diff --git a/gtk/conversations_table.c b/gtk/conversations_table.c
index acf82cf01c..6d0c207abe 100644
--- a/gtk/conversations_table.c
+++ b/gtk/conversations_table.c
@@ -312,7 +312,7 @@ ct_sort_column(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
{
char *text1 = NULL;
char *text2 = NULL;
- int i1, i2;
+ guint64 i1, i2;
const GtkCListRow *row1 = ptr1;
const GtkCListRow *row2 = ptr2;
@@ -332,8 +332,8 @@ ct_sort_column(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
case 7:
case 8:
case 9:
- i1=atoi(text1);
- i2=atoi(text2);
+ sscanf(text1, "%" PRIu64, &i1);
+ sscanf(text2, "%" PRIu64, &i2);
return i1-i2;
}
g_assert_not_reached();
@@ -1077,21 +1077,21 @@ draw_ct_table_data(conversations_table *ct)
j=gtk_clist_find_row_from_data(ct->table, (gpointer)i);
- g_snprintf(str, 16, "%u", ct->conversations[i].tx_frames+ct->conversations[i].rx_frames);
+ g_snprintf(str, 16, "%" PRIu64, ct->conversations[i].tx_frames+ct->conversations[i].rx_frames);
gtk_clist_set_text(ct->table, j, 4, str);
- g_snprintf(str, 16, "%u", ct->conversations[i].tx_bytes+ct->conversations[i].rx_bytes);
+ g_snprintf(str, 16, "%" PRIu64, ct->conversations[i].tx_bytes+ct->conversations[i].rx_bytes);
gtk_clist_set_text(ct->table, j, 5, str);
- g_snprintf(str, 16, "%u", ct->conversations[i].tx_frames);
+ g_snprintf(str, 16, "%" PRIu64, ct->conversations[i].tx_frames);
gtk_clist_set_text(ct->table, j, 6, str);
- g_snprintf(str, 16, "%u", ct->conversations[i].tx_bytes);
+ g_snprintf(str, 16, "%" PRIu64, ct->conversations[i].tx_bytes);
gtk_clist_set_text(ct->table, j, 7, str);
- g_snprintf(str, 16, "%u", ct->conversations[i].rx_frames);
+ g_snprintf(str, 16, "%" PRIu64, ct->conversations[i].rx_frames);
gtk_clist_set_text(ct->table, j, 8, str);
- g_snprintf(str, 16, "%u", ct->conversations[i].rx_bytes);
+ g_snprintf(str, 16, "%" PRIu64, ct->conversations[i].rx_bytes);
gtk_clist_set_text(ct->table, j, 9, str);
}
@@ -1623,19 +1623,19 @@ add_conversation_table_data(conversations_table *ct, const address *src, const a
entries[2] = "";
entries[3] = "";
- g_snprintf(frames, 16, "%u", conversation->tx_frames+conversation->rx_frames);
+ g_snprintf(frames, 16, "%" PRIu64, conversation->tx_frames+conversation->rx_frames);
entries[4]=frames;
- g_snprintf(bytes, 16, "%u", conversation->tx_bytes+conversation->rx_bytes);
+ g_snprintf(bytes, 16, "%" PRIu64, conversation->tx_bytes+conversation->rx_bytes);
entries[5]=bytes;
- g_snprintf(txframes, 16, "%u", conversation->tx_frames);
+ g_snprintf(txframes, 16, "%" PRIu64, conversation->tx_frames);
entries[6]=txframes;
- g_snprintf(txbytes, 16, "%u", conversation->tx_bytes);
+ g_snprintf(txbytes, 16, "%" PRIu64, conversation->tx_bytes);
entries[7]=txbytes;
- g_snprintf(rxframes, 16, "%u", conversation->rx_frames);
+ g_snprintf(rxframes, 16, "%" PRIu64, conversation->rx_frames);
entries[8]=rxframes;
- g_snprintf(rxbytes, 16, "%u", conversation->rx_bytes);
+ g_snprintf(rxbytes, 16, "%" PRIu64, conversation->rx_bytes);
entries[9]=rxbytes;
gtk_clist_insert(ct->table, conversation_idx, entries);
diff --git a/gtk/conversations_table.h b/gtk/conversations_table.h
index 057f66b688..c4c8af2c51 100644
--- a/gtk/conversations_table.h
+++ b/gtk/conversations_table.h
@@ -39,10 +39,10 @@ typedef struct _conversation_t {
guint32 src_port; /**< source port */
guint32 dst_port; /**< destination port */
- guint32 rx_frames; /**< number of received packets */
- guint32 tx_frames; /**< number of transmitted packets */
- guint32 rx_bytes; /**< number of received bytes */
- guint32 tx_bytes; /**< number of transmitted bytes */
+ guint64 rx_frames; /**< number of received packets */
+ guint64 tx_frames; /**< number of transmitted packets */
+ guint64 rx_bytes; /**< number of received bytes */
+ guint64 tx_bytes; /**< number of transmitted bytes */
} conversation_t;
/** Conversation widget */
diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c
index bcc68ee8f7..e3483d2082 100644
--- a/gtk/hostlist_table.c
+++ b/gtk/hostlist_table.c
@@ -211,7 +211,7 @@ hostlist_sort_column(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
{
char *text1 = NULL;
char *text2 = NULL;
- int i1, i2;
+ guint64 i1, i2;
const GtkCListRow *row1 = ptr1;
const GtkCListRow *row2 = ptr2;
@@ -229,8 +229,8 @@ hostlist_sort_column(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
case 5:
case 6:
case 7:
- i1=atoi(text1);
- i2=atoi(text2);
+ sscanf(text1, "%" PRIu64, &i1);
+ sscanf(text2, "%" PRIu64, &i2);
return i1-i2;
}
g_assert_not_reached();
@@ -540,21 +540,21 @@ draw_hostlist_table_data(hostlist_table *hl)
j=gtk_clist_find_row_from_data(hl->table, (gpointer)i);
- g_snprintf(str, 16, "%u", hl->hosts[i].tx_frames+hl->hosts[i].rx_frames);
+ g_snprintf(str, 16, "%" PRIu64, hl->hosts[i].tx_frames+hl->hosts[i].rx_frames);
gtk_clist_set_text(hl->table, j, 2, str);
- g_snprintf(str, 16, "%u", hl->hosts[i].tx_bytes+hl->hosts[i].rx_bytes);
+ g_snprintf(str, 16, "%" PRIu64, hl->hosts[i].tx_bytes+hl->hosts[i].rx_bytes);
gtk_clist_set_text(hl->table, j, 3, str);
- g_snprintf(str, 16, "%u", hl->hosts[i].tx_frames);
+ g_snprintf(str, 16, "%" PRIu64, hl->hosts[i].tx_frames);
gtk_clist_set_text(hl->table, j, 4, str);
- g_snprintf(str, 16, "%u", hl->hosts[i].tx_bytes);
+ g_snprintf(str, 16, "%" PRIu64, hl->hosts[i].tx_bytes);
gtk_clist_set_text(hl->table, j, 5, str);
- g_snprintf(str, 16, "%u", hl->hosts[i].rx_frames);
+ g_snprintf(str, 16, "%" PRIu64, hl->hosts[i].rx_frames);
gtk_clist_set_text(hl->table, j, 6, str);
- g_snprintf(str, 16, "%u", hl->hosts[i].rx_bytes);
+ g_snprintf(str, 16, "%" PRIu64, hl->hosts[i].rx_bytes);
gtk_clist_set_text(hl->table, j, 7, str);
}
@@ -1046,19 +1046,19 @@ add_hostlist_table_data(hostlist_table *hl, const address *addr, guint32 port, g
entries[0]="";
entries[1]="";
- g_snprintf(frames, 16, "%u", talker->tx_frames+talker->rx_frames);
+ g_snprintf(frames, 16, "%" PRIu64, talker->tx_frames+talker->rx_frames);
entries[2]=frames;
- g_snprintf(bytes, 16, "%u", talker->tx_bytes+talker->rx_bytes);
+ g_snprintf(bytes, 16, "%" PRIu64, talker->tx_bytes+talker->rx_bytes);
entries[3]=bytes;
- g_snprintf(txframes, 16, "%u", talker->tx_frames);
+ g_snprintf(txframes, 16, "%" PRIu64, talker->tx_frames);
entries[4]=txframes;
- g_snprintf(txbytes, 16, "%u", talker->tx_bytes);
+ g_snprintf(txbytes, 16, "%" PRIu64, talker->tx_bytes);
entries[5]=txbytes;
- g_snprintf(rxframes, 16, "%u", talker->rx_frames);
+ g_snprintf(rxframes, 16, "%" PRIu64, talker->rx_frames);
entries[6]=rxframes;
- g_snprintf(rxbytes, 16, "%u", talker->rx_bytes);
+ g_snprintf(rxbytes, 16, "%" PRIu64, talker->rx_bytes);
entries[7]=rxbytes;
gtk_clist_insert(hl->table, talker_idx, entries);
diff --git a/gtk/hostlist_table.h b/gtk/hostlist_table.h
index 73ae442e50..cea976aabb 100644
--- a/gtk/hostlist_table.h
+++ b/gtk/hostlist_table.h
@@ -36,10 +36,10 @@ typedef struct _hostlist_talker_t {
guint32 port_type; /**< port_type (e.g. PT_TCP) */
guint32 port; /**< port */
- guint32 rx_frames; /**< number of received packets */
- guint32 tx_frames; /**< number of transmitted packets */
- guint32 rx_bytes; /**< number of received bytes */
- guint32 tx_bytes; /**< number of transmitted bytes */
+ guint64 rx_frames; /**< number of received packets */
+ guint64 tx_frames; /**< number of transmitted packets */
+ guint64 rx_bytes; /**< number of received bytes */
+ guint64 tx_bytes; /**< number of transmitted bytes */
} hostlist_talker_t;
/** Hostlist widget */