Re: [Rhythmbox-devel] DACP (iTunes remote) support added



On Mon, 2010-10-18 at 16:00 -0500, W. Michael Petullo wrote:
> > I'm building it on a 32 bit system and got this error:
> > 
> >   CC     libdaap_la-rb-daap-record.lo
> > cc1: warnings being treated as errors
> > rb-daap-record.c: In function ‘rb_daap_record_new’:
> > rb-daap-record.c:413: error: cast from pointer to integer of different size
> > 
> > The following one line fix makes it compile:
> > 
> > $ git diff
> > diff --git a/plugins/daap/rb-daap-record.c b/plugins/daap/rb-daap-record.c
> > index fee6064..d8e5740 100644
> > --- a/plugins/daap/rb-daap-record.c
> > +++ b/plugins/daap/rb-daap-record.c
> > @@ -409,7 +409,7 @@ RBDAAPRecord *rb_daap_record_new (RhythmDBEntry *entry)
> >                                                 (entry, RHYTHMDB_PROP_ALBUM);
> > 
> >                 /* Since we don't support album id's on Rhythmbox,
> > "emulate" it */
> > -               record->priv->albumid  = (gint64) rhythmdb_entry_get_refstring
> > +               record->priv->albumid  = (gint) rhythmdb_entry_get_refstring
> >                                                 (entry, RHYTHMDB_PROP_ALBUM);
> > 
> >                 record->priv->genre    = rhythmdb_entry_dup_string
> > 
> > 
> > Is this a sane fix?
> 
> But, int is 4 bytes on x86_64 and pointers are 8 bytes.
> 
> I thought maybe:
> 
> record->priv->albumid = GPOINTER_TO_UINT(rhythmdb_entry_get_refstring 
> 					(entry, RHYTHMDB_PROP_ALBUM));
> 
> However, the documentation for GPOINTER_TO_UINT says, "Remember, YOU
> MAY NOT STORE POINTERS IN INTEGERS. THIS IS NOT PORTABLE IN ANY WAY
> SHAPE OR FORM. These macros ONLY allow storing integers in pointers,
> and only preserve 32 bits of the integer; values outside the range of
> a 32-bit integer will be mangled."
> 
> Should we handle this with a pre-processor trick?

If you're hoping to use a pointer there, just make it a pointer, instead
of seemingly trying to work around it.




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