diff options
author | Guy Harris <guy@alum.mit.edu> | 2007-11-06 08:46:57 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2007-11-06 08:46:57 +0000 |
commit | 69ba6c776216548752169437b4751bd70c6a9b8a (patch) | |
tree | 2d1b8b9385c60d539b5cb7bc13e65c9a63f2fbe6 | |
parent | 7885237398b7993cb7dd391b410071e9a3b38694 (diff) | |
download | wireshark-69ba6c776216548752169437b4751bd70c6a9b8a.tar.gz |
The "bitwise AND" display filter operator is supposed to evaluate to
TRUE if the result of the operation has any bit set; that means that the
test should stop and return TRUE as soon as it finds two bytes that when
ANDed together are non-zero, and return FALSE if no such byte was found.
The other test functions don't have "_bytes" in the routine name; don't
put it into this one.
svn path=/trunk/; revision=23374
-rw-r--r-- | epan/ftypes/ftype-bytes.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c index 373ab7d8ae..f54cb2acb9 100644 --- a/epan/ftypes/ftype-bytes.c +++ b/epan/ftypes/ftype-bytes.c @@ -435,7 +435,8 @@ cmp_le(fvalue_t *fv_a, fvalue_t *fv_b) return (memcmp(a->data, b->data, a->len) <= 0); } -static gboolean cmp_bytes_bitwise_and(fvalue_t *fv_a, fvalue_t *fv_b) +static gboolean +cmp_bitwise_and(fvalue_t *fv_a, fvalue_t *fv_b) { GByteArray *a = fv_a->value.bytes; GByteArray *b = fv_b->value.bytes; @@ -449,11 +450,11 @@ static gboolean cmp_bytes_bitwise_and(fvalue_t *fv_a, fvalue_t *fv_b) p_b = b->data; while (i < b->len) { if (p_a[i] & p_b[i]) - i++; + return TRUE; else - return FALSE; + i++; } - return TRUE; + return FALSE; } static gboolean @@ -541,7 +542,7 @@ ftype_register_bytes(void) cmp_ge, cmp_lt, cmp_le, - cmp_bytes_bitwise_and, + cmp_bitwise_and, cmp_contains, CMP_MATCHES, @@ -579,7 +580,7 @@ ftype_register_bytes(void) cmp_ge, cmp_lt, cmp_le, - cmp_bytes_bitwise_and, + cmp_bitwise_and, cmp_contains, NULL, /* cmp_matches */ @@ -617,7 +618,7 @@ ftype_register_bytes(void) cmp_ge, cmp_lt, cmp_le, - cmp_bytes_bitwise_and, + cmp_bitwise_and, cmp_contains, CMP_MATCHES, @@ -655,7 +656,7 @@ ftype_register_bytes(void) cmp_ge, cmp_lt, cmp_le, - cmp_bytes_bitwise_and, + cmp_bitwise_and, cmp_contains, NULL, /* cmp_matches */ @@ -693,7 +694,7 @@ ftype_register_bytes(void) cmp_ge, cmp_lt, cmp_le, - cmp_bytes_bitwise_and, + cmp_bitwise_and, cmp_contains, NULL, /* cmp_matches */ |