Wireshark-dev: Re: [Wireshark-dev] packet-ieee802154.c compilation error
From: "Maynard, Chris" <Christopher.Maynard@xxxxxxxxx>
Date: Tue, 2 Sep 2008 17:28:46 -0400
What about modifying the macro itself?

#define ieee802154_crc_tvb(tvb, offset)
((guint16)(crc16_ccitt_tvb_seed(tvb, offset, IEEE802154_CRC_SEED) ^
IEEE802154_CRC_XOROUT))


> -----Original Message-----
> From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-
> bounces@xxxxxxxxxxxxx] On Behalf Of Jaap Keuter
> Sent: Tuesday, September 02, 2008 5:23 PM
> To: Developer support list for Wireshark
> Subject: Re: [Wireshark-dev] packet-ieee802154.c compilation error
> 
> Hi Chris,
> 
> Yes, that is the one.
> And no, that typecast doesn't solve it.
> And yes, it does hide it from the larger scope, which is a bug IMHO.
> 
> Thanx,
> Jaap
> 
> Maynard, Chris wrote:
> > Jaap,
> > I assume this is the line it's complaining about?:
> >
> > fcs_ok = (fcs == ieee802154_crc_tvb(tvb,
> > tvb_reported_length(tvb)-IEEE802154_FCS_LEN));
> >
> > At first glance, there doesn't seem to be anything wrong with the
> > comparison since fcs is a guint16 and that's exactly what
> > crc16_ccitt_tvb_seed() returns; however, because the comparison is
> > actually the following:
> >
> > fcs_ok = (fcs == (crc16_ccitt_tvb_seed(tvb,
> > tvb_reported_length(tvb)-IEEE802154_FCS_LEN, IEEE802154_CRC_SEED) ^
> > IEEE802154_CRC_XOROUT));
> >
> > I think the compiler is interpreting (blah ^ IEEE802154_CRC_XOROUT)
...
> > where IEEE802154_CRC_XOROUT is defined as 0xFFFF ... as the
equivalent
> > of (~blah) and that's where your warning is coming from.
> >
> > What if you try the following?
> > fcs_ok = (fcs == (guint16)(ieee802154_crc_tvb(tvb,
> > tvb_reported_length(tvb)-IEEE802154_FCS_LEN)));
> >
> > - Chris
> > BTW: I ran lint on that file in case you want to have a look.  Lint
> > doesn't complain about that line exactly, but it might have some
other
> > things worth at least looking over.  For example, line 703 where
fcs_ok
> > is redeclared, but the value of fcs_ok, although assigned within the
> > if() scope is not actually visible outside of that scope; yet fcs_ok
is
> > referenced later on (line 746, ...).
> >
> >
> >> -----Original Message-----
> >> From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-
> >> bounces@xxxxxxxxxxxxx] On Behalf Of Jaap Keuter
> >> Sent: Tuesday, September 02, 2008 4:18 PM
> >> To: Developer support list for Wireshark
> >> Subject: [Wireshark-dev] packet-ieee802154.c compilation error
> >>
> >> Hi list,
> >>
> >> I'm running into this error for which I do not know the proper
> > solution:
> >> cc1: warnings being treated as errors
> >> packet-ieee802154.c: In function 'dissect_ieee802154_common':
> >> packet-ieee802154.c:709: error: comparison of promoted ~unsigned
with
> >> unsigned
> >> make[4]: *** [libdissectors_la-packet-ieee802154.lo] Error 1
> >>
> >> $ gcc -v
> >> Using built-in specs.
> >> Target: i486-linux-gnu
> >> Configured with: ../src/configure -v --with-pkgversion='Debian
> > 4.3.1-9'
> >> --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
> >> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-
> >> shared
> >> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> >> --enable-threads=posix --enable-nls --with-gxx-include-
> >> dir=/usr/include/c++/4.3
> >> --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
> >> --enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld
> >> --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu
> >> --target=i486-linux-gnu
> >> Thread model: posix
> >> gcc version 4.3.1 (Debian 4.3.1-9)
> >>
> >> Any hints are welcome.
> >>
> >> Thanx,
> >> Jaap
> >> _______________________________________________
> 
> _______________________________________________
> Wireshark-dev mailing list
> Wireshark-dev@xxxxxxxxxxxxx
> https://wireshark.org/mailman/listinfo/wireshark-dev
CONFIDENTIALITY NOTICE: The contents of this email are confidential
and for the exclusive use of the intended recipient. If you receive this
email in error, please delete it from your system immediately and 
notify us either by email, telephone or fax. You should not copy,
forward, or otherwise disclose the content of the email.