diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-12-04 08:51:52 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-12-04 08:51:52 +0000 |
commit | 3af8d95645f9b045e59ad11975181418835068e5 (patch) | |
tree | 30cef699322fc8b0f8a2a9d5c62ccf54032cc368 /wiretap/file.c | |
parent | 3b935744025f3f4fc3e1d7e6f30850f267fc04ce (diff) |
More infrastructure changes for Ethereal - make
"wtap_file_type_string()" take, as its argument, a file type, rather
than a "wtap *".
Fix some range checks of file types to check against WTAP_NUM_FILE_TYPES
rather than WTAP_NUM_ENCAP_TYPES.
svn path=/trunk/; revision=1201
Diffstat (limited to 'wiretap/file.c')
-rw-r--r-- | wiretap/file.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/wiretap/file.c b/wiretap/file.c index 063bfb0c33..9edcec26b6 100644 --- a/wiretap/file.c +++ b/wiretap/file.c @@ -1,6 +1,6 @@ /* file.c * - * $Id: file.c,v 1.33 1999/12/04 08:32:11 guy Exp $ + * $Id: file.c,v 1.34 1999/12/04 08:51:52 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -250,18 +250,18 @@ const static struct file_type_info { NULL, NULL } }; -const char *wtap_file_type_string(wtap *wth) +const char *wtap_file_type_string(int filetype) { - if (wth->file_type < 0 || wth->file_type >= WTAP_NUM_ENCAP_TYPES) { - g_error("Unknown capture file type %d", wth->file_type); + if (filetype < 0 || filetype >= WTAP_NUM_FILE_TYPES) { + g_error("Unknown capture file type %d", filetype); return NULL; } else - return dump_open_table[wth->file_type].name; + return dump_open_table[filetype].name; } gboolean wtap_can_open(int filetype) { - if (filetype < 0 || filetype >= WTAP_NUM_ENCAP_TYPES + if (filetype < 0 || filetype >= WTAP_NUM_FILE_TYPES || dump_open_table[filetype].dump_open == NULL) return FALSE; @@ -270,7 +270,7 @@ gboolean wtap_can_open(int filetype) gboolean wtap_can_dump_encap(int filetype, int encap) { - if (filetype < 0 || filetype >= WTAP_NUM_ENCAP_TYPES + if (filetype < 0 || filetype >= WTAP_NUM_FILE_TYPES || dump_open_table[filetype].can_dump_encap == NULL) return FALSE; @@ -320,7 +320,7 @@ static wtap_dumper* wtap_dump_open_common(FILE *fh, int filetype, int encap, { wtap_dumper *wdh; - if (filetype < 0 || filetype >= WTAP_NUM_ENCAP_TYPES + if (filetype < 0 || filetype >= WTAP_NUM_FILE_TYPES || dump_open_table[filetype].dump_open == NULL) { /* Invalid type, or type we don't know how to write. */ *err = WTAP_ERR_UNSUPPORTED_FILE_TYPE; |