diff options
author | João Valverde <j@v6e.pt> | 2022-03-23 00:50:24 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2022-03-23 11:04:41 +0000 |
commit | 0335ebdc3ac28a09733b8e1f9e90944be2fba2ab (patch) | |
tree | 1e9244b9c9bbc4d596e4d332e947cc712f9af5b0 /epan/ftypes | |
parent | de0db2ad0aa7c7cfe6de5dd3e83fbda70bb1dbec (diff) |
dfilter: ftype_is_true -> ftype_is_zero
Diffstat (limited to 'epan/ftypes')
-rw-r--r-- | epan/ftypes/ftype-bytes.c | 26 | ||||
-rw-r--r-- | epan/ftypes/ftype-double.c | 10 | ||||
-rw-r--r-- | epan/ftypes/ftype-ieee-11073-float.c | 12 | ||||
-rw-r--r-- | epan/ftypes/ftype-integer.c | 58 | ||||
-rw-r--r-- | epan/ftypes/ftype-ipv4.c | 6 | ||||
-rw-r--r-- | epan/ftypes/ftype-ipv6.c | 4 | ||||
-rw-r--r-- | epan/ftypes/ftype-none.c | 2 | ||||
-rw-r--r-- | epan/ftypes/ftype-protocol.c | 6 | ||||
-rw-r--r-- | epan/ftypes/ftype-string.c | 14 | ||||
-rw-r--r-- | epan/ftypes/ftype-time.c | 8 | ||||
-rw-r--r-- | epan/ftypes/ftypes-int.h | 4 | ||||
-rw-r--r-- | epan/ftypes/ftypes.c | 8 | ||||
-rw-r--r-- | epan/ftypes/ftypes.h | 4 |
13 files changed, 78 insertions, 84 deletions
diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c index 974c2d580b..a7a9362a4f 100644 --- a/epan/ftypes/ftype-bytes.c +++ b/epan/ftypes/ftype-bytes.c @@ -563,19 +563,19 @@ cmp_matches(const fvalue_t *fv, const ws_regex_t *regex) } static gboolean -bytes_is_true(const fvalue_t *fv_a) +bytes_is_zero(const fvalue_t *fv_a) { GByteArray *a = fv_a->value.bytes; if (a->len == 0) - return FALSE; + return TRUE; for (guint i = 0; i < a->len; i++) { if (a->data[i] != 0) { - return TRUE; + return FALSE; } } - return FALSE; + return TRUE; } void @@ -601,7 +601,7 @@ ftype_register_bytes(void) cmp_contains, cmp_matches, - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ @@ -626,7 +626,7 @@ ftype_register_bytes(void) cmp_contains, NULL, /* cmp_matches */ - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ @@ -651,7 +651,7 @@ ftype_register_bytes(void) cmp_contains, cmp_matches, - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ @@ -676,7 +676,7 @@ ftype_register_bytes(void) cmp_contains, cmp_matches, - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ @@ -701,7 +701,7 @@ ftype_register_bytes(void) cmp_contains, cmp_matches, - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ @@ -726,7 +726,7 @@ ftype_register_bytes(void) cmp_contains, NULL, /* cmp_matches */ - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ @@ -751,7 +751,7 @@ ftype_register_bytes(void) cmp_contains, NULL, /* cmp_matches */ - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ @@ -776,7 +776,7 @@ ftype_register_bytes(void) cmp_contains, NULL, /* cmp_matches */ - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ @@ -801,7 +801,7 @@ ftype_register_bytes(void) cmp_contains, cmp_matches, - bytes_is_true, /* is_true */ + bytes_is_zero, /* is_zero */ len, slice, bytes_bitwise_and, /* bitwise_and */ diff --git a/epan/ftypes/ftype-double.c b/epan/ftypes/ftype-double.c index e97f9e34fb..2dcaaafa62 100644 --- a/epan/ftypes/ftype-double.c +++ b/epan/ftypes/ftype-double.c @@ -85,12 +85,6 @@ double_val_to_repr(wmem_allocator_t *scope, const fvalue_t *fv, ftrepr_t rtype _ return buf; } -static gboolean -double_is_true(const fvalue_t *fv) -{ - return fv->value.floating != 0.0; -} - static int cmp_order(const fvalue_t *a, const fvalue_t *b) { @@ -124,7 +118,7 @@ ftype_register_double(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - double_is_true, /* is_true */ + NULL, /* is_zero */ NULL, NULL, NULL, /* bitwise_and */ @@ -149,7 +143,7 @@ ftype_register_double(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - double_is_true, /* is_true */ + NULL, /* is_zero */ NULL, NULL, NULL, /* bitwise_and */ diff --git a/epan/ftypes/ftype-ieee-11073-float.c b/epan/ftypes/ftype-ieee-11073-float.c index 26719586c1..a1ba68adb2 100644 --- a/epan/ftypes/ftype-ieee-11073-float.c +++ b/epan/ftypes/ftype-ieee-11073-float.c @@ -453,9 +453,9 @@ sfloat_ieee_11073_cmp_order(const fvalue_t *a, const fvalue_t *b) } static gboolean -sfloat_ieee_11073_is_true(const fvalue_t *a) +sfloat_ieee_11073_is_zero(const fvalue_t *a) { - return a->value.sfloat_ieee_11073 != 0; + return a->value.sfloat_ieee_11073 == 0; } /*============================================================================*/ @@ -862,9 +862,9 @@ float_ieee_11073_cmp_order(const fvalue_t *a, const fvalue_t *b) } static gboolean -float_ieee_11073_is_true(const fvalue_t *a) +float_ieee_11073_is_zero(const fvalue_t *a) { - return a->value.float_ieee_11073 != 0; + return a->value.float_ieee_11073 == 0; } /*============================================================================*/ @@ -917,7 +917,7 @@ Example: 114 is 0x0072 NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sfloat_ieee_11073_is_true, /* is_true */ + sfloat_ieee_11073_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ NULL, /* bitwise_and */ @@ -969,7 +969,7 @@ Example: 36.4 is 0xFF00016C NULL, /* cmp_contains */ NULL, /* cmp_matches */ - float_ieee_11073_is_true, /* is_true */ + float_ieee_11073_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ NULL, /* bitwise_and */ diff --git a/epan/ftypes/ftype-integer.c b/epan/ftypes/ftype-integer.c index 59d8435836..faa0f8e155 100644 --- a/epan/ftypes/ftype-integer.c +++ b/epan/ftypes/ftype-integer.c @@ -748,9 +748,9 @@ uint_bitwise_and(fvalue_t *dst, const fvalue_t *a, const fvalue_t *b, char **err } gboolean -uint_is_true(const fvalue_t *fv) +uint_is_zero(const fvalue_t *fv) { - return fv->value.uinteger != 0; + return fv->value.uinteger == 0; } enum ft_result @@ -761,9 +761,9 @@ uint64_bitwise_and(fvalue_t *dst, const fvalue_t *a, const fvalue_t *b, char **e } gboolean -uint64_is_true(const fvalue_t *fv) +uint64_is_zero(const fvalue_t *fv) { - return fv->value.uinteger64 != 0; + return fv->value.uinteger64 == 0; } enum ft_result @@ -774,9 +774,9 @@ sint_bitwise_and(fvalue_t *dst, const fvalue_t *a, const fvalue_t *b, char **err } gboolean -sint_is_true(const fvalue_t *fv) +sint_is_zero(const fvalue_t *fv) { - return fv->value.sinteger != 0; + return fv->value.sinteger == 0; } enum ft_result @@ -787,9 +787,9 @@ sint64_bitwise_and(fvalue_t *dst, const fvalue_t *a, const fvalue_t *b, char **e } gboolean -sint64_is_true(const fvalue_t *fv) +sint64_is_zero(const fvalue_t *fv) { - return fv->value.sinteger64 != 0; + return fv->value.sinteger64 == 0; } /* BOOLEAN-specific */ @@ -912,7 +912,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint_is_true, /* is_true */ + uint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint_bitwise_and, /* bitwise_and */ @@ -936,7 +936,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint_is_true, /* is_true */ + uint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint_bitwise_and, /* bitwise_and */ @@ -960,7 +960,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint_is_true, /* is_true */ + uint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint_bitwise_and, /* bitwise_and */ @@ -984,7 +984,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint_is_true, /* is_true */ + uint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint_bitwise_and, /* bitwise_and */ @@ -1008,7 +1008,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint_is_true, /* is_true */ + uint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint_bitwise_and, /* bitwise_and */ @@ -1032,7 +1032,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint64_is_true, /* is_true */ + uint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint64_bitwise_and, /* bitwise_and */ @@ -1056,7 +1056,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint64_is_true, /* is_true */ + uint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint64_bitwise_and, /* bitwise_and */ @@ -1080,7 +1080,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint64_is_true, /* is_true */ + uint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint64_bitwise_and, /* bitwise_and */ @@ -1104,7 +1104,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint64_is_true, /* is_true */ + uint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint64_bitwise_and, /* bitwise_and */ @@ -1128,7 +1128,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sint_is_true, /* is_true */ + sint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ sint_bitwise_and, /* bitwise_and */ @@ -1152,7 +1152,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sint_is_true, /* is_true */ + sint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ sint_bitwise_and, /* bitwise_and */ @@ -1176,7 +1176,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sint_is_true, /* is_true */ + sint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ sint_bitwise_and, /* bitwise_and */ @@ -1200,7 +1200,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sint_is_true, /* is_true */ + sint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ sint_bitwise_and, /* bitwise_and */ @@ -1224,7 +1224,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sint64_is_true, /* is_true */ + sint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ sint64_bitwise_and, /* bitwise_and */ @@ -1248,7 +1248,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sint64_is_true, /* is_true */ + sint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ sint64_bitwise_and, /* bitwise_and */ @@ -1272,7 +1272,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sint64_is_true, /* is_true */ + sint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ sint64_bitwise_and, /* bitwise_and */ @@ -1296,7 +1296,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - sint64_is_true, /* is_true */ + sint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ sint64_bitwise_and, /* bitwise_and */ @@ -1320,7 +1320,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint64_is_true, /* is_true */ + uint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ NULL, /* bitwise_and */ @@ -1345,7 +1345,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint_is_true, /* is_true */ + uint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint_bitwise_and, /* bitwise_and */ @@ -1370,7 +1370,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint_is_true, /* is_true */ + uint_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint_bitwise_and, /* bitwise_and */ @@ -1395,7 +1395,7 @@ ftype_register_integers(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - uint64_is_true, /* is_true */ + uint64_is_zero, /* is_zero */ NULL, /* len */ NULL, /* slice */ uint64_bitwise_and, /* bitwise_and */ diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c index 708989efce..d3cf02a947 100644 --- a/epan/ftypes/ftype-ipv4.c +++ b/epan/ftypes/ftype-ipv4.c @@ -140,9 +140,9 @@ slice(fvalue_t *fv, GByteArray *bytes, guint offset, guint length) } static gboolean -is_true(const fvalue_t *fv_a) +is_zero(const fvalue_t *fv_a) { - return fv_a->value.ipv4.addr != 0; + return fv_a->value.ipv4.addr == 0; } void @@ -168,7 +168,7 @@ ftype_register_ipv4(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - is_true, + is_zero, NULL, slice, bitwise_and, diff --git a/epan/ftypes/ftype-ipv6.c b/epan/ftypes/ftype-ipv6.c index 34bfdddd1b..dc69d22899 100644 --- a/epan/ftypes/ftype-ipv6.c +++ b/epan/ftypes/ftype-ipv6.c @@ -162,7 +162,7 @@ slice(fvalue_t *fv, GByteArray *bytes, guint offset, guint length) } static gboolean -is_true(const fvalue_t *fv_a) +is_zero(const fvalue_t *fv_a) { ws_in6_addr zero = { 0 }; return memcmp(&fv_a->value.ipv6.addr, &zero, sizeof(ws_in6_addr)) == 0; @@ -190,7 +190,7 @@ ftype_register_ipv6(void) NULL, /* XXX, cmp_contains, needed? ipv4 doesn't support it */ NULL, /* cmp_matches */ - is_true, + is_zero, NULL, slice, bitwise_and, diff --git a/epan/ftypes/ftype-none.c b/epan/ftypes/ftype-none.c index 3cdefa44f0..56da4cb2a1 100644 --- a/epan/ftypes/ftype-none.c +++ b/epan/ftypes/ftype-none.c @@ -34,7 +34,7 @@ ftype_register_none(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - NULL, /* is_true */ + NULL, /* is_zero */ NULL, /* len */ NULL, /* slice */ NULL, /* biwise_and */ diff --git a/epan/ftypes/ftype-protocol.c b/epan/ftypes/ftype-protocol.c index 133741f7e8..e7da850576 100644 --- a/epan/ftypes/ftype-protocol.c +++ b/epan/ftypes/ftype-protocol.c @@ -300,10 +300,10 @@ cmp_matches(const fvalue_t *fv, const ws_regex_t *regex) } static gboolean -is_true(const fvalue_t *fv) +is_zero(const fvalue_t *fv) { const protocol_value_t *a = &fv->value.protocol; - return a->tvb != NULL || a->proto_string != NULL; + return a->tvb == NULL && a->proto_string == NULL; } void @@ -329,7 +329,7 @@ ftype_register_tvbuff(void) cmp_contains, cmp_matches, - is_true, + is_zero, len, slice, NULL, diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c index e115211da6..0563ce03bb 100644 --- a/epan/ftypes/ftype-string.c +++ b/epan/ftypes/ftype-string.c @@ -102,9 +102,9 @@ val_from_charconst(fvalue_t *fv, unsigned long num, gchar **err_msg) } static gboolean -string_is_true(const fvalue_t *fv) +string_is_zero(const fvalue_t *fv) { - return fv->value.string != NULL && *(fv->value.string) != 0; + return fv->value.string == NULL || strlen(fv->value.string) == 0; } static guint @@ -182,7 +182,7 @@ ftype_register_string(void) cmp_contains, cmp_matches, - string_is_true, /* is_true */ + string_is_zero, /* is_zero */ len, slice, NULL, /* bitwise_and */ @@ -206,7 +206,7 @@ ftype_register_string(void) cmp_contains, /* cmp_contains */ cmp_matches, - string_is_true, /* is_true */ + string_is_zero, /* is_zero */ len, slice, NULL, /* bitwise_and */ @@ -230,7 +230,7 @@ ftype_register_string(void) cmp_contains, /* cmp_contains */ cmp_matches, - string_is_true, /* is_true */ + string_is_zero, /* is_zero */ len, slice, NULL, /* bitwise_and */ @@ -254,7 +254,7 @@ ftype_register_string(void) cmp_contains, /* cmp_contains */ cmp_matches, - string_is_true, /* is_true */ + string_is_zero, /* is_zero */ len, slice, NULL, /* bitwise_and */ @@ -278,7 +278,7 @@ ftype_register_string(void) cmp_contains, /* cmp_contains */ cmp_matches, - string_is_true, /* is_true */ + string_is_zero, /* is_zero */ len, slice, NULL, /* bitwise_and */ diff --git a/epan/ftypes/ftype-time.c b/epan/ftypes/ftype-time.c index bbb6d6b408..c3848e99b8 100644 --- a/epan/ftypes/ftype-time.c +++ b/epan/ftypes/ftype-time.c @@ -406,9 +406,9 @@ relative_val_to_repr(wmem_allocator_t *scope, const fvalue_t *fv, ftrepr_t rtype } static gboolean -time_is_true(const fvalue_t *fv) +time_is_zero(const fvalue_t *fv) { - return !nstime_is_zero(&fv->value.time); + return nstime_is_zero(&fv->value.time); } void @@ -434,7 +434,7 @@ ftype_register_time(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - time_is_true, /* is_true */ + time_is_zero, /* is_zero */ NULL, NULL, NULL, /* bitwise_and */ @@ -458,7 +458,7 @@ ftype_register_time(void) NULL, /* cmp_contains */ NULL, /* cmp_matches */ - time_is_true, /* is_true */ + time_is_zero, /* is_zero */ NULL, NULL, NULL, /* bitwise_and */ diff --git a/epan/ftypes/ftypes-int.h b/epan/ftypes/ftypes-int.h index 1dcae728c4..eba613e0c9 100644 --- a/epan/ftypes/ftypes-int.h +++ b/epan/ftypes/ftypes-int.h @@ -49,7 +49,7 @@ typedef int (*FvalueCmp)(const fvalue_t*, const fvalue_t*); typedef gboolean (*FvalueContains)(const fvalue_t*, const fvalue_t*); typedef gboolean (*FvalueMatches)(const fvalue_t*, const ws_regex_t*); -typedef gboolean (*FvalueIsTrue)(const fvalue_t*); +typedef gboolean (*FvalueIsZero)(const fvalue_t*); typedef guint (*FvalueLen)(fvalue_t*); typedef void (*FvalueSlice)(fvalue_t*, GByteArray *, guint offset, guint length); typedef enum ft_result (*FvalueBitwiseAnd)(fvalue_t *, const fvalue_t*, const fvalue_t*, gchar **); @@ -93,7 +93,7 @@ struct _ftype_t { FvalueContains cmp_contains; FvalueMatches cmp_matches; - FvalueIsTrue is_true; + FvalueIsZero is_zero; FvalueLen len; FvalueSlice slice; FvalueBitwiseAnd bitwise_and; diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c index c7a86a53cc..6619e0e5cd 100644 --- a/epan/ftypes/ftypes.c +++ b/epan/ftypes/ftypes.c @@ -211,12 +211,12 @@ ftype_can_matches(enum ftenum ftype) } gboolean -ftype_can_is_true(enum ftenum ftype) +ftype_can_is_zero(enum ftenum ftype) { ftype_t *ft; FTYPE_LOOKUP(ftype, ft); - return ft->is_true ? TRUE : FALSE; + return ft->is_zero ? TRUE : FALSE; } /* ---------------------------------------------------------- */ @@ -754,9 +754,9 @@ fvalue_matches(const fvalue_t *a, const ws_regex_t *re) } gboolean -fvalue_is_true(const fvalue_t *a) +fvalue_is_zero(const fvalue_t *a) { - return a->ftype->is_true(a); + return a->ftype->is_zero(a); } fvalue_t * diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h index de22e7ec8a..aab6e9e3c9 100644 --- a/epan/ftypes/ftypes.h +++ b/epan/ftypes/ftypes.h @@ -192,7 +192,7 @@ ftype_can_matches(enum ftenum ftype); WS_DLL_PUBLIC gboolean -ftype_can_is_true(enum ftenum ftype); +ftype_can_is_zero(enum ftenum ftype); /* ---------------- FVALUE ----------------- */ @@ -354,7 +354,7 @@ gboolean fvalue_matches(const fvalue_t *a, const ws_regex_t *re); gboolean -fvalue_is_true(const fvalue_t *a); +fvalue_is_zero(const fvalue_t *a); guint fvalue_length(fvalue_t *fv); |