Syntax nodes always have one type and the compiler
can check it. Reserve magic numbers for data contained
inside syntax node. Remove the magic number field in
stnode_t and the STNODE_MAGIC define. Keep the other
magic values for type checking.
This exposed a bug with an assertion for oper type syntax
nodes. Fix the assertion to check the correct pointer value
against the magic number.
There's a lot of potentially confusing arithmetic from setting
search_pos to the last byte of a match. We can always test
search_len against zero to see if we actually had a match for
hightlighting purposes. (The ordinary byte searches won't find
zero length matches, but the regex search might, and not even
necessarily at the start of the bytes if there's a lookbehind term,
and currently they're handled incorrectly.)
We can't find fields with length zero based on an offset currently
anyway. (If we tried, would we match fields that contained the byte
before or after the zero length offset?)
Perhaps we shouldn't allow zero length regex matches for packet
byte searches at all; PCRE2 has an option to prevent such matches.
CMake will add NDEBUG with RelWithDebInfo. Fix that entry.
CMake will not add -O0 with Debug. Fix that entry.
Remove the WS_DEBUG_UTF_8 flag. It is too much detail in
this context.
When the needle is length 1, just use memchr
When the needle is longer, use memchr to check the first byte
before calling memcmp on the rest, so we can skip through the loop
faster.
The GNU memmem returns the haystack when the needle length is 0,
which matches the standard C behavior for strstr when the needle
string is null. Do that, so that our portable version matches the
GNU version on systems that have it. (This shouldn't cause a problem,
because we've being doing that on systems with GNU glibc already.)
The case sensitive exact match of a needle of a given length
in packet bytes is the same whether the value originally came from
a string or a converted hex string. We don't need two static functions
that are exactly the same.
Only enable the character encoding combobox in Find Packet when
searching the Packet Bytes, which is when it does something.
When searching in the packet list or tree details, strings have
already been converted to UTF-8.
Default is "Autodetect" (= same as the previous behavior), other options
are "Big Endian" and "Little Endian" (written as in the existing UUID
endianness preference).
Add GUI support to turning on and off finding multiple occurrences
in a frame.
Also add a checkbox for searching backwards.
This makes the number of controls large, so split it into two rows.
When searching packet details with Find Packet, step through
each field that matches the search, using the currently selected
field as a starting point for searching the current frame before
going onto another frame.
Handle both forwards and backwards, so that backwards searching
initially finds the last match in each frame.
Part of #11269. (Packet bytes searching should presumably also
be handled.)
Most of uses of ws_mempbrk use static ws_mempbrk_pattern structs so
the pattern is automatically initialized to zero, but ensure that
it is zero so that locally declared patterns don't have to be
declared with = {0} (e.g., in cf_find_packet_data, where data is
currently used unitialized but the compiler and static analysis
doesn't catch it).
This also allows re-compiling with a new pattern later.
Lintian removed "Synopsys" as a spelling error for "synopsis" precisely
because it's the name of this company, so now our override gives
warnings about an unused override
d46bf35641
[skip ci]
Instead of setting a handler for specific domains try to set
a default handler for all domains.
In the past this was unreliable but it should work better to
drive all GLib logging through wslog.