Don't pass globals as arguments to k12text_set_headers(), just use the

globals directly.  If we ever manage to make them *not* globals (which
might only be possible with newer versions of Flex), then we can do
better.

Get rid of an unused variable.

Squelch a 64-bit-to-32-bit conversion warning.

svn path=/trunk/; revision=49396
This commit is contained in:
Guy Harris 2013-05-17 23:53:44 +00:00
parent 4c679fb01a
commit ed76ed8c88
1 changed files with 5 additions and 7 deletions

View File

@ -185,8 +185,7 @@ static void finalize_frame(void) {
/* Fill in pkthdr */ /* Fill in pkthdr */
static void static void
k12text_set_headers(gint encap, guint h, guint m, guint s, guint ms, guint ns, k12text_set_headers(struct wtap_pkthdr *phdr)
struct wtap_pkthdr *phdr)
{ {
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN; phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
@ -198,7 +197,7 @@ k12text_set_headers(gint encap, guint h, guint m, guint s, guint ms, guint ns,
phdr->pkt_encap = g_encap; phdr->pkt_encap = g_encap;
/* The file-encap is WTAP_ENCAP_PER_PACKET */ /* The file-encap is WTAP_ENCAP_PER_PACKET */
switch(encap) { switch(g_encap) {
case WTAP_ENCAP_ETHERNET: case WTAP_ENCAP_ETHERNET:
phdr->pseudo_header.eth.fcs_len = 0; phdr->pseudo_header.eth.fcs_len = 0;
break; break;
@ -283,7 +282,7 @@ k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset)
*data_offset = k12text->next_frame_offset; /* file position for beginning of this frame */ *data_offset = k12text->next_frame_offset; /* file position for beginning of this frame */
k12text->next_frame_offset += file_bytes_read; /* file position after end of this frame */ k12text->next_frame_offset += file_bytes_read; /* file position after end of this frame */
k12text_set_headers(g_encap, g_h, g_m, g_s, g_ms, g_ns, &wth->phdr); k12text_set_headers(&wth->phdr);
buffer_assure_space(wth->frame_buffer, wth->phdr.caplen); buffer_assure_space(wth->frame_buffer, wth->phdr.caplen);
memcpy(buffer_start_ptr(wth->frame_buffer), bb, wth->phdr.caplen); memcpy(buffer_start_ptr(wth->frame_buffer), bb, wth->phdr.caplen);
@ -294,7 +293,6 @@ k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset)
static gboolean static gboolean
k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, char **err_info) k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, guint8 *pd, int length, int *err, char **err_info)
{ {
union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
if ( file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) { if ( file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
return FALSE; return FALSE;
} }
@ -322,7 +320,7 @@ k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, guint8 *
return FALSE; return FALSE;
} }
k12text_set_headers(g_encap, g_h, g_m, g_s, g_ms, g_ns, phdr); k12text_set_headers(phdr);
memcpy(pd, bb, length); memcpy(pd, bb, length);
@ -375,7 +373,7 @@ k12text_dump(wtap_dumper *wdh _U_, const struct wtap_pkthdr *phdr,
#define K12BUF_SIZE 196808 #define K12BUF_SIZE 196808
char *buf; char *buf;
size_t left = K12BUF_SIZE; size_t left = K12BUF_SIZE;
gint wl; size_t wl;
char *p; char *p;
const char* str_enc; const char* str_enc;
guint i; guint i;