From d0811b3d350ac7c34a07c3f9b8d447b39804aa81 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Wed, 3 Aug 2005 17:32:00 +0000 Subject: [PATCH] Don't assume ints are 32 bits. Fixes a recent Buildbot error. svn path=/trunk/; revision=15200 --- wiretap/i4b_trace.h | 23 ++++++++++++----------- wiretap/i4btrace.c | 8 ++++---- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/wiretap/i4b_trace.h b/wiretap/i4b_trace.h index 2e3fd636c1..2cd4e1b0d2 100644 --- a/wiretap/i4b_trace.h +++ b/wiretap/i4b_trace.h @@ -40,19 +40,20 @@ * structure of the header at the beginning of every trace mbuf *---------------------------------------------------------------------------*/ typedef struct { - unsigned int length; /* length of the following mbuf */ - int unit; /* controller unit number */ - int type; /* type of channel */ + guint32 length; /* length of the following mbuf */ + gint32 unit; /* controller unit number */ + gint32 type; /* type of channel */ #define TRC_CH_I 0 /* Layer 1 INFO's */ #define TRC_CH_D 1 /* D channel */ #define TRC_CH_B1 2 /* B1 channel */ #define TRC_CH_B2 3 /* B2 channel */ - int dir; /* direction */ + gint32 dir; /* direction */ #define FROM_TE 0 /* user -> network */ #define FROM_NT 1 /* network -> user */ - int trunc; /* # of truncated bytes (frame > MCLBYTES) */ - unsigned int count; /* frame count for this unit/type */ - struct timeval time; /* timestamp for this frame */ + gint32 trunc; /* # of truncated bytes (frame > MCLBYTES) */ + guint32 count; /* frame count for this unit/type */ + guint32 ts_sec; /* timestamp seconds */ + guint32 ts_usec; /* timestamp microseconds */ } i4b_trace_hdr_t; #define INFO0 0 /* layer 1 */ @@ -79,10 +80,10 @@ typedef struct { #define TRACE_B_RX 0x10 /* trace B channel on */ typedef struct { - int rxunit; /* unit # for rx frames */ - int rxflags; /* d and/or b channel */ - int txunit; /* unit # for tx frames */ - int txflags; /* d and/or b channel */ + gint32 rxunit; /* unit # for rx frames */ + gint32 rxflags; /* d and/or b channel */ + gint32 txunit; /* unit # for tx frames */ + gint32 txflags; /* d and/or b channel */ } i4b_trace_setupa_t; #define I4B_TRC_SETA _IOW('T', 2, i4b_trace_setupa_t) /* set analyze mode */ diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c index df44b74824..892e5fdb2b 100644 --- a/wiretap/i4btrace.c +++ b/wiretap/i4btrace.c @@ -142,8 +142,8 @@ static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info, wth->phdr.len = length; wth->phdr.caplen = length; - wth->phdr.ts.tv_sec = hdr.time.tv_sec; - wth->phdr.ts.tv_usec = hdr.time.tv_usec; + wth->phdr.ts.tv_sec = hdr.ts_sec; + wth->phdr.ts.tv_usec = hdr.ts_usec; /* * Read the packet data. @@ -244,8 +244,8 @@ i4b_byte_swap_header(wtap *wth, i4b_trace_hdr_t *hdr) hdr->dir = BSWAP32(hdr->dir); hdr->trunc = BSWAP32(hdr->trunc); hdr->count = BSWAP32(hdr->count); - hdr->time.tv_sec = BSWAP32(hdr->time.tv_sec); - hdr->time.tv_usec = BSWAP32(hdr->time.tv_usec); + hdr->ts_sec = BSWAP32(hdr->ts_sec); + hdr->ts_usec = BSWAP32(hdr->ts_usec); } }