dfilter: Change string node display representation again
Adding double quotes to the display output format was probably a mistake.
This commit is contained in:
parent
e7ecc9b9e5
commit
b62d4b8eca
|
@ -439,7 +439,7 @@ check_exists(dfwork_t *dfw, stnode_t *st_arg1)
|
|||
break;
|
||||
case STTYPE_STRING:
|
||||
case STTYPE_UNPARSED:
|
||||
FAIL(dfw, "%s is neither a field nor a protocol name.",
|
||||
FAIL(dfw, "\"%s\" is neither a field nor a protocol name.",
|
||||
stnode_todisplay(st_arg1));
|
||||
break;
|
||||
|
||||
|
@ -501,7 +501,7 @@ check_drange_sanity(dfwork_t *dfw, stnode_t *st)
|
|||
/* Should this be rejected instead? */
|
||||
check_drange_sanity(dfw, entity1);
|
||||
} else {
|
||||
FAIL(dfw, "Range is not supported for entity %s of type %s",
|
||||
FAIL(dfw, "Range is not supported for entity \"%s\" of type %s",
|
||||
stnode_todisplay(entity1), stnode_type_name(entity1));
|
||||
}
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ check_relation_LHS_STRING(dfwork_t *dfw, test_op_t st_op,
|
|||
}
|
||||
else if (type2 == STTYPE_STRING || type2 == STTYPE_UNPARSED) {
|
||||
/* Well now that's silly... */
|
||||
FAIL(dfw, "Neither %s nor %s are field or protocol names.",
|
||||
FAIL(dfw, "Neither \"%s\" nor \"%s\" are field or protocol names.",
|
||||
stnode_todisplay(st_arg1),
|
||||
stnode_todisplay(st_arg2));
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ check_relation_LHS_UNPARSED(dfwork_t *dfw, test_op_t st_op,
|
|||
}
|
||||
else if (type2 == STTYPE_STRING || type2 == STTYPE_UNPARSED) {
|
||||
/* Well now that's silly... */
|
||||
FAIL(dfw, "Neither %s nor %s are field or protocol names.",
|
||||
FAIL(dfw, "Neither \"%s\" nor \"%s\" are field or protocol names.",
|
||||
stnode_todisplay(st_arg1),
|
||||
stnode_todisplay(st_arg2));
|
||||
}
|
||||
|
@ -1027,7 +1027,7 @@ check_relation_contains(dfwork_t *dfw, stnode_t *st_node,
|
|||
break;
|
||||
case STTYPE_STRING:
|
||||
case STTYPE_UNPARSED:
|
||||
FAIL(dfw, "%s is not a valid operand for contains.", stnode_todisplay(st_arg1));
|
||||
FAIL(dfw, "\"%s\" is not a valid operand for contains.", stnode_todisplay(st_arg1));
|
||||
break;
|
||||
default:
|
||||
ws_assert_not_reached();
|
||||
|
@ -1048,7 +1048,7 @@ check_relation_matches(dfwork_t *dfw, stnode_t *st_node,
|
|||
log_stnode(st_arg2);
|
||||
|
||||
if (stnode_type_id(st_arg2) != STTYPE_STRING) {
|
||||
FAIL(dfw, "Expected a double quoted string not %s", stnode_todisplay(st_arg2));
|
||||
FAIL(dfw, "Expected a double quoted string not '%s'", stnode_todisplay(st_arg2));
|
||||
}
|
||||
|
||||
patt = stnode_data(st_arg2);
|
||||
|
@ -1078,7 +1078,7 @@ check_relation_matches(dfwork_t *dfw, stnode_t *st_node,
|
|||
break;
|
||||
case STTYPE_STRING:
|
||||
case STTYPE_UNPARSED:
|
||||
FAIL(dfw, "%s is not a valid operand for matches.", stnode_todisplay(st_arg1));
|
||||
FAIL(dfw, "\"%s\" is not a valid operand for matches.", stnode_todisplay(st_arg1));
|
||||
break;
|
||||
default:
|
||||
ws_assert_not_reached();
|
||||
|
|
|
@ -22,15 +22,7 @@ string_free(gpointer value)
|
|||
}
|
||||
|
||||
static char *
|
||||
string_tostr(const void *data, gboolean pretty)
|
||||
{
|
||||
if (pretty)
|
||||
return g_strdup_printf("\"%s\"", (const char *)data);
|
||||
return g_strdup(data);
|
||||
}
|
||||
|
||||
static char *
|
||||
unparsed_tostr(const void *data, gboolean pretty _U_)
|
||||
string_tostr(const void *data, gboolean pretty _U_)
|
||||
{
|
||||
return g_strdup(data);
|
||||
}
|
||||
|
@ -54,7 +46,7 @@ sttype_register_string(void)
|
|||
NULL,
|
||||
string_free,
|
||||
string_dup,
|
||||
unparsed_tostr
|
||||
string_tostr
|
||||
};
|
||||
|
||||
sttype_register(&string_type);
|
||||
|
|
|
@ -41,7 +41,7 @@ class case_range(unittest.TestCase):
|
|||
|
||||
def test_slice_unparsed_1(self, checkDFilterFail):
|
||||
dfilter = "a == b[1]"
|
||||
checkDFilterFail(dfilter, "Range is not supported for entity b of type UNPARSED")
|
||||
checkDFilterFail(dfilter, "Range is not supported for entity \"b\" of type UNPARSED")
|
||||
|
||||
def test_slice_func_1(self, checkDFilterSucceed):
|
||||
dfilter = "string(ipx.src.node)[3:2] == \"cc:dd\""
|
||||
|
|
Loading…
Reference in New Issue