diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-07-27 19:14:34 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-07-27 19:14:34 +0000 |
commit | 73aa1e78076ddf9c4d8dc0c581b9d4cdf2b9b86c (patch) | |
tree | a7294cde3ff28e39b84f14adb770858d13863f43 /epan/dfilter/semcheck.c | |
parent | 1f4d76a6cac8ead64862bde1eb7fef10fae19d5d (diff) |
Support drange for functions
last think from bug #8979
+ fix semcheck.c:875: warning: signed and unsigned type in conditional expression
svn path=/trunk/; revision=50951
Diffstat (limited to 'epan/dfilter/semcheck.c')
-rw-r--r-- | epan/dfilter/semcheck.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index 944a7bfa32..5f061a67a9 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -850,7 +850,6 @@ check_relation_LHS_RANGE(const char *relation_string, FtypeCanFunc can_func _U_, sttype_id_t type2; stnode_t *entity1; header_field_info *hfinfo1, *hfinfo2; - df_func_def_t *funcdef; ftenum_t ftype1, ftype2; fvalue_t *fvalue; char *s; @@ -870,9 +869,21 @@ check_relation_LHS_RANGE(const char *relation_string, FtypeCanFunc can_func _U_, hfinfo1->abbrev, ftype_pretty_name(ftype1)); THROW(TypeError); } + } else if (entity1 && stnode_type_id(entity1) == STTYPE_FUNCTION) { + df_func_def_t *funcdef = sttype_function_funcdef(entity1); + ftype1 = funcdef->retval_ftype; + + if (!ftype_can_slice(ftype1)) { + dfilter_fail("Return value of function \"%s\" is a %s and cannot be converted into a sequence of bytes.", + funcdef->name, ftype_pretty_name(ftype1)); + THROW(TypeError); + } + + check_function(entity1); + } else { dfilter_fail("Range is not supported, details: " G_STRLOC " entity: %p of type %d", - entity1, entity1 ? stnode_type_id(entity1) : -1); + entity1, entity1 ? (int) stnode_type_id(entity1) : -1); THROW(TypeError); } @@ -963,7 +974,7 @@ check_relation_LHS_RANGE(const char *relation_string, FtypeCanFunc can_func _U_, check_drange_sanity(st_arg2); } else if (type2 == STTYPE_FUNCTION) { - funcdef = sttype_function_funcdef(st_arg2); + df_func_def_t *funcdef = sttype_function_funcdef(st_arg2); ftype2 = funcdef->retval_ftype; if (!is_bytes_type(ftype2)) { |