From: Gregor Jasny <gjasny@googlemail.com>
To: "André Roth" <neolynx@gmail.com>, linux-media@vger.kernel.org
Subject: Re: [PATCH 2/3] libdvbv5: implement MGT table parser
Date: Thu, 09 Jan 2014 20:39:53 +0100 [thread overview]
Message-ID: <52CEFB09.3070307@googlemail.com> (raw)
In-Reply-To: <1389180208-3458-2-git-send-email-neolynx@gmail.com>
Hello André,
On 08/01/14 12:23, André Roth wrote:
> ...
> + union {
> + uint16_t bitfield;
> + struct {
> + uint16_t pid:13;
> + uint16_t one:3;
> + } __attribute__((packed));
> + } __attribute__((packed));
> + uint8_t type_version:5;
> + uint8_t one2:3;
> + uint32_t size;
Are you sure that this code handles the endianess correctly? Looking at
netinet/in.h I'm under the impression that the order of the bitfield
entries have to be swapped, too:
struct ip
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int ip_hl:4; /* header length */
unsigned int ip_v:4; /* version */
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int ip_v:4; /* version */
unsigned int ip_hl:4; /* header length */
#endif
I also remember that you can also easily get the byte swapping wrongif
entries cross byte borders (like a :13 one).
Maybe you could write some unit tests for your functions. The Debian
build farm then will catch any errors.
Cheers,
Gregor
next prev parent reply other threads:[~2014-01-09 19:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 11:23 [PATCH 1/3] libdvbv5: implement ATSC standard header André Roth
2014-01-08 11:23 ` [PATCH 2/3] libdvbv5: implement MGT table parser André Roth
2014-01-09 19:39 ` Gregor Jasny [this message]
2014-01-08 11:23 ` [PATCH 3/3] libdvbv5: implement ATSC EIT André Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52CEFB09.3070307@googlemail.com \
--to=gjasny@googlemail.com \
--cc=linux-media@vger.kernel.org \
--cc=neolynx@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.