Rename WTAP_ERR_UNSUPPORTED_FILE_TYPE to WTAP_ERR_UNWRITABLE_FILE_TYPE.

That makes it clearer what the problem is, and that it should only be
returned by the dump code path, not by the read code path.

Change-Id: I22d407efe3ae9fba7aa25f08f050317549866442
Reviewed-on: https://code.wireshark.org/review/5798
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-12-17 00:29:31 -08:00
parent dbdcae80ba
commit ddcc2aee3d
14 changed files with 23 additions and 23 deletions

View File

@ -138,7 +138,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
errmsg = errmsg_errno;
break;
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
case WTAP_ERR_UNWRITABLE_FILE_TYPE:
/* Seen only when opening a capture file for writing. */
errmsg = "TShark doesn't support writing capture files in that format.";
break;

View File

@ -223,7 +223,7 @@ WSLUA_CONSTRUCTOR Dumper_new(lua_State* L) {
if (! d ) {
/* WSLUA_ERROR("Error while opening file for writing"); */
switch (err) {
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
case WTAP_ERR_UNWRITABLE_FILE_TYPE:
luaL_error(L,"Files of file type %s cannot be written",
wtap_file_type_subtype_string(filetype));
break;
@ -367,7 +367,7 @@ WSLUA_METHOD Dumper_new_for_current(lua_State* L) {
if (! d ) {
switch (err) {
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
case WTAP_ERR_UNWRITABLE_FILE_TYPE:
luaL_error(L,"Files of file type %s cannot be written",
wtap_file_type_subtype_string(filetype));
break;

2
file.c
View File

@ -5020,7 +5020,7 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info,
display_basename, wtap_file_type_subtype_string(file_type));
break;
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
case WTAP_ERR_UNWRITABLE_FILE_TYPE:
/* Seen only when opening a capture file for writing. */
simple_error_message_box(
"Wireshark doesn't support writing capture files in that format.");

View File

@ -3116,7 +3116,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
/* We couldn't set up to write to the capture file. */
switch (err) {
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
case WTAP_ERR_UNWRITABLE_FILE_TYPE:
cmdarg_err("Capture files can't be written in that format.");
break;
@ -4160,7 +4160,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
errmsg = errmsg_errno;
break;
case WTAP_ERR_UNSUPPORTED_FILE_TYPE:
case WTAP_ERR_UNWRITABLE_FILE_TYPE:
/* Seen only when opening a capture file for writing. */
errmsg = "TShark doesn't support writing capture files in that format.";
break;

View File

@ -409,7 +409,7 @@ gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err)
default:
/* We should never get here - our open routine
should only get called for the types above. */
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}
@ -451,7 +451,7 @@ gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err)
default:
/* We should never get here - our open routine
should only get called for the types above. */
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}

View File

@ -730,7 +730,7 @@ int erf_dump_open(wtap_dumper *wdh, int *err)
wdh->tsprecision = WTAP_TSPREC_NSEC;
break;
default:
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
break;
}

View File

@ -2225,7 +2225,7 @@ wtap_dump_open_check(int file_type_subtype, int encap, gboolean compressed, int
{
if (!wtap_dump_can_open(file_type_subtype)) {
/* Invalid type, or type we don't know how to write. */
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}

View File

@ -851,7 +851,7 @@ gboolean libpcap_dump_open(wtap_dumper *wdh, int *err)
default:
/* We should never get here - our open routine
should only get called for the types above. */
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}
@ -982,7 +982,7 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
/* We should never get here - our open routine
should only get called for the types above. */
g_assert_not_reached();
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}

View File

@ -353,7 +353,7 @@ gboolean logcat_binary_dump_open(wtap_dumper *wdh, int *err)
break;
default:
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}

View File

@ -532,7 +532,7 @@ static gboolean logcat_text_dump_text(wtap_dumper *wdh,
return FALSE;
}
} else {
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}
}

View File

@ -1038,7 +1038,7 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
default:
/* We should never get here - our open routine
should only get called for the types above. */
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}
@ -1143,7 +1143,7 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
default:
/* We should never get here - our open routine
should only get called for the types above. */
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}
@ -1296,7 +1296,7 @@ static gboolean netmon_dump_close(wtap_dumper *wdh, int *err)
/* We should never get here - our open routine
should only get called for the types above. */
if (err != NULL)
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}
if (!wtap_dump_file_write(wdh, magicp, magic_size, err))

View File

@ -1845,7 +1845,7 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
nstrace->page_offset += (guint16) phdr->caplen;
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
{
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
}
@ -1860,7 +1860,7 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
case NSPR_HEADER_VERSION206:
if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
{
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
{
@ -1889,11 +1889,11 @@ static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
case NSPR_HEADER_VERSION300:
if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0)
{
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0)
{
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
*err = WTAP_ERR_UNWRITABLE_FILE_TYPE;
return FALSE;
} else if (wdh->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NETSCALER_3_0)
{

View File

@ -831,7 +831,7 @@ static const char *wtap_errlist[] = {
/* WTAP_ERR_CANT_OPEN */
NULL,
/* WTAP_ERR_UNSUPPORTED_FILE_TYPE */
/* WTAP_ERR_UNWRITABLE_FILE_TYPE */
"Files can't be saved in that format",
/* WTAP_ERR_UNWRITABLE_ENCAP */

View File

@ -1681,7 +1681,7 @@ int wtap_register_encap_type(const char* name, const char* short_name);
#define WTAP_ERR_CANT_OPEN -6
/** The file couldn't be opened, reason unknown */
#define WTAP_ERR_UNSUPPORTED_FILE_TYPE -7
#define WTAP_ERR_UNWRITABLE_FILE_TYPE -7
/** Wiretap can't save files in the specified format */
#define WTAP_ERR_UNWRITABLE_ENCAP -8