Wireshark mailing list archives

rev30840 compilation error: packet-6lowpan.c:1617: error: suggest parentheses around + or - in operand of &


From: yami <yamisoe () gmail com>
Date: Fri, 6 Nov 2009 07:48:13 +0800

Hi dev,

Has anyone encounter such a compilation warning (treated as error)?
The code is:

        switch (udp_flags & (LOWPAN_NHC_UDP_SRCPORT |
LOWPAN_NHC_UDP_DSTPORT)) {
            case (LOWPAN_NHC_UDP_SRCPORT | LOWPAN_NHC_UDP_DSTPORT):
                udp.src_port = LOWPAN_PORT_12BIT_OFFSET +
(tvb_get_guint8(tvb, offset) >> 4);
                udp.dst_port = LOWPAN_PORT_12BIT_OFFSET +
tvb_get_guint8(tvb, offset) & 0x0f;
                src_bitlen = 4;
                dst_bitlen = 4;
                break;

I'm not familiar with this code, but it seems that we need parenthesizes
around 'tvb_get_guint8(tvb, offset) & 0x0f'?
Or around '+' to please the compiler?

My gcc version:

yami@yami-workshop:~/project/wsclean/wireshark$ gcc --version
gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: