Wireshark-dev: Re: [Wireshark-dev] Familiar with gtk/sctp_graph_dlg.c?

From: Michael Tüxen <Michael.Tuexen@xxxxxxxxxxxxxxxxx>
Date: Tue, 26 Apr 2011 15:29:12 +0200
On Apr 26, 2011, at 2:44 PM, Jakub Zawadzki wrote:

> On Mon, Apr 25, 2011 at 03:02:18PM -0600, Stephen Fisher wrote:
>> dup_list = (guint32 *)(((char *)&sack_header->nr_of_dups)+sizeof(guint16)+(nr*sizeof(struct gaps)));
> 
> It seems to be less readable version of:
>  dup_list = (guint32 *) &sack_header->gaps[nr];
This code should also point to the right place in memory, assuming
the correct alignment. dup_list is 4 byte aligned if and only if
sack_header is.

Best regards
Michael
> 
> (At least on amd64 printed offsets:
>  printf("%p %p\n", &sack_header->gaps[nr], (((char *)&sack_header->nr_of_dups)+sizeof(guint16)+(nr*sizeof(struct gaps)))); 
> are the same)
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>