develooper Front page | perl.libwww | Postings from February 2001

Re: 64 bit ints & Parser.xs warnings

Thread Previous
From:
Gisle Aas
Date:
February 1, 2001 07:05
Subject:
Re: 64 bit ints & Parser.xs warnings
Message ID:
lr8znqzbov.fsf@caliper.ActiveState.com
Mike Stok <mike@stok.co.uk> writes:

> Worked for me...

Good.  Then this will be how we do it in 3.16.  I also had to add a:

  #ifndef INT2PTR
     #define INT2PTR(any,d)  (any)(d)
     #define PTR2IV(p)       (IV)(p)
  #endif

to get Parser.xs to still compile with earlier perls.

--Gisle


> On 31 Jan 2001, Gisle Aas wrote:
> 
> > Mike Stok <mike@stok.co.uk> writes:
> >
> > > I was just rebuilding everything with perl 5.6.1 trial 2
> > >
> > > This is perl, v5.6.1 built for i586-linux-64all-ld
> > > (with 1 registered patch, see perl -V for more detail)
> > >
> > > and noticed a couple of warnings while building HTML-Parser-3.15:
> > >
> > > Parser.xs: In function `get_pstate_iv':
> > > Parser.xs:114: warning: cast to pointer from integer of different size
> > > Parser.xs: In function `XS_HTML__Parser__alloc_pstate':
> > > Parser.xs:202: warning: cast from pointer to integer of different size
> > >
> > > It doesn't seem to affect the make test.
> >
> > Can you check this patch:
> >
> > Index: Parser.xs
> > ===================================================================
> > RCS file: /cvsroot/libwww-perl/html-parser/Parser.xs,v
> > retrieving revision 2.95
> > diff -u -p -u -r2.95 Parser.xs
> > --- Parser.xs	2000/12/26 08:52:44	2.95
> > +++ Parser.xs	2001/02/01 04:25:12
> > @@ -111,7 +111,7 @@ static PSTATE*
> >  get_pstate_iv(SV* sv)
> >  {
> >    dTHX;
> > -  PSTATE* p = (PSTATE*)SvIV(sv);
> > +  PSTATE* p = INT2PTR(PSTATE*, SvIV(sv));
> >    if (p->signature != P_SIGNATURE)
> >      croak("Bad signature in parser state object at %p", p);
> >    return p;
> > @@ -199,7 +199,7 @@ _alloc_pstate(self)
> >  	Newz(56, pstate, 1, PSTATE);
> >  	pstate->signature = P_SIGNATURE;
> >
> > -	sv = newSViv((IV)pstate);
> > +	sv = newSViv(PTR2IV(pstate));
> >  	sv_magic(sv, 0, '~', 0, 0);
> >  	mg = mg_find(sv, '~');
> >          assert(mg);

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About