diff options
author | Michael Mann <mmann78@netscape.net> | 2013-04-22 02:10:49 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-04-22 02:10:49 +0000 |
commit | 4a1bd75b60171d781dc9f2d3ffd6d498acc74b1a (patch) | |
tree | 496db09db3b0ebcf10e9e43d19d804cd14b94a58 /epan/uat_load.l | |
parent | 6ea50c8d2e0a70acd6d7c759a54276c852081172 (diff) |
Add a "hidden" array of UAT entry data to allow separation between UAT file syntax errors and "syntactically correct, but invalid field". Now UAT files load all entries into the "hidden" array (raw_data), but only adds valid ones to the user_data, which is used by the dissectors.
This is a start to fixing bug 7471 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7471) and is being committed to get the new ABI/API in before the 1.10 release.
What remains is the "GUI portion" (GTK+qt) to indicate to users which UAT entries are invalid.
svn path=/trunk/; revision=48960
Diffstat (limited to 'epan/uat_load.l')
-rw-r--r-- | epan/uat_load.l | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/uat_load.l b/epan/uat_load.l index c306d4d14a..117bb3355c 100644 --- a/epan/uat_load.l +++ b/epan/uat_load.l @@ -71,6 +71,7 @@ #endif static uat_t* uat; +static gboolean valid_record; static guint colnum; static gchar* ptrx; static guint len; @@ -86,7 +87,8 @@ static guint parse_str_pos; { const gchar* errx; \ if (uat->fields[colnum].cb.chk) { \ if ( ! uat->fields[colnum].cb.chk(record, ptrx, len, uat->fields[colnum].cbdata.chk, uat->fields[colnum].fld_data, &errx) ) { \ - ERROR(("%s",errx)); \ + error = ep_strdup_printf("%s:%d: %s",uat->filename,linenum,ep_strdup_printf("%s",errx)); \ + valid_record = FALSE; \ }\ }\ uat->fields[colnum].cb.set(record, ptrx, len, uat->fields[colnum].cbdata.chk, uat->fields[colnum].fld_data);\ @@ -243,15 +245,16 @@ comment #[^\n]*\n SET_FIELD(); - rec = uat_add_record(uat, record); + rec = uat_add_record(uat, record, valid_record); - if (uat->update_cb) + if ((uat->update_cb) && (rec != NULL)) uat->update_cb(rec,&err); if (err) { ERROR(("%s",err)); } + valid_record = TRUE; colnum = 0; ptrx = NULL; len = 0; @@ -302,6 +305,7 @@ uat_load(uat_t *uat_in, const char **errx) } error = NULL; + valid_record = TRUE; colnum = 0; g_free(record); record = g_malloc0(uat->record_size); @@ -340,6 +344,7 @@ uat_load_str(uat_t *uat_in, char *entry, char **err) yyin = NULL; error = NULL; + valid_record = TRUE; colnum = 0; g_free(record); record = g_malloc0(uat->record_size); |