[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [bluetooth-dev] Portability problem/bug in rfcomm.c



> -----Original Message-----
> From: Claus Tondering [mailto:ct@xxxxxxx.dk]
> Sent: 03 April 2001 15:38
> To: bluetooth-dev@xxxxxxx.com
> Subject: [bluetooth-dev] Portability problem/bug in rfcomm.c
> 
> The file rfcomm.c contains this definition:
> 
>   typedef union long_length{
>   // David LIBAULT : THIS WAS NOT WORKING AT UPF4.5...
> 	  struct bits {
>              u8 ea:1;
> 	     unsigned short len:15;
>           } bits ;
>           u16 val ;
>   } __attribute__ ((packed)) long_length;
> 
> and a similar big-endian definition.
> 
> The definition of the 'bits' structure should be altered so that it
> also is declared 'packed':
> 
>   typedef union long_length{
> 	  struct bits {
>              u8 ea:1;
> 	     unsigned short len:15;
>           }  __attribute__ ((packed)) bits ;
>           u16 val ;
>   } __attribute__ ((packed)) long_length;
> 
> 
> If you're using an Intel compiler, this extra __attribute__ is not
> necessary; but if you're using an ARM compiler, it is required.
> 
> 
> Actually this proved to be the reason for the MTU problems I have
> previously reported here, and where I wrongly suggested that I might
> have encountered an error in Digianswer's USB stack.
> (Sorry, Digianswer!)
> 
> 
> Another problem is that packed data structures may cause alignment
> errors in some architectures, and packed data structures should
> normally be avoided when writing portable software.
> 
> --
> Claus Tondering

Ok, I've added the packed attribute now in CVS too (sorry for the delay).

//Peter
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com