From: Marcus Holland-Moritz Date: Mon, 24 Apr 2006 23:20:38 +0000 (+0200) Subject: Re: [PATCH] cleanup 212 warnings emitted by gcc-4.2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bb7a0f5422600fd7de7806825a1300a577b7e61f;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] cleanup 212 warnings emitted by gcc-4.2 Message-ID: <20060424232038.7550f9b6@r2d2> p4raw-id: //depot/perl@27962 --- diff --git a/deb.c b/deb.c index 3907201..1d3de4c 100644 --- a/deb.c +++ b/deb.c @@ -203,8 +203,8 @@ Perl_deb_stack_all(pTHX) si_ix=0; for (;;) { - const int si_name_ix = si->si_type+1; /* -1 is a valid index */ - const char * const si_name = (si_name_ix>= sizeof(si_names)) ? "????" : si_names[si_name_ix]; + const size_t si_name_ix = si->si_type+1; /* -1 is a valid index */ + const char * const si_name = (si_name_ix >= sizeof(si_names)) ? "????" : si_names[si_name_ix]; I32 ix; PerlIO_printf(Perl_debug_log, "STACK %"IVdf": %s\n", (IV)si_ix, si_name); diff --git a/doio.c b/doio.c index 6910cf1..2237f43 100644 --- a/doio.c +++ b/doio.c @@ -2251,7 +2251,7 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp) SETERRNO(0,0); if (shmctl(id, IPC_STAT, &shmds) == -1) return -1; - if (mpos < 0 || msize < 0 || mpos + msize > shmds.shm_segsz) { + if (mpos < 0 || msize < 0 || (size_t)mpos + msize > shmds.shm_segsz) { SETERRNO(EFAULT,SS_ACCVIO); /* can't do as caller requested */ return -1; } @@ -2264,7 +2264,7 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp) if (! SvOK(mstr)) sv_setpvn(mstr, "", 0); SvPV_force_nolen(mstr); - mbuf = SvGROW(mstr, msize+1); + mbuf = SvGROW(mstr, (STRLEN)msize+1); Copy(shm + mpos, mbuf, msize, char); SvCUR_set(mstr, msize); diff --git a/doop.c b/doop.c index 9583e04..45437e1 100644 --- a/doop.c +++ b/doop.c @@ -215,7 +215,7 @@ S_do_trans_complex(pTHX_ SV * const sv) else { matches++; if (!del) { - ch = (rlen == 0) ? comp : + ch = (rlen == 0) ? (I32)comp : (comp - 0x100 < rlen) ? tbl[comp+1] : tbl[0x100+rlen]; if ((UV)ch != pch) { @@ -726,7 +726,7 @@ UV Perl_do_vecget(pTHX_ SV *sv, I32 offset, I32 size) { dVAR; - STRLEN srclen, len; + STRLEN srclen, len, uoffset; const unsigned char *s = (const unsigned char *) SvPV_const(sv, srclen); UV retnum = 0; @@ -738,118 +738,118 @@ Perl_do_vecget(pTHX_ SV *sv, I32 offset, I32 size) if (SvUTF8(sv)) (void) Perl_sv_utf8_downgrade(aTHX_ sv, TRUE); - offset *= size; /* turn into bit offset */ - len = (offset + size + 7) / 8; /* required number of bytes */ + uoffset = offset*size; /* turn into bit offset */ + len = (uoffset + size + 7) / 8; /* required number of bytes */ if (len > srclen) { if (size <= 8) retnum = 0; else { - offset >>= 3; /* turn into byte offset */ + uoffset >>= 3; /* turn into byte offset */ if (size == 16) { - if ((STRLEN)offset >= srclen) + if (uoffset >= srclen) retnum = 0; else - retnum = (UV) s[offset] << 8; + retnum = (UV) s[uoffset] << 8; } else if (size == 32) { - if ((STRLEN)offset >= srclen) + if (uoffset >= srclen) retnum = 0; - else if ((STRLEN)(offset + 1) >= srclen) + else if (uoffset + 1 >= srclen) retnum = - ((UV) s[offset ] << 24); - else if ((STRLEN)(offset + 2) >= srclen) + ((UV) s[uoffset ] << 24); + else if (uoffset + 2 >= srclen) retnum = - ((UV) s[offset ] << 24) + - ((UV) s[offset + 1] << 16); + ((UV) s[uoffset ] << 24) + + ((UV) s[uoffset + 1] << 16); else retnum = - ((UV) s[offset ] << 24) + - ((UV) s[offset + 1] << 16) + - ( s[offset + 2] << 8); + ((UV) s[uoffset ] << 24) + + ((UV) s[uoffset + 1] << 16) + + ( s[uoffset + 2] << 8); } #ifdef UV_IS_QUAD else if (size == 64) { if (ckWARN(WARN_PORTABLE)) Perl_warner(aTHX_ packWARN(WARN_PORTABLE), "Bit vector size > 32 non-portable"); - if (offset >= srclen) + if (uoffset >= srclen) retnum = 0; - else if (offset + 1 >= srclen) + else if (uoffset + 1 >= srclen) retnum = - (UV) s[offset ] << 56; - else if (offset + 2 >= srclen) + (UV) s[uoffset ] << 56; + else if (uoffset + 2 >= srclen) retnum = - ((UV) s[offset ] << 56) + - ((UV) s[offset + 1] << 48); - else if (offset + 3 >= srclen) + ((UV) s[uoffset ] << 56) + + ((UV) s[uoffset + 1] << 48); + else if (uoffset + 3 >= srclen) retnum = - ((UV) s[offset ] << 56) + - ((UV) s[offset + 1] << 48) + - ((UV) s[offset + 2] << 40); - else if (offset + 4 >= srclen) + ((UV) s[uoffset ] << 56) + + ((UV) s[uoffset + 1] << 48) + + ((UV) s[uoffset + 2] << 40); + else if (uoffset + 4 >= srclen) retnum = - ((UV) s[offset ] << 56) + - ((UV) s[offset + 1] << 48) + - ((UV) s[offset + 2] << 40) + - ((UV) s[offset + 3] << 32); - else if (offset + 5 >= srclen) + ((UV) s[uoffset ] << 56) + + ((UV) s[uoffset + 1] << 48) + + ((UV) s[uoffset + 2] << 40) + + ((UV) s[uoffset + 3] << 32); + else if (uoffset + 5 >= srclen) retnum = - ((UV) s[offset ] << 56) + - ((UV) s[offset + 1] << 48) + - ((UV) s[offset + 2] << 40) + - ((UV) s[offset + 3] << 32) + - ( s[offset + 4] << 24); - else if (offset + 6 >= srclen) + ((UV) s[uoffset ] << 56) + + ((UV) s[uoffset + 1] << 48) + + ((UV) s[uoffset + 2] << 40) + + ((UV) s[uoffset + 3] << 32) + + ( s[uoffset + 4] << 24); + else if (uoffset + 6 >= srclen) retnum = - ((UV) s[offset ] << 56) + - ((UV) s[offset + 1] << 48) + - ((UV) s[offset + 2] << 40) + - ((UV) s[offset + 3] << 32) + - ((UV) s[offset + 4] << 24) + - ((UV) s[offset + 5] << 16); + ((UV) s[uoffset ] << 56) + + ((UV) s[uoffset + 1] << 48) + + ((UV) s[uoffset + 2] << 40) + + ((UV) s[uoffset + 3] << 32) + + ((UV) s[uoffset + 4] << 24) + + ((UV) s[uoffset + 5] << 16); else retnum = - ((UV) s[offset ] << 56) + - ((UV) s[offset + 1] << 48) + - ((UV) s[offset + 2] << 40) + - ((UV) s[offset + 3] << 32) + - ((UV) s[offset + 4] << 24) + - ((UV) s[offset + 5] << 16) + - ( s[offset + 6] << 8); + ((UV) s[uoffset ] << 56) + + ((UV) s[uoffset + 1] << 48) + + ((UV) s[uoffset + 2] << 40) + + ((UV) s[uoffset + 3] << 32) + + ((UV) s[uoffset + 4] << 24) + + ((UV) s[uoffset + 5] << 16) + + ( s[uoffset + 6] << 8); } #endif } } else if (size < 8) - retnum = (s[offset >> 3] >> (offset & 7)) & ((1 << size) - 1); + retnum = (s[uoffset >> 3] >> (uoffset & 7)) & ((1 << size) - 1); else { - offset >>= 3; /* turn into byte offset */ + uoffset >>= 3; /* turn into byte offset */ if (size == 8) - retnum = s[offset]; + retnum = s[uoffset]; else if (size == 16) retnum = - ((UV) s[offset] << 8) + - s[offset + 1]; + ((UV) s[uoffset] << 8) + + s[uoffset + 1]; else if (size == 32) retnum = - ((UV) s[offset ] << 24) + - ((UV) s[offset + 1] << 16) + - ( s[offset + 2] << 8) + - s[offset + 3]; + ((UV) s[uoffset ] << 24) + + ((UV) s[uoffset + 1] << 16) + + ( s[uoffset + 2] << 8) + + s[uoffset + 3]; #ifdef UV_IS_QUAD else if (size == 64) { if (ckWARN(WARN_PORTABLE)) Perl_warner(aTHX_ packWARN(WARN_PORTABLE), "Bit vector size > 32 non-portable"); retnum = - ((UV) s[offset ] << 56) + - ((UV) s[offset + 1] << 48) + - ((UV) s[offset + 2] << 40) + - ((UV) s[offset + 3] << 32) + - ((UV) s[offset + 4] << 24) + - ((UV) s[offset + 5] << 16) + - ( s[offset + 6] << 8) + - s[offset + 7]; + ((UV) s[uoffset ] << 56) + + ((UV) s[uoffset + 1] << 48) + + ((UV) s[uoffset + 2] << 40) + + ((UV) s[uoffset + 3] << 32) + + ((UV) s[uoffset + 4] << 24) + + ((UV) s[uoffset + 5] << 16) + + ( s[uoffset + 6] << 8) + + s[uoffset + 7]; } #endif } @@ -1169,13 +1169,13 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) STRLEN rightlen; register const char *lc; register const char *rc; - register I32 len; - I32 lensave; + register STRLEN len; + STRLEN lensave; const char *lsave; const char *rsave; const bool left_utf = DO_UTF8(left); const bool right_utf = DO_UTF8(right); - I32 needlen = 0; + STRLEN needlen = 0; if (left_utf && !right_utf) sv_utf8_upgrade(right); @@ -1196,16 +1196,16 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) } else if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) { dc = SvPV_force_nomg_nolen(sv); - if (SvLEN(sv) < (STRLEN)(len + 1)) { - dc = SvGROW(sv, (STRLEN)(len + 1)); + if (SvLEN(sv) < len + 1) { + dc = SvGROW(sv, len + 1); (void)memzero(dc + SvCUR(sv), len - SvCUR(sv) + 1); } if (optype != OP_BIT_AND && (left_utf || right_utf)) dc = SvGROW(sv, leftlen + rightlen + 1); } else { - needlen = ((optype == OP_BIT_AND) - ? len : (leftlen > rightlen ? leftlen : rightlen)); + needlen = optype == OP_BIT_AND + ? len : (leftlen > rightlen ? leftlen : rightlen); Newxz(dc, needlen + 1, char); sv_usepvn_flags(sv, dc, needlen, SV_HAS_TRAILING_NUL); dc = SvPVX(sv); /* sv_usepvn() calls Renew() */ @@ -1285,11 +1285,11 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) else #ifdef LIBERAL if (len >= sizeof(long)*4 && - !((long)dc % sizeof(long)) && - !((long)lc % sizeof(long)) && - !((long)rc % sizeof(long))) /* It's almost always aligned... */ + !((unsigned long)dc % sizeof(long)) && + !((unsigned long)lc % sizeof(long)) && + !((unsigned long)rc % sizeof(long))) /* It's almost always aligned... */ { - const I32 remainder = len % (sizeof(long)*4); + const STRLEN remainder = len % (sizeof(long)*4); len /= (sizeof(long)*4); dl = (long*)dc; @@ -1345,7 +1345,7 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) *dc++ = *lc++ | *rc++; mop_up: len = lensave; - if (rightlen > (STRLEN)len) + if (rightlen > len) sv_catpvn(sv, rsave + len, rightlen - len); else if (leftlen > (STRLEN)len) sv_catpvn(sv, lsave + len, leftlen - len); diff --git a/dump.c b/dump.c index 4635eef..e475a0f 100644 --- a/dump.c +++ b/dump.c @@ -1448,7 +1448,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo if (HvARRAY(sv) && HvKEYS(sv)) { /* Show distribution of HEs in the ARRAY */ int freq[200]; -#define FREQ_MAX (sizeof freq / sizeof freq[0] - 1) +#define FREQ_MAX ((int)(sizeof freq / sizeof freq[0] - 1)) int i; int max = 0; U32 pow2 = 2, keys = HvKEYS(sv); diff --git a/gv.c b/gv.c index 5d1991a..f7e4c75 100644 --- a/gv.c +++ b/gv.c @@ -799,7 +799,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, char smallbuf[128]; char *tmpbuf; - if (len + 3 < sizeof (smallbuf)) + if (len + 3 < (I32)sizeof (smallbuf)) tmpbuf = smallbuf; else Newx(tmpbuf, len+3, char); diff --git a/handy.h b/handy.h index db9e006..30a287a 100644 --- a/handy.h +++ b/handy.h @@ -644,7 +644,7 @@ PoisonWith(0xEF) for catching access to freed memory. #ifdef PERL_MALLOC_WRAP #define MEM_WRAP_CHECK(n,t) MEM_WRAP_CHECK_1(n,t,PL_memory_wrap) #define MEM_WRAP_CHECK_1(n,t,a) \ - (void)(sizeof(t) > 1 && (n) > ((MEM_SIZE)~0)/sizeof(t) && (Perl_croak_nocontext(a),0)) + (void)(sizeof(t) > 1 && (MEM_SIZE)(n) > ((MEM_SIZE)~0)/sizeof(t) && (Perl_croak_nocontext(a),0)) #define MEM_WRAP_CHECK_(n,t) MEM_WRAP_CHECK(n,t), #define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > (MEM_SIZE)~0 - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (Perl_croak_nocontext(PL_memory_wrap),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1))) diff --git a/lib/ExtUtils/Constant/ProxySubs.pm b/lib/ExtUtils/Constant/ProxySubs.pm index a358a66..9b07372 100644 --- a/lib/ExtUtils/Constant/ProxySubs.pm +++ b/lib/ExtUtils/Constant/ProxySubs.pm @@ -9,7 +9,7 @@ require ExtUtils::Constant::XS; use ExtUtils::Constant::Utils qw(C_stringify); use ExtUtils::Constant::XS qw(%XS_TypeSet); -$VERSION = '0.02'; +$VERSION = '0.03'; @ISA = 'ExtUtils::Constant::XS'; %type_to_struct = @@ -456,7 +456,7 @@ $xs_subname(sv) SV * sv; const char * s = SvPV(sv, len); PPCODE: - if (hv_exists(${c_subname}_missing, s, SvUTF8(sv) ? -(I32)len : len)) { + if (hv_exists(${c_subname}_missing, s, SvUTF8(sv) ? -(I32)len : (I32)len)) { sv = newSVpvf("Your vendor has not defined $package_sprintf_safe macro %" SVf ", used", sv); } else { diff --git a/mg.c b/mg.c index 30545fc..b63a87c 100644 --- a/mg.c +++ b/mg.c @@ -1102,7 +1102,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg) s = delimcpy(tmpbuf, tmpbuf + sizeof tmpbuf, s, strend, ':', &i); s++; - if (i >= sizeof tmpbuf /* too long -- assume the worst */ + if (i >= (I32)sizeof tmpbuf /* too long -- assume the worst */ || *tmpbuf != '/' || (PerlLIO_stat(tmpbuf, &st) == 0 && (st.st_mode & 2)) ) { MgTAINTEDDIR_on(mg); diff --git a/op.c b/op.c index a8d805c..3c44f96 100644 --- a/op.c +++ b/op.c @@ -7820,7 +7820,7 @@ Perl_peep(pTHX_ register OP *o) if ((!SvFAKE(sv = *svp) || !SvREADONLY(sv)) && !IS_PADCONST(sv)) { key = SvPV_const(sv, keylen); lexname = newSVpvn_share(key, - SvUTF8(sv) ? -(I32)keylen : keylen, + SvUTF8(sv) ? -(I32)keylen : (I32)keylen, 0); SvREFCNT_dec(sv); *svp = lexname; @@ -7840,7 +7840,7 @@ Perl_peep(pTHX_ register OP *o) break; key = SvPV_const(*svp, keylen); if (!hv_fetch(GvHV(*fields), key, - SvUTF8(*svp) ? -(I32)keylen : keylen, FALSE)) + SvUTF8(*svp) ? -(I32)keylen : (I32)keylen, FALSE)) { Perl_croak(aTHX_ "No such class field \"%s\" " "in variable %s of type %s", @@ -7897,7 +7897,7 @@ Perl_peep(pTHX_ register OP *o) svp = cSVOPx_svp(key_op); key = SvPV_const(*svp, keylen); if (!hv_fetch(GvHV(*fields), key, - SvUTF8(*svp) ? -(I32)keylen : keylen, FALSE)) + SvUTF8(*svp) ? -(I32)keylen : (I32)keylen, FALSE)) { Perl_croak(aTHX_ "No such class field \"%s\" " "in variable %s of type %s", diff --git a/patchlevel.h b/patchlevel.h index 6cdd639..0362c41 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -125,7 +125,7 @@ static const char * const local_patches[] = { /* Initial space prevents this variable from being inserted in config.sh */ # define LOCAL_PATCH_COUNT \ - (sizeof(local_patches)/sizeof(local_patches[0])-2) + ((int)(sizeof(local_patches)/sizeof(local_patches[0])-2)) /* the old terms of reference, add them only when explicitly included */ #define PATCHLEVEL PERL_VERSION diff --git a/perl.c b/perl.c index 184261a..a818a7b 100644 --- a/perl.c +++ b/perl.c @@ -3285,7 +3285,7 @@ Perl_moreswitches(pTHX_ char *s) PerlIO_printf(PerlIO_stdout(), "\n(with %d registered patch%s, " "see perl -V for more detail)", - (int)LOCAL_PATCH_COUNT, + LOCAL_PATCH_COUNT, (LOCAL_PATCH_COUNT!=1) ? "es" : ""); #endif diff --git a/perlio.c b/perlio.c index 96bf588..299d830 100644 --- a/perlio.c +++ b/perlio.c @@ -2104,7 +2104,7 @@ PerlIOBase_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) SSize_t avail = PerlIO_get_cnt(f); SSize_t take = 0; if (avail > 0) - take = ((SSize_t)count < avail) ? count : avail; + take = ((SSize_t)count < avail) ? (SSize_t)count : avail; if (take > 0) { STDCHAR *ptr = PerlIO_get_ptr(f); Copy(ptr, buf, take, STDCHAR); diff --git a/pp.c b/pp.c index 33ac9f4..356bfec 100644 --- a/pp.c +++ b/pp.c @@ -2488,7 +2488,7 @@ PP(pp_complement) for ( ; anum && (unsigned long)tmps % sizeof(long); anum--, tmps++) *tmps = ~*tmps; tmpl = (long*)tmps; - for ( ; anum >= sizeof(long); anum -= sizeof(long), tmpl++) + for ( ; anum >= (I32)sizeof(long); anum -= (I32)sizeof(long), tmpl++) *tmpl = ~*tmpl; tmps = (U8*)tmpl; } @@ -4412,7 +4412,7 @@ PP(pp_split) register SV *dstr; register const char *m; I32 iters = 0; - const STRLEN slen = do_utf8 ? utf8_length((U8*)s, (U8*)strend) : (strend - s); + const STRLEN slen = do_utf8 ? utf8_length((U8*)s, (U8*)strend) : (STRLEN)(strend - s); I32 maxiters = slen + 10; const char *orig; const I32 origlimit = limit; diff --git a/pp_ctl.c b/pp_ctl.c index 5e44789..dd7d122 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -4541,6 +4541,10 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) const char *got_p; const char *prune_from = NULL; bool read_from_cache = FALSE; + STRLEN umaxlen; + + assert(maxlen >= 0); + umaxlen = maxlen; /* I was having segfault trouble under Linux 2.2.5 after a parse error occured. (Had to hack around it with a test @@ -4554,13 +4558,13 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) const char *cache_p = SvPV(cache, cache_len); STRLEN take = 0; - if (maxlen) { + if (umaxlen) { /* Running in block mode and we have some cached data already. */ - if (cache_len >= maxlen) { + if (cache_len >= umaxlen) { /* In fact, so much data we don't even need to call filter_read. */ - take = maxlen; + take = umaxlen; } } else { const char *const first_nl = memchr(cache_p, '\n', cache_len); @@ -4576,8 +4580,8 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) } sv_catsv(buf_sv, cache); - if (maxlen) { - maxlen -= cache_len; + if (umaxlen) { + umaxlen -= cache_len; } SvOK_off(cache); read_from_cache = TRUE; @@ -4630,9 +4634,9 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) if(SvOK(upstream)) { got_p = SvPV(upstream, got_len); - if (maxlen) { - if (got_len > maxlen) { - prune_from = got_p + maxlen; + if (umaxlen) { + if (got_len > umaxlen) { + prune_from = got_p + umaxlen; } } else { const char *const first_nl = memchr(got_p, '\n', got_len); @@ -4648,7 +4652,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) SV *cache = (SV *)IoFMT_GV(datasv); if (!cache) { - IoFMT_GV(datasv) = (GV*) (cache = newSV(got_len - maxlen)); + IoFMT_GV(datasv) = (GV*) (cache = newSV(got_len - umaxlen)); } else if (SvOK(cache)) { /* Cache should be empty. */ assert(!SvCUR(cache)); diff --git a/pp_hot.c b/pp_hot.c index 25f055e..1e167a5 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1825,7 +1825,7 @@ PP(pp_helem) STRLEN keylen; const char * const key = SvPV_const(keysv, keylen); SAVEDELETE(hv, savepvn(key,keylen), - SvUTF8(keysv) ? -(I32)keylen : keylen); + SvUTF8(keysv) ? -(I32)keylen : (I32)keylen); } else save_helem(hv, keysv, svp); } diff --git a/pp_sys.c b/pp_sys.c index 5c9bfea..f8ba4e9 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4013,7 +4013,8 @@ PP(pp_system) SP = ORIGMARK; if (did_pipes) { int errkid; - int n = 0, n1; + unsigned n = 0; + SSize_t n1; while (n < sizeof(int)) { n1 = PerlLIO_read(pp[0], diff --git a/regcomp.c b/regcomp.c index 2c5ff0a..8a2ad3a 100644 --- a/regcomp.c +++ b/regcomp.c @@ -5863,7 +5863,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o) } if (o->flags & ANYOF_CLASS) - for (i = 0; i < sizeof(anyofs)/sizeof(char*); i++) + for (i = 0; i < (int)(sizeof(anyofs)/sizeof(char*)); i++) if (ANYOF_CLASS_TEST(o,i)) sv_catpv(sv, anyofs[i]); diff --git a/regexec.c b/regexec.c index e2fc13e..580ad5e 100644 --- a/regexec.c +++ b/regexec.c @@ -233,7 +233,7 @@ S_regcppop(pTHX_ const regexp *rex) ); } DEBUG_EXECUTE_r( - if ((I32)(*PL_reglastparen + 1) <= rex->nparens) { + if (*PL_reglastparen + 1 <= rex->nparens) { PerlIO_printf(Perl_debug_log, " restoring \\%"IVdf"..\\%"IVdf" to undef\n", (IV)(*PL_reglastparen + 1), (IV)rex->nparens); @@ -250,7 +250,7 @@ S_regcppop(pTHX_ const regexp *rex) * building DynaLoader will fail: * "Error: '*' not in typemap in DynaLoader.xs, line 164" * --jhi */ - for (i = *PL_reglastparen + 1; i <= rex->nparens; i++) { + for (i = *PL_reglastparen + 1; (U32)i <= rex->nparens; i++) { if (i > PL_regsize) PL_regstartp[i] = -1; PL_regendp[i] = -1; @@ -383,7 +383,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, sv_uni_display(dsv, sv, 60, UNI_DISPLAY_REGEX) : strpos; const int len = PL_reg_match_utf8 ? - strlen(s) : strend - strpos; + (int)strlen(s) : strend - strpos; if (!PL_colorset) reginitcolors(); if (PL_reg_match_utf8) @@ -1146,7 +1146,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char LOAD_UTF8_CHARCLASS_ALNUM(); while (s + (uskip = UTF8SKIP(s)) <= strend) { if (tmp == !(OP(c) == BOUND ? - swash_fetch(PL_utf8_alnum, (U8*)s, do_utf8) : + (bool)swash_fetch(PL_utf8_alnum, (U8*)s, do_utf8) : isALNUM_LC_utf8((U8*)s))) { tmp = !tmp; @@ -1188,7 +1188,7 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char LOAD_UTF8_CHARCLASS_ALNUM(); while (s + (uskip = UTF8SKIP(s)) <= strend) { if (tmp == !(OP(c) == NBOUND ? - swash_fetch(PL_utf8_alnum, (U8*)s, do_utf8) : + (bool)swash_fetch(PL_utf8_alnum, (U8*)s, do_utf8) : isALNUM_LC_utf8((U8*)s))) tmp = !tmp; else if ((!reginfo || regtry(reginfo, s))) @@ -1689,10 +1689,10 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * ? pv_uni_display(dsv0, (U8*)prog->precomp, prog->prelen, 60, UNI_DISPLAY_REGEX) : prog->precomp; - const int len0 = UTF ? SvCUR(dsv0) : prog->prelen; + const int len0 = UTF ? (int)SvCUR(dsv0) : prog->prelen; const char * const s1 = do_utf8 ? sv_uni_display(dsv1, sv, 60, UNI_DISPLAY_REGEX) : startpos; - const int len1 = do_utf8 ? SvCUR(dsv1) : strend - startpos; + const int len1 = do_utf8 ? (int)SvCUR(dsv1) : strend - startpos; if (!PL_colorset) reginitcolors(); PerlIO_printf(Perl_debug_log, @@ -1910,7 +1910,7 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * len0 = UTF ? SvCUR(dsv0) : SvCUR(prop); s1 = UTF ? sv_uni_display(dsv1, sv, 60, UNI_DISPLAY_REGEX) : s; - len1 = UTF ? SvCUR(dsv1) : strend - s; + len1 = UTF ? (int)SvCUR(dsv1) : strend - s; PerlIO_printf(Perl_debug_log, "Matching stclass \"%*.*s\" against \"%*.*s\"\n", len0, len0, s0, @@ -2561,18 +2561,18 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) pv_uni_display(PERL_DEBUG_PAD(0), (U8*)(locinput - pref_len), pref0_len, 60, UNI_DISPLAY_REGEX) : locinput - pref_len; - const int len0 = do_utf8 ? strlen(s0) : pref0_len; + const int len0 = do_utf8 ? (int)strlen(s0) : pref0_len; const char * const s1 = do_utf8 && OP(scan) != CANY ? pv_uni_display(PERL_DEBUG_PAD(1), (U8*)(locinput - pref_len + pref0_len), pref_len - pref0_len, 60, UNI_DISPLAY_REGEX) : locinput - pref_len + pref0_len; - const int len1 = do_utf8 ? strlen(s1) : pref_len - pref0_len; + const int len1 = do_utf8 ? (int)strlen(s1) : pref_len - pref0_len; const char * const s2 = do_utf8 && OP(scan) != CANY ? pv_uni_display(PERL_DEBUG_PAD(2), (U8*)locinput, PL_regeol - locinput, 60, UNI_DISPLAY_REGEX) : locinput; - const int len2 = do_utf8 ? strlen(s2) : l; + const int len2 = do_utf8 ? (int)strlen(s2) : l; PerlIO_printf(Perl_debug_log, "%4"IVdf" <%s%.*s%s%s%.*s%s%s%s%.*s%s>%*s|%3"IVdf":%*s%s\n", (IV)(locinput - PL_bostr), @@ -3041,7 +3041,7 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) if (do_utf8) { LOAD_UTF8_CHARCLASS_ALNUM(); if (!(OP(scan) == ALNUM - ? swash_fetch(PL_utf8_alnum, (U8*)locinput, do_utf8) + ? (bool)swash_fetch(PL_utf8_alnum, (U8*)locinput, do_utf8) : isALNUM_LC_utf8((U8*)locinput))) { sayNO; @@ -3064,7 +3064,7 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) if (do_utf8) { LOAD_UTF8_CHARCLASS_ALNUM(); if (OP(scan) == NALNUM - ? swash_fetch(PL_utf8_alnum, (U8*)locinput, do_utf8) + ? (bool)swash_fetch(PL_utf8_alnum, (U8*)locinput, do_utf8) : isALNUM_LC_utf8((U8*)locinput)) { sayNO; @@ -3129,7 +3129,7 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) if (UTF8_IS_CONTINUED(nextchr)) { LOAD_UTF8_CHARCLASS_SPACE(); if (!(OP(scan) == SPACE - ? swash_fetch(PL_utf8_space, (U8*)locinput, do_utf8) + ? (bool)swash_fetch(PL_utf8_space, (U8*)locinput, do_utf8) : isSPACE_LC_utf8((U8*)locinput))) { sayNO; @@ -3159,7 +3159,7 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) if (do_utf8) { LOAD_UTF8_CHARCLASS_SPACE(); if (OP(scan) == NSPACE - ? swash_fetch(PL_utf8_space, (U8*)locinput, do_utf8) + ? (bool)swash_fetch(PL_utf8_space, (U8*)locinput, do_utf8) : isSPACE_LC_utf8((U8*)locinput)) { sayNO; @@ -3182,7 +3182,7 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) if (do_utf8) { LOAD_UTF8_CHARCLASS_DIGIT(); if (!(OP(scan) == DIGIT - ? swash_fetch(PL_utf8_digit, (U8*)locinput, do_utf8) + ? (bool)swash_fetch(PL_utf8_digit, (U8*)locinput, do_utf8) : isDIGIT_LC_utf8((U8*)locinput))) { sayNO; @@ -3205,7 +3205,7 @@ S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog) if (do_utf8) { LOAD_UTF8_CHARCLASS_DIGIT(); if (OP(scan) == NDIGIT - ? swash_fetch(PL_utf8_digit, (U8*)locinput, do_utf8) + ? (bool)swash_fetch(PL_utf8_digit, (U8*)locinput, do_utf8) : isDIGIT_LC_utf8((U8*)locinput)) { sayNO; diff --git a/scope.h b/scope.h index 1506e5e..b18b84e 100644 --- a/scope.h +++ b/scope.h @@ -57,8 +57,8 @@ #define SCOPE_SAVES_SIGNAL_MASK 0 #endif -#define SSCHECK(need) if (PL_savestack_ix + (need) > PL_savestack_max) savestack_grow() -#define SSGROW(need) if (PL_savestack_ix + (need) > PL_savestack_max) savestack_grow_cnt(need) +#define SSCHECK(need) if (PL_savestack_ix + (I32)(need) > PL_savestack_max) savestack_grow() +#define SSGROW(need) if (PL_savestack_ix + (I32)(need) > PL_savestack_max) savestack_grow_cnt(need) #define SSPUSHINT(i) (PL_savestack[PL_savestack_ix++].any_i32 = (I32)(i)) #define SSPUSHLONG(i) (PL_savestack[PL_savestack_ix++].any_long = (long)(i)) #define SSPUSHBOOL(p) (PL_savestack[PL_savestack_ix++].any_bool = (p)) diff --git a/sv.c b/sv.c index 7d9d8ed..71e871a 100644 --- a/sv.c +++ b/sv.c @@ -6528,7 +6528,7 @@ screamer2: * * - jik 9/25/96 */ - if (!(cnt < sizeof(buf) && PerlIO_eof(fp))) + if (!(cnt < (I32)sizeof(buf) && PerlIO_eof(fp))) goto screamer2; } @@ -10923,7 +10923,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, SvREFCNT(&PL_sv_no) = (~(U32)0)/2; SvFLAGS(&PL_sv_no) = SVp_IOK|SVf_IOK|SVp_NOK|SVf_NOK |SVp_POK|SVf_POK|SVf_READONLY|SVt_PVNV; - SvPV_set(&PL_sv_no, SAVEPVN(PL_No, 0)); + SvPV_set(&PL_sv_no, savepvn(PL_No, 0)); SvCUR_set(&PL_sv_no, 0); SvLEN_set(&PL_sv_no, 1); SvIV_set(&PL_sv_no, 0); @@ -10934,7 +10934,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, SvREFCNT(&PL_sv_yes) = (~(U32)0)/2; SvFLAGS(&PL_sv_yes) = SVp_IOK|SVf_IOK|SVp_NOK|SVf_NOK |SVp_POK|SVf_POK|SVf_READONLY|SVt_PVNV; - SvPV_set(&PL_sv_yes, SAVEPVN(PL_Yes, 1)); + SvPV_set(&PL_sv_yes, savepvn(PL_Yes, 1)); SvCUR_set(&PL_sv_yes, 1); SvLEN_set(&PL_sv_yes, 2); SvIV_set(&PL_sv_yes, 1); diff --git a/toke.c b/toke.c index 8bffe0a..fc997ad 100644 --- a/toke.c +++ b/toke.c @@ -11088,7 +11088,7 @@ S_scan_inputsymbol(pTHX_ char *start) or if it didn't end, or if we see a newline */ - if (len >= sizeof PL_tokenbuf) + if (len >= (I32)sizeof PL_tokenbuf) Perl_croak(aTHX_ "Excessively long <> operator"); if (s >= end) Perl_croak(aTHX_ "Unterminated <> operator"); diff --git a/util.c b/util.c index 02c9e2e..c003291 100644 --- a/util.c +++ b/util.c @@ -1894,8 +1894,8 @@ Perl_my_ntohl(pTHX_ long l) type value; \ char c[sizeof(type)]; \ } u; \ - register I32 i; \ - register I32 s = 0; \ + register U32 i; \ + register U32 s = 0; \ for (i = 0; i < sizeof(u.c); i++, s += 8) { \ u.c[i] = (n >> s) & 0xFF; \ } \ @@ -1910,8 +1910,8 @@ Perl_my_ntohl(pTHX_ long l) type value; \ char c[sizeof(type)]; \ } u; \ - register I32 i; \ - register I32 s = 0; \ + register U32 i; \ + register U32 s = 0; \ u.value = n; \ n = 0; \ for (i = 0; i < sizeof(u.c); i++, s += 8) { \ @@ -1932,8 +1932,8 @@ Perl_my_ntohl(pTHX_ long l) type value; \ char c[sizeof(type)]; \ } u; \ - register I32 i; \ - register I32 s = 8*(sizeof(u.c)-1); \ + register U32 i; \ + register U32 s = 8*(sizeof(u.c)-1); \ for (i = 0; i < sizeof(u.c); i++, s -= 8) { \ u.c[i] = (n >> s) & 0xFF; \ } \ @@ -1948,8 +1948,8 @@ Perl_my_ntohl(pTHX_ long l) type value; \ char c[sizeof(type)]; \ } u; \ - register I32 i; \ - register I32 s = 8*(sizeof(u.c)-1); \ + register U32 i; \ + register U32 s = 8*(sizeof(u.c)-1); \ u.value = n; \ n = 0; \ for (i = 0; i < sizeof(u.c); i++, s -= 8) { \ @@ -2224,7 +2224,8 @@ Perl_my_popen_list(pTHX_ char *mode, int n, SV **args) /* If we managed to get status pipe check for exec fail */ if (did_pipes && pid > 0) { int errkid; - int n = 0, n1; + unsigned n = 0; + SSize_t n1; while (n < sizeof(int)) { n1 = PerlLIO_read(pp[0], @@ -2376,7 +2377,8 @@ Perl_my_popen(pTHX_ const char *cmd, const char *mode) PL_forkprocess = pid; if (did_pipes && pid > 0) { int errkid; - int n = 0, n1; + unsigned n = 0; + SSize_t n1; while (n < sizeof(int)) { n1 = PerlLIO_read(pp[0],