Mavgen WLUA: Fix incorrect display of negative ints on mac #944
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is to fix mavlink/mavlink#1862, fix mavlink/mavlink#2073 and fix #701. (In particular mavlink/mavlink#2073 includes the discussion about how it was figured out!).
There is a bug in wireshark, whereby a double is cast to an unsigned int when it should be a signed int, before being used as a signed int. On Linux this works, but on Mac negative values get cut to zero (here is why).
Thanks to @rotu, a Wireshark fix has been merged in wireshark/wireshark#15438.
This PR provides a workaround/fix to avoid the issue completely, so that it will work even with older versions of Wireshark.
The fix is to not include the value argument when calling add_le function, and let Wireshark do the value extraction internally from the raw bytes. This avoids the code which does the bad casting. It also makes the generated lua file have about 20-25% fewer lines of code.
There are some case in which the value still needs to separately extracted:
I've tested new LUA with some basic scenarios on Linux, and the CI also includes a decent selection of pytests for this.
@rotu