diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-04-01 21:17:50 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-04-01 21:17:50 +0000 |
commit | b1ecd8d217502b6223ffed2ea0d0edabb5a9f81f (patch) | |
tree | 26c9b757d7e493fc8a2bc455062bdae3db75df34 /file.c | |
parent | 82a602d697b03314a11b3fd914dc7173fe18b293 (diff) |
Add a wtap_dump_can_write() routine that indicates whether Wiretap
supports writing files with a given set of encapsulations and comment
types. Use it, rather than asking for a list of file formats that
support the given set of encapsulation and comment types and checking
whether we got back such a list, or duplicating its logic.
Having file.c use it means that nobody's using
wtap_dump_can_write_encaps() any more; get rid of it. Instead, have a
private routine that checks whether a given file format supports a given
set of encapsulations *and* comment types, and use that internally.
svn path=/trunk/; revision=48690
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 22 |
1 files changed, 8 insertions, 14 deletions
@@ -3971,20 +3971,14 @@ save_packet(capture_file *cf _U_, frame_data *fdata, gboolean cf_can_write_with_wiretap(capture_file *cf) { - int ft; - - for (ft = 0; ft < WTAP_NUM_FILE_TYPES; ft++) { - /* To save a file with Wiretap, Wiretap has to handle that format, - and its code to handle that format must be able to write a file - with this file's encapsulation types. */ - if (wtap_dump_can_write_encaps(ft, cf->linktypes)) { - /* OK, we can write it out in this type. */ - return TRUE; - } - } - - /* No, we couldn't save it in any format. */ - return FALSE; + /* We don't care whether we support the comments in this file or not; + if we can't, we'll offer the user the option of discarding the + comments. + + XXX - we shouldn't offer the option of adding or editing comments + of a particular type if we don't support that particular type of + comment in any file format. */ + return wtap_dump_can_write(cf->linktypes, 0); } /* |