Make the "idl-light"-to-dissector generator handle hex (and octal)

values in enums (and, while we're at it, add some error checking for
valid values).  (The regenerated dissectors don't differ usefully from
the fixed dissectors, so we don't check them in.)

svn path=/trunk/; revision=42626
This commit is contained in:
Guy Harris 2012-05-14 23:19:13 +00:00
parent 953a5c3fff
commit 1ec0629c1b
1 changed files with 8 additions and 1 deletions

View File

@ -2769,6 +2769,8 @@ static void parsetypedefenum(void)
{
token_item_t *ti;
enum_list_t *enum_list, *el, *lastel;
char *p;
long val;
int eval, enumsize;
char dissectorname[256], valsstring[256], hfvalsstring[256];
@ -2847,7 +2849,12 @@ static void parsetypedefenum(void)
if(!strcmp(ti->str,"=")){
ti=ti->next;
/* grab value */
el->val=atoi(ti->str);
val=strtol(ti->str,&p,0);
if (p==ti->str||*p) {
fprintf(stderr, "ERROR: typedefenum value is not a number\n");
Exit(10);
}
el->val=val;
ti=ti->next;
} else {
el->val=eval;