Frame numbers are unsigned, and they start at 1; 0 is what's used for

"unknown" for frame numbers.  Note that in epan/frame_data.h, and make
the frame number in experts unsigned, and use 0 for "unknown", and
display it as an unsigned number - and, if it's 0, don't display it at
all.

Fix the signature of "expert_dlg_draw()" to match what a tap's draw
routine's signature is expected to be.

svn path=/trunk/; revision=15760
This commit is contained in:
Guy Harris 2005-09-11 22:25:33 +00:00
parent 51875708f2
commit d8873511a7
5 changed files with 15 additions and 7 deletions

View File

@ -77,7 +77,7 @@ packet_info *pinfo, proto_item *pi, int group, int severity, const char *format,
/* if this packet isn't loaded because of a read filter, don't output anything */
if(pinfo->fd->num == -1) {
if(pinfo->fd->num == 0) {
return;
}
@ -87,7 +87,7 @@ packet_info *pinfo, proto_item *pi, int group, int severity, const char *format,
formatted[sizeof(formatted) - 1] = '\0';
ei = se_alloc(sizeof(expert_info_t));
ei->packet_num = pinfo ? pinfo->fd->num : -1;
ei->packet_num = pinfo ? pinfo->fd->num : 0;
ei->group = group;
ei->severity = severity;
ei->protocol = se_strdup(pinfo->current_proto);

View File

@ -30,7 +30,7 @@
/** only for internal and display use */
typedef struct expert_info_s {
int packet_num;
guint32 packet_num;
int group;
int severity;
gchar * protocol;

View File

@ -44,6 +44,9 @@ typedef struct _color_t /* {
/* XXX - some of this stuff is used only while a packet is being dissected;
should we keep that stuff in the "packet_info" structure, instead, to
save memory? */
/* The frame number is the ordinal number of the frame in the capture, so
it's 1-origin. In various contexts, 0 as a frame number means "frame
number unknown". */
typedef struct _frame_data {
struct _frame_data *next; /* Next element in list */
struct _frame_data *prev; /* Previous element in list */

2
file.c
View File

@ -875,7 +875,7 @@ read_packet(capture_file *cf, long offset)
/* Allocate the next list entry, and add it to the list. */
fdata = g_mem_chunk_alloc(cf->plist_chunk);
fdata->num = -1;
fdata->num = 0;
fdata->next = NULL;
fdata->prev = NULL;
fdata->pfd = NULL;

View File

@ -162,8 +162,9 @@ int expert_dlg_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, co
}
void
expert_dlg_draw(expert_tapdata_t *etd)
expert_dlg_draw(void *data)
{
expert_tapdata_t *etd = data;
int row;
char *strp;
expert_info_t *ei;
@ -192,8 +193,12 @@ expert_dlg_draw(expert_tapdata_t *etd)
gtk_clist_set_row_data(etd->table, row, ei);
/* packet number */
strp=se_strdup_printf("%d", ei->packet_num);
gtk_clist_set_text(etd->table, row, 0, strp);
if(ei->packet_num) {
strp=se_strdup_printf("%u", ei->packet_num);
gtk_clist_set_text(etd->table, row, 0, strp);
} else {
gtk_clist_set_text(etd->table, row, 0, "-");
}
/* severity */
strp=se_strdup(val_to_str(ei->severity, expert_severity_vals, "Unknown severity (%u)"));