This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Cast to signed before negating, to avoid compiler warnings
authorBrian Fraser <fraserbn@gmail.com>
Fri, 7 Oct 2011 05:17:33 +0000 (22:17 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 7 Oct 2011 05:17:33 +0000 (22:17 -0700)
embed.fnc
ext/mro/mro.xs
gv.c
hv.c
mro.c
op.c
pp_ctl.c
pp_hot.c
proto.h
toke.c

index 40a8c8c..b7d4609 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -466,7 +466,7 @@ ApM |GV*    |gv_fetchmethod_sv_flags|NN HV* stash|NN SV* namesv|U32 flags
 ApM    |GV*    |gv_fetchmethod_pv_flags|NN HV* stash|NN const char* name \
                                |U32 flags
 ApM    |GV*    |gv_fetchmethod_pvn_flags|NN HV* stash|NN const char* name \
-                               |STRLEN len|U32 flags
+                               |const STRLEN len|U32 flags
 Ap     |GV*    |gv_fetchpv     |NN const char *nambeg|I32 add|const svtype sv_type
 Ap     |void   |gv_fullname    |NN SV* sv|NN const GV* gv
 Apmb   |void   |gv_fullname3   |NN SV* sv|NN const GV* gv|NULLOK const char* prefix
@@ -1252,7 +1252,7 @@ ApdR      |bool   |sv_derived_from|NN SV* sv|NN const char *const name
 ApdR   |bool   |sv_derived_from_sv|NN SV* sv|NN SV *namesv|U32 flags
 ApdR   |bool   |sv_derived_from_pv|NN SV* sv|NN const char *const name|U32 flags
 ApdR   |bool   |sv_derived_from_pvn|NN SV* sv|NN const char *const name \
-                                    |STRLEN len|U32 flags
+                                    |const STRLEN len|U32 flags
 ApdR   |bool   |sv_does        |NN SV* sv|NN const char *const name
 ApdR   |bool   |sv_does_sv     |NN SV* sv|NN SV* namesv|U32 flags
 ApdR   |bool   |sv_does_pv     |NN SV* sv|NN const char *const name|U32 flags
index 1f099cb..7b5a86d 100644 (file)
@@ -643,7 +643,7 @@ mro__nextcan(...)
             assert(curstash);
 
             gvp = (GV**)hv_fetch(curstash, subname,
-                                    subname_utf8 ? -subname_len : subname_len, 0);
+                                    subname_utf8 ? -(I32)subname_len : (I32)subname_len, 0);
             if (!gvp) continue;
 
             candidate = *gvp;
diff --git a/gv.c b/gv.c
index c2bc883..2fd88ac 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -667,7 +667,7 @@ Perl_gv_fetchmeth_pvn(pTHX_ HV *stash, const char *name, STRLEN len, I32 level,
     topgen_cmp = HvMROMETA(stash)->cache_gen + PL_sub_generation;
 
     /* check locally for a real method or a cache entry */
-    gvp = (GV**)hv_fetch(stash, name, is_utf8 ? -len : len, create);
+    gvp = (GV**)hv_fetch(stash, name, is_utf8 ? -(I32)len : (I32)len, create);
     if(gvp) {
         topgv = *gvp;
       have_gv:
@@ -726,7 +726,7 @@ Perl_gv_fetchmeth_pvn(pTHX_ HV *stash, const char *name, STRLEN len, I32 level,
 
         assert(cstash);
 
-        gvp = (GV**)hv_fetch(cstash, name, is_utf8 ? -len : len, 0);
+        gvp = (GV**)hv_fetch(cstash, name, is_utf8 ? -(I32)len : (I32)len, 0);
         if (!gvp) {
             if (len > 1 && HvNAMELEN_get(cstash) == 4) {
                 const char *hvname = HvNAME(cstash); assert(hvname);
@@ -864,7 +864,8 @@ Perl_gv_fetchmeth_pvn_autoload(pTHX_ HV *stash, const char *name, STRLEN len, I3
        /* Have an autoload */
        if (level < 0)  /* Cannot do without a stub */
            gv_fetchmeth_pvn(stash, name, len, 0, flags);
-       gvp = (GV**)hv_fetch(stash, name, (flags & SVf_UTF8) ? -len : len, (level >= 0));
+       gvp = (GV**)hv_fetch(stash, name,
+                        (flags & SVf_UTF8) ? -(I32)len : (I32)len, (level >= 0));
        if (!gvp)
            return NULL;
        return *gvp;
@@ -2947,7 +2948,7 @@ Perl_gv_name_set(pTHX_ GV *gv, const char *name, U32 len, U32 flags)
     }
 
     PERL_HASH(hash, name, len);
-    GvNAME_HEK(gv) = share_hek(name, (flags & SVf_UTF8 ? -len : len), hash);
+    GvNAME_HEK(gv) = share_hek(name, (flags & SVf_UTF8 ? -(I32)len : (I32)len), hash);
 }
 
 /*
diff --git a/hv.c b/hv.c
index 2004d3d..01b073d 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -2081,7 +2081,7 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
        spot = &iter->xhv_name_u.xhvnameu_name;
     }
     PERL_HASH(hash, name, len);
-    *spot = name ? share_hek(name, flags & SVf_UTF8 ? -len : len, hash) : NULL;
+    *spot = name ? share_hek(name, flags & SVf_UTF8 ? -(I32)len : (I32)len, hash) : NULL;
 }
 
 /*
@@ -2149,7 +2149,7 @@ Perl_hv_ename_add(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
        if (count < 0) aux->xhv_name_count--, count = -count;
        else aux->xhv_name_count++;
        Renew(aux->xhv_name_u.xhvnameu_names, count + 1, HEK *);
-       (aux->xhv_name_u.xhvnameu_names)[count] = share_hek(name, (flags & SVf_UTF8 ? -len : len), hash);
+       (aux->xhv_name_u.xhvnameu_names)[count] = share_hek(name, (flags & SVf_UTF8 ? -(I32)len : (I32)len), hash);
     }
     else {
        HEK *existing_name = aux->xhv_name_u.xhvnameu_name;
@@ -2163,7 +2163,7 @@ Perl_hv_ename_add(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
        Newx(aux->xhv_name_u.xhvnameu_names, 2, HEK *);
        aux->xhv_name_count = existing_name ? 2 : -2;
        *aux->xhv_name_u.xhvnameu_names = existing_name;
-       (aux->xhv_name_u.xhvnameu_names)[1] = share_hek(name, (flags & SVf_UTF8 ? -len : len), hash);
+       (aux->xhv_name_u.xhvnameu_names)[1] = share_hek(name, (flags & SVf_UTF8 ? -(I32)len : (I32)len), hash);
     }
 }
 
diff --git a/mro.c b/mro.c
index d22b3ca..67c77eb 100644 (file)
--- a/mro.c
+++ b/mro.c
@@ -495,7 +495,7 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
        is UNIVERSAL or one of its parents */
 
     svp = hv_fetch(PL_isarev, stashname,
-                        stashname_utf8 ? -stashname_len : stashname_len, 0);
+                        stashname_utf8 ? -(I32)stashname_len : (I32)stashname_len, 0);
     isarev = svp ? MUTABLE_HV(*svp) : NULL;
 
     if((stashname_len == 9 && strEQ(stashname, "UNIVERSAL"))
@@ -639,7 +639,7 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
           case where it doesn't exist.  */
           
        (void)hv_store(mroisarev, stashname,
-                stashname_utf8 ? -stashname_len : stashname_len, &PL_sv_yes, 0);
+                stashname_utf8 ? -(I32)stashname_len : (I32)stashname_len, &PL_sv_yes, 0);
     }
 
     /* Delete our name from our former parents’ isarevs. */
@@ -668,7 +668,7 @@ S_mro_clean_isarev(pTHX_ HV * const isa, const char * const name,
             svp = hv_fetch(PL_isarev, key, HeKUTF8(iter) ? -klen : klen, 0);
             if(svp) {
                 HV * const isarev = (HV *)*svp;
-                (void)hv_delete(isarev, name, (flags & SVf_UTF8) ? -len : len, G_DISCARD);
+                (void)hv_delete(isarev, name, (flags & SVf_UTF8) ? -(I32)len : (I32)len, G_DISCARD);
                 if(!HvARRAY(isarev) || !HvUSEDKEYS(isarev))
                     (void)hv_delete(PL_isarev, key,
                                         HeKUTF8(iter) ? -klen : klen, G_DISCARD);
@@ -920,7 +920,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
                STRLEN len;
                const char *name = SvPVx_const(*svp++, len);
                if(PL_stashcache)
-                  (void)hv_delete(PL_stashcache, name, name_utf8 ? -len : len, G_DISCARD);
+                  (void)hv_delete(PL_stashcache, name, name_utf8 ? -(I32)len : (I32)len, G_DISCARD);
                hv_ename_delete(oldstash, name, len, name_utf8);
 
                if (!fetched_isarev) {
@@ -936,7 +936,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
                        if(meta->isa && HvARRAY(meta->isa))
                            mro_clean_isarev(meta->isa, name, len, 0, name_utf8);
                        isarev = (HV *)hv_delete(PL_isarev, name,
-                                                    name_utf8 ? -len : len, 0);
+                                                    name_utf8 ? -(I32)len : (I32)len, 0);
                        fetched_isarev=TRUE;
                    }
                }
@@ -1101,7 +1101,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
                 || (len == 1 && key[0] == ':')) {
                    HV * const oldsubstash = GvHV(HeVAL(entry));
                    SV ** const stashentry
-                    = stash ? hv_fetch(stash, key, SvUTF8(keysv) ? -len : len, 0) : NULL;
+                    = stash ? hv_fetch(stash, key, SvUTF8(keysv) ? -(I32)len : (I32)len, 0) : NULL;
                    HV *substash = NULL;
 
                    /* Avoid main::main::main::... */
@@ -1155,7 +1155,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
                        );
                    }
 
-                   (void)hv_store(seen, key, SvUTF8(keysv) ? -len : len, &PL_sv_yes, 0);
+                   (void)hv_store(seen, key, SvUTF8(keysv) ? -(I32)len : (I32)len, &PL_sv_yes, 0);
                }
            }
        }
@@ -1189,7 +1189,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
 
                    /* If this entry was seen when we iterated through the
                       oldstash, skip it. */
-                   if(seen && hv_exists(seen, key, SvUTF8(keysv) ? -len : len)) continue;
+                   if(seen && hv_exists(seen, key, SvUTF8(keysv) ? -(I32)len : (I32)len)) continue;
 
                    /* We get here only if this stash has no corresponding
                       entry in the stash being replaced. */
@@ -1283,7 +1283,7 @@ Perl_mro_method_changed_in(pTHX_ HV *stash)
     const bool stashname_utf8 = HvENAMEUTF8(stash) ? 1 : 0;
 
     SV ** const svp = hv_fetch(PL_isarev, stashname,
-                                    stashname_utf8 ? -stashname_len : stashname_len, 0);
+                                    stashname_utf8 ? -(I32)stashname_len : (I32)stashname_len, 0);
     HV * const isarev = svp ? MUTABLE_HV(*svp) : NULL;
 
     PERL_ARGS_ASSERT_MRO_METHOD_CHANGED_IN;
diff --git a/op.c b/op.c
index 3a3acb8..f9a1262 100644 (file)
--- a/op.c
+++ b/op.c
@@ -6739,9 +6739,9 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
                                          (long)CopLINE(PL_curcop));
            gv_efullname3(tmpstr, gv, NULL);
            (void)hv_store(GvHV(PL_DBsub), SvPVX_const(tmpstr),
-                   SvUTF8(tmpstr) ? -SvCUR(tmpstr) : SvCUR(tmpstr), sv, 0);
+                   SvUTF8(tmpstr) ? -(I32)SvCUR(tmpstr) : (I32)SvCUR(tmpstr), sv, 0);
            hv = GvHVn(db_postponed);
-           if (HvTOTALKEYS(hv) > 0 && hv_exists(hv, SvPVX_const(tmpstr), SvUTF8(tmpstr) ? -SvCUR(tmpstr) : SvCUR(tmpstr))) {
+           if (HvTOTALKEYS(hv) > 0 && hv_exists(hv, SvPVX_const(tmpstr), SvUTF8(tmpstr) ? -(I32)SvCUR(tmpstr) : (I32)SvCUR(tmpstr))) {
                CV * const pcv = GvCV(db_postponed);
                if (pcv) {
                    dSP;
@@ -8351,7 +8351,7 @@ Perl_ck_method(pTHX_ OP *o)
        if (!(strchr(method, ':') || strchr(method, '\''))) {
            OP *cmop;
            if (!SvREADONLY(sv) || !SvFAKE(sv)) {
-               sv = newSVpvn_share(method, SvUTF8(sv) ? -SvCUR(sv) : SvCUR(sv), 0);
+               sv = newSVpvn_share(method, SvUTF8(sv) ? -(I32)SvCUR(sv) : (I32)SvCUR(sv), 0);
            }
            else {
                kSVOP->op_sv = NULL;
index d35462c..692fdeb 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1765,7 +1765,7 @@ Perl_die_unwind(pTHX_ SV *msv)
            if (optype == OP_REQUIRE) {
                 (void)hv_store(GvHVn(PL_incgv),
                                SvPVX_const(namesv),
-                               SvUTF8(namesv) ? -SvCUR(namesv) : SvCUR(namesv),
+                               SvUTF8(namesv) ? -(I32)SvCUR(namesv) : (I32)SvCUR(namesv),
                                &PL_sv_undef, 0);
                /* note that unlike pp_entereval, pp_require isn't
                 * supposed to trap errors. So now that we've popped the
@@ -2480,7 +2480,7 @@ PP(pp_return)
            /* Unassume the success we assumed earlier. */
            (void)hv_delete(GvHVn(PL_incgv),
                            SvPVX_const(namesv),
-                            SvUTF8(namesv) ? -SvCUR(namesv) : SvCUR(namesv),
+                            SvUTF8(namesv) ? -(I32)SvCUR(namesv) : (I32)SvCUR(namesv),
                            G_DISCARD);
            DIE(aTHX_ "%"SVf" did not return a true value", SVfARG(namesv));
        }
@@ -3566,7 +3566,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq)
            }
            (void)hv_store(GvHVn(PL_incgv),
                           SvPVX_const(namesv),
-                           SvUTF8(namesv) ? -SvCUR(namesv) : SvCUR(namesv),
+                           SvUTF8(namesv) ? -(I32)SvCUR(namesv) : (I32)SvCUR(namesv),
                           &PL_sv_undef, 0);
            Perl_croak(aTHX_ "%"SVf"Compilation failed in require",
                       SVfARG(ERRSV
@@ -4276,7 +4276,7 @@ PP(pp_leaveeval)
        /* Unassume the success we assumed earlier. */
        (void)hv_delete(GvHVn(PL_incgv),
                        SvPVX_const(namesv),
-                        SvUTF8(namesv) ? -SvCUR(namesv) : SvCUR(namesv),
+                        SvUTF8(namesv) ? -(I32)SvCUR(namesv) : (I32)SvCUR(namesv),
                        G_DISCARD);
        retop = Perl_die(aTHX_ "%"SVf" did not return a true value",
                               SVfARG(namesv));
index aaff28f..cb4a033 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2991,7 +2991,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
             else {
                SV* const ref = newSViv(PTR2IV(stash));
                (void)hv_store(PL_stashcache, packname,
-                                packname_is_utf8 ? -packlen : packlen, ref, 0);
+                                packname_is_utf8 ? -(I32)packlen : (I32)packlen, ref, 0);
            }
            goto fetch;
        }
diff --git a/proto.h b/proto.h
index 6e9eda4..4da34b9 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -1262,7 +1262,7 @@ PERL_CALLCONV GV* Perl_gv_fetchmethod_pv_flags(pTHX_ HV* stash, const char* name
 #define PERL_ARGS_ASSERT_GV_FETCHMETHOD_PV_FLAGS       \
        assert(stash); assert(name)
 
-PERL_CALLCONV GV*      Perl_gv_fetchmethod_pvn_flags(pTHX_ HV* stash, const char* name, STRLEN len, U32 flags)
+PERL_CALLCONV GV*      Perl_gv_fetchmethod_pvn_flags(pTHX_ HV* stash, const char* name, const STRLEN len, U32 flags)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_GV_FETCHMETHOD_PVN_FLAGS      \
@@ -3834,7 +3834,7 @@ PERL_CALLCONV bool        Perl_sv_derived_from_pv(pTHX_ SV* sv, const char *const name,
 #define PERL_ARGS_ASSERT_SV_DERIVED_FROM_PV    \
        assert(sv); assert(name)
 
-PERL_CALLCONV bool     Perl_sv_derived_from_pvn(pTHX_ SV* sv, const char *const name, STRLEN len, U32 flags)
+PERL_CALLCONV bool     Perl_sv_derived_from_pvn(pTHX_ SV* sv, const char *const name, const STRLEN len, U32 flags)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
diff --git a/toke.c b/toke.c
index 6642af7..755b8b4 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -6475,7 +6475,7 @@ Perl_yylex(pTHX)
                }
                if (!ogv &&
                    (gvp = (GV**)hv_fetch(PL_globalstash, PL_tokenbuf,
-                                            UTF ? -len : len, FALSE)) &&
+                                            UTF ? -(I32)len : (I32)len, FALSE)) &&
                    (gv = *gvp) && isGV_with_GP(gv) &&
                    GvCVu(gv) && GvIMPORTED_CV(gv))
                {