forked from osmocom/wireshark
the quoted_string regexp in uat_load() fails badly on "...\\", workarround in uat_save() using \x5c and \x22 (hex for \ and ")
svn path=/trunk/; revision=20706
This commit is contained in:
parent
a84df38651
commit
8bfa2bace4
10
epan/uat.c
10
epan/uat.c
|
@ -165,12 +165,10 @@ static void putfld(FILE* fp, void* rec, uat_field_t* f) {
|
|||
for(i=0;i<fld_len;i++) {
|
||||
char c = fld_ptr[i];
|
||||
|
||||
if (c == '"') {
|
||||
fputs("\134\042",fp);
|
||||
} else if (isprint(c)) {
|
||||
putc(c,fp);
|
||||
} else {
|
||||
if (c == '"' || c == '\\' || ! isprint(c) ) {
|
||||
fprintf(fp,"\\x%.2x",c);
|
||||
} else {
|
||||
putc(c,fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,6 +205,8 @@ gboolean uat_save(uat_t* uat, char** error) {
|
|||
|
||||
*error = NULL;
|
||||
|
||||
fprintf(fp,"# This file is automatically generated, DO NOT MODIFY.\n");
|
||||
|
||||
for ( i = 0 ; i < uat->user_data->len ; i++ ) {
|
||||
void* rec = uat->user_data->data + (uat->record_size * i);
|
||||
uat_field_t* f;
|
||||
|
|
|
@ -82,9 +82,14 @@
|
|||
#define DUMP_FIELD(s)
|
||||
#define DUMP(s)
|
||||
#endif
|
||||
/*
|
||||
* XXX
|
||||
* quoted_string below fails badly on "...\\"
|
||||
* workarround in uat_save(), using /x5c and /x22
|
||||
*/
|
||||
%}
|
||||
|
||||
quoted_string \042([^\042]|\134\042)*\042
|
||||
quoted_string \042([^\042]|\134\134|\134\042)*\042
|
||||
binstring ([0-9a-zA-Z][0-9a-zA-Z])+
|
||||
separator [ \t]*,
|
||||
newline [ \t]*[\r]?\n
|
||||
|
|
Loading…
Reference in New Issue