Re: [Rhythmbox-devel] music sharing patch #2



On Wed, 2005-08-10 at 22:54 +0200, Christophe Fergeau wrote:

> Iirc, I had (really) bad experiences in the past mixing (signed) chars,
> bit shifts and additions that way. I'd do something like that instead:
> 
> static gint
> rb_daap_buffer_read_int32 (const guchar *buf, gsize remaining)
> {
>   if (remaining < 4)
>     return 0;
> 
>   return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
> }

I think you're right.  One more fix I just noticed is to change the
return type to gint32.

Attachment: signature.asc
Description: This is a digitally signed message part



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