forked from osmocom/wireshark
Use guint8 for 8-bit unsigned numeric values.
That slightly better expresses the intent. Also, fix the message printed for bad bytes in a field name to handle bytes that are bad because they don't correspond to printable ASCII characters. Change-Id: I01f232c35bbbe30286999b6c607bfcf3d491453d Reviewed-on: https://code.wireshark.org/review/4976 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
8ea4df97e0
commit
417c181afb
|
@ -47,7 +47,7 @@ wrs_str_equal(gconstpointer a, gconstpointer b)
|
||||||
}
|
}
|
||||||
|
|
||||||
guchar
|
guchar
|
||||||
wrs_check_charset(const guchar table[256], const char *str)
|
wrs_check_charset(const guint8 table[256], const char *str)
|
||||||
{
|
{
|
||||||
const char *p = str;
|
const char *p = str;
|
||||||
guchar c;
|
guchar c;
|
||||||
|
|
|
@ -5287,7 +5287,7 @@ proto_unregister_field (const int parent, gint hf_id)
|
||||||
|
|
||||||
/* chars allowed in field abbrev */
|
/* chars allowed in field abbrev */
|
||||||
static
|
static
|
||||||
const guchar fld_abbrev_chars[256] = {
|
const guint8 fld_abbrev_chars[256] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0F */
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x0F */
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1F */
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x1F */
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, /* 0x20-0x2F '-', '.' */
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, /* 0x20-0x2F '-', '.' */
|
||||||
|
@ -5645,7 +5645,10 @@ proto_register_field_init(header_field_info *hfinfo, const int parent)
|
||||||
* it must contain only alphanumerics, '-', "_", and ".". */
|
* it must contain only alphanumerics, '-', "_", and ".". */
|
||||||
c = wrs_check_charset(fld_abbrev_chars, hfinfo->abbrev);
|
c = wrs_check_charset(fld_abbrev_chars, hfinfo->abbrev);
|
||||||
if (c) {
|
if (c) {
|
||||||
fprintf(stderr, "Invalid character '%c' in filter name '%s'\n", c, hfinfo->abbrev);
|
if (g_ascii_isprint(c))
|
||||||
|
fprintf(stderr, "Invalid character '%c' in filter name '%s'\n", c, hfinfo->abbrev);
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Invalid byte \\%03o in filter name '%s'\n", c, hfinfo->abbrev);
|
||||||
DISSECTOR_ASSERT_NOT_REACHED();
|
DISSECTOR_ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue