Ethereal-dev: Re: [Ethereal-dev] MPEG2 TS dissector

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Guy Harris" <gharris@xxxxxxxxx>
Date: Thu, 2 Dec 2004 13:30:34 -0800 (PST)
ronnie sahlberg said:

> Why do you need a define to specify the byte order? You are not taking
> a poitner using tvb_get_ptr() and casting it into a pointer to s
> tructure and accessing the structure fields directly that way are you?
>   You should read all fields using tvb_get_[n|le]to[hs] and similar.
> We support many platforms and compilers so we can not make guarantees
> on how a particular platform/compiler lays out structures in memory.

...and their header files are attempting to use compiler-specific tricks
to guarantee that layout; the sequence of #ifdeffed code explicitly
*fails* to work with any compilers other than GCC or MSVC++-compatible
compilers on Windows.  As Ethereal supports compilation with compilers
other than GCC and MSVC++, a #ifdeffed sequence such as that wouldn't be
acceptable, so they shouldn't use structures in that fashion.

There are also C++/C99-style comments in some of the header files; those
are also not supported by all compilers Ethereal uses, so they should
check out the "Portability" section in the "doc/README.developer" file and
remove any constructs that section says not to use.