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

Re: 64 bit ints & Parser.xs warnings

Thread Previous | Thread Next
From:
Gisle Aas
Date:
January 31, 2001 20:26
Subject:
Re: 64 bit ints & Parser.xs warnings
Message ID:
lrvgqvc9m0.fsf@caliper.ActiveState.com
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);

Regards,
Gisle

Thread Previous | Thread Next


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