develooper Front page | perl.perl5.porters | Postings from June 2011

[perl #92432] Storable::nfreeze shouldn't stringify ints larger than 127

From:
Father Chrysostomos via RT
Date:
June 12, 2011 13:52
Subject:
[perl #92432] Storable::nfreeze shouldn't stringify ints larger than 127
Message ID:
rt-3.6.HEAD-16080-1307911946-620.92432-15-0@perl.org
On Tue Jun 07 18:50:19 2011, skimbrel wrote:
> Oops, sorry, left debugging in place in that patch. Attaching a patch
> without the debug define.
> 
> diff -urB Storable-2.25/Storable.xs Storable-patch/Storable.xs
> --- Storable-2.25/Storable.xs	2010-12-08 18:07:31.000000000 -0800
> +++ Storable-patch/Storable.xs	2011-06-07 18:41:05.000000000 -0700
> @@ -2115,9 +2115,9 @@
>                  if (
>  #ifdef SVf_IVisUV
>                      /* Sorry. This isn't in 5.005_56 (IIRC) or
earlier.  */
> -                    ((flags & SVf_IVisUV) && SvUV(sv) > 0x7FFFFFFF) ||
> +                    ((flags & SVf_IVisUV) && SvUV(sv) >
(IV)0x7FFFFFFF) ||

I’m confused by that line. SvUV returns a UV, so don’t you want to cast
to UV there?

>  #endif
> -                    (iv > 0x7FFFFFFF) || (iv < -0x80000000)) {
> +                    (iv > (IV)0x7FFFFFFF) || (iv < -(IV)0x80000000)) {

That change looks ok.

>                      /* Bigger than 32 bits.  */
>                      TRACEME(("large network order integer as string,
value = %"IVdf, iv));
>                      goto string_readlen;
> 



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