From: Gurusamy Sarathy Date: Sun, 21 Apr 2002 19:53:08 +0000 (+0000) Subject: fixes for all the warnings reported by Visual C (most of this X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eb160463266f58ba83ae9bb9ae8bbdc8f0c3027b;p=p5sagit%2Fp5-mst-13.2.git fixes for all the warnings reported by Visual C (most of this change is from change#12026) p4raw-link: @12026 on //depot/maint-5.6/perl: ff42b73b40f5a895aef4bed81c794f468e0609bc p4raw-id: //depot/perl@16048 --- diff --git a/av.c b/av.c index 4566cb2..5d59642 100644 --- a/av.c +++ b/av.c @@ -119,7 +119,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key) bytes = (newmax + 1) * sizeof(SV*); #define MALLOC_OVERHEAD 16 itmp = MALLOC_OVERHEAD; - while (itmp - MALLOC_OVERHEAD < bytes) + while ((MEM_SIZE)(itmp - MALLOC_OVERHEAD) < bytes) itmp += itmp; itmp -= MALLOC_OVERHEAD; itmp /= sizeof(SV*); diff --git a/cop.h b/cop.h index 3b2699e..bee1b6a 100644 --- a/cop.h +++ b/cop.h @@ -119,7 +119,7 @@ struct block_sub { #define PUSHSUB(cx) \ cx->blk_sub.cv = cv; \ - cx->blk_sub.olddepth = CvDEPTH(cv); \ + cx->blk_sub.olddepth = (U16)CvDEPTH(cv); \ cx->blk_sub.hasargs = hasargs; \ cx->blk_sub.lval = PL_op->op_private & \ (OPpLVAL_INTRO|OPpENTERSUB_INARGS); @@ -306,7 +306,7 @@ struct block { cx->blk_oldscopesp = PL_scopestack_ix, \ cx->blk_oldretsp = PL_retstack_ix, \ cx->blk_oldpm = PL_curpm, \ - cx->blk_gimme = gimme; \ + cx->blk_gimme = (U8)gimme; \ DEBUG_l( PerlIO_printf(Perl_debug_log, "Entering block %ld, type %s\n", \ (long)cxstack_ix, PL_block_type[CxTYPE(cx)]); ) diff --git a/doop.c b/doop.c index 51c2248..f4f012f 100644 --- a/doop.c +++ b/doop.c @@ -46,7 +46,7 @@ S_do_trans_simple(pTHX_ SV *sv) while (s < send) { if ((ch = tbl[*s]) >= 0) { matches++; - *s++ = ch; + *s++ = (U8)ch; } else s++; @@ -159,7 +159,7 @@ S_do_trans_complex(pTHX_ SV *sv) U8* p = send; while (s < send) { if ((ch = tbl[*s]) >= 0) { - *d = ch; + *d = (U8)ch; matches++; if (p != d - 1 || *p != *d) p = d++; @@ -175,7 +175,7 @@ S_do_trans_complex(pTHX_ SV *sv) while (s < send) { if ((ch = tbl[*s]) >= 0) { matches++; - *d++ = ch; + *d++ = (U8)ch; } else if (ch == -1) /* -1 is unmapped character */ *d++ = *s; @@ -217,9 +217,9 @@ S_do_trans_complex(pTHX_ SV *sv) ch = (rlen == 0) ? comp : (comp - 0x100 < rlen) ? tbl[comp+1] : tbl[0x100+rlen]; - if (ch != pch) { + if ((UV)ch != pch) { d = uvchr_to_utf8(d, ch); - pch = ch; + pch = (UV)ch; } s += len; continue; @@ -228,9 +228,9 @@ S_do_trans_complex(pTHX_ SV *sv) } else if ((ch = tbl[comp]) >= 0) { matches++; - if (ch != pch) { + if ((UV)ch != pch) { d = uvchr_to_utf8(d, ch); - pch = ch; + pch = (UV)ch; } s += len; continue; @@ -730,18 +730,18 @@ Perl_do_vecget(pTHX_ SV *sv, I32 offset, I32 size) else { offset >>= 3; /* turn into byte offset */ if (size == 16) { - if (offset >= srclen) + if ((STRLEN)offset >= srclen) retnum = 0; else retnum = (UV) s[offset] << 8; } else if (size == 32) { - if (offset >= srclen) + if ((STRLEN)offset >= srclen) retnum = 0; - else if (offset + 1 >= srclen) + else if ((STRLEN)(offset + 1) >= srclen) retnum = ((UV) s[offset ] << 24); - else if (offset + 2 >= srclen) + else if ((STRLEN)(offset + 2) >= srclen) retnum = ((UV) s[offset ] << 24) + ((UV) s[offset + 1] << 16); @@ -896,30 +896,30 @@ Perl_do_vecset(pTHX_ SV *sv) else { offset >>= 3; /* turn into byte offset */ if (size == 8) - s[offset ] = lval & 0xff; + s[offset ] = (U8)( lval & 0xff); else if (size == 16) { - s[offset ] = (lval >> 8) & 0xff; - s[offset+1] = lval & 0xff; + s[offset ] = (U8)((lval >> 8) & 0xff); + s[offset+1] = (U8)( lval & 0xff); } else if (size == 32) { - s[offset ] = (lval >> 24) & 0xff; - s[offset+1] = (lval >> 16) & 0xff; - s[offset+2] = (lval >> 8) & 0xff; - s[offset+3] = lval & 0xff; + s[offset ] = (U8)((lval >> 24) & 0xff); + s[offset+1] = (U8)((lval >> 16) & 0xff); + s[offset+2] = (U8)((lval >> 8) & 0xff); + s[offset+3] = (U8)( lval & 0xff); } #ifdef UV_IS_QUAD else if (size == 64) { if (ckWARN(WARN_PORTABLE)) Perl_warner(aTHX_ packWARN(WARN_PORTABLE), "Bit vector size > 32 non-portable"); - s[offset ] = (lval >> 56) & 0xff; - s[offset+1] = (lval >> 48) & 0xff; - s[offset+2] = (lval >> 40) & 0xff; - s[offset+3] = (lval >> 32) & 0xff; - s[offset+4] = (lval >> 24) & 0xff; - s[offset+5] = (lval >> 16) & 0xff; - s[offset+6] = (lval >> 8) & 0xff; - s[offset+7] = lval & 0xff; + s[offset ] = (U8)((lval >> 56) & 0xff); + s[offset+1] = (U8)((lval >> 48) & 0xff); + s[offset+2] = (U8)((lval >> 40) & 0xff); + s[offset+3] = (U8)((lval >> 32) & 0xff); + s[offset+4] = (U8)((lval >> 24) & 0xff); + s[offset+5] = (U8)((lval >> 16) & 0xff); + s[offset+6] = (U8)((lval >> 8) & 0xff); + s[offset+7] = (U8)( lval & 0xff); } #endif } @@ -1117,8 +1117,8 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) else if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) { STRLEN n_a; dc = SvPV_force(sv, n_a); - if (SvCUR(sv) < len) { - dc = SvGROW(sv, len + 1); + if (SvCUR(sv) < (STRLEN)len) { + dc = SvGROW(sv, (STRLEN)(len + 1)); (void)memzero(dc + SvCUR(sv), len - SvCUR(sv) + 1); } if (optype != OP_BIT_AND && (left_utf || right_utf)) @@ -1256,9 +1256,9 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) *dc++ = *lc++ | *rc++; mop_up: len = lensave; - if (rightlen > len) + if (rightlen > (STRLEN)len) sv_catpvn(sv, rsave + len, rightlen - len); - else if (leftlen > len) + else if (leftlen > (STRLEN)len) sv_catpvn(sv, lsave + len, leftlen - len); else *SvEND(sv) = '\0'; diff --git a/dump.c b/dump.c index e3ece94..969fac5 100644 --- a/dump.c +++ b/dump.c @@ -1181,7 +1181,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo PerlIO_printf(file, " ("); Zero(freq, FREQ_MAX + 1, int); - for (i = 0; i <= HvMAX(sv); i++) { + for (i = 0; (STRLEN)i <= HvMAX(sv); i++) { HE* h; int count = 0; for (h = HvARRAY(sv)[i]; h; h = HeNEXT(h)) count++; diff --git a/ext/Devel/Peek/Peek.xs b/ext/Devel/Peek/Peek.xs index d0adfd0..4d01a2b 100644 --- a/ext/Devel/Peek/Peek.xs +++ b/ext/Devel/Peek/Peek.xs @@ -342,7 +342,8 @@ PPCODE: SV *dumpop = perl_get_sv("Devel::Peek::dump_ops", FALSE); I32 save_dumpindent = PL_dumpindent; PL_dumpindent = 2; - do_sv_dump(0, Perl_debug_log, sv, 0, lim, dumpop && SvTRUE(dumpop), pv_lim); + do_sv_dump(0, Perl_debug_log, sv, 0, lim, + (bool)(dumpop && SvTRUE(dumpop)), pv_lim); PL_dumpindent = save_dumpindent; } @@ -360,7 +361,8 @@ PPCODE: for (i=1; iwas_ok_am == PL_amagic_generation && amtp->was_ok_sub == PL_sub_generation) - return AMT_OVERLOADED(amtp); + return (bool)AMT_OVERLOADED(amtp); sv_unmagic((SV*)stash, PERL_MAGIC_overload_table); DEBUG_o( Perl_deb(aTHX_ "Recalcing overload magic in package %s\n",HvNAME(stash)) ); diff --git a/hv.c b/hv.c index 2fd76ce..22b8cf2 100644 --- a/hv.c +++ b/hv.c @@ -216,7 +216,7 @@ S_hv_fetch_flags(pTHX_ HV *hv, const char *key, I32 klen, I32 lval, int flags) } #ifdef ENV_IS_CASELESS else if (mg_find((SV*)hv, PERL_MAGIC_env)) { - U32 i; + I32 i; for (i = 0; i < klen; ++i) if (isLOWER(key[i])) { char *nkey = strupr(SvPVX(sv_2mortal(newSVpvn(key,klen)))); @@ -258,7 +258,7 @@ S_hv_fetch_flags(pTHX_ HV *hv, const char *key, I32 klen, I32 lval, int flags) for (; entry; entry = HeNEXT(entry)) { if (HeHASH(entry) != hash) /* strings can't be equal */ continue; - if (HeKLEN(entry) != klen) + if (HeKLEN(entry) != (I32)klen) continue; if (HeKEY(entry) != key && memNE(HeKEY(entry),key,klen)) /* is this it? */ continue; @@ -417,7 +417,7 @@ Perl_hv_fetch_ent(pTHX_ HV *hv, SV *keysv, I32 lval, register U32 hash) for (; entry; entry = HeNEXT(entry)) { if (HeHASH(entry) != hash) /* strings can't be equal */ continue; - if (HeKLEN(entry) != klen) + if (HeKLEN(entry) != (I32)klen) continue; if (HeKEY(entry) != key && memNE(HeKEY(entry),key,klen)) /* is this it? */ continue; @@ -592,7 +592,7 @@ Perl_hv_store_flags(pTHX_ HV *hv, const char *key, I32 klen, SV *val, for (entry = *oentry; entry; i=0, entry = HeNEXT(entry)) { if (HeHASH(entry) != hash) /* strings can't be equal */ continue; - if (HeKLEN(entry) != klen) + if (HeKLEN(entry) != (I32)klen) continue; if (HeKEY(entry) != key && memNE(HeKEY(entry),key,klen)) /* is this it? */ continue; @@ -658,7 +658,7 @@ Perl_hv_store_flags(pTHX_ HV *hv, const char *key, I32 klen, SV *val, xhv->xhv_keys++; /* HvKEYS(hv)++ */ if (i) { /* initial entry? */ xhv->xhv_fill++; /* HvFILL(hv)++ */ - if (xhv->xhv_keys > xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) + if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) hsplit(hv); } @@ -752,7 +752,7 @@ Perl_hv_store_ent(pTHX_ HV *hv, SV *keysv, SV *val, U32 hash) for (; entry; i=0, entry = HeNEXT(entry)) { if (HeHASH(entry) != hash) /* strings can't be equal */ continue; - if (HeKLEN(entry) != klen) + if (HeKLEN(entry) != (I32)klen) continue; if (HeKEY(entry) != key && memNE(HeKEY(entry),key,klen)) /* is this it? */ continue; @@ -805,7 +805,7 @@ Perl_hv_store_ent(pTHX_ HV *hv, SV *keysv, SV *val, U32 hash) xhv->xhv_keys++; /* HvKEYS(hv)++ */ if (i) { /* initial entry? */ xhv->xhv_fill++; /* HvFILL(hv)++ */ - if (xhv->xhv_keys > xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) + if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) hsplit(hv); } @@ -891,7 +891,7 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen, I32 flags) for (; entry; i=0, oentry = &HeNEXT(entry), entry = *oentry) { if (HeHASH(entry) != hash) /* strings can't be equal */ continue; - if (HeKLEN(entry) != klen) + if (HeKLEN(entry) != (I32)klen) continue; if (HeKEY(entry) != key && memNE(HeKEY(entry),key,klen)) /* is this it? */ continue; @@ -1047,7 +1047,7 @@ Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash) for (; entry; i=0, oentry = &HeNEXT(entry), entry = *oentry) { if (HeHASH(entry) != hash) /* strings can't be equal */ continue; - if (HeKLEN(entry) != klen) + if (HeKLEN(entry) != (I32)klen) continue; if (HeKEY(entry) != key && memNE(HeKEY(entry),key,klen)) /* is this it? */ continue; @@ -1301,7 +1301,7 @@ Perl_hv_exists_ent(pTHX_ HV *hv, SV *keysv, U32 hash) for (; entry; entry = HeNEXT(entry)) { if (HeHASH(entry) != hash) /* strings can't be equal */ continue; - if (HeKLEN(entry) != klen) + if (HeKLEN(entry) != (I32)klen) continue; if (HeKEY(entry) != key && memNE(HeKEY(entry),key,klen)) /* is this it? */ continue; @@ -1379,7 +1379,7 @@ S_hsplit(pTHX_ HV *hv) continue; bep = aep+oldsize; for (oentry = aep, entry = *aep; entry; entry = *oentry) { - if ((HeHASH(entry) & newsize) != i) { + if ((HeHASH(entry) & newsize) != (U32)i) { *oentry = HeNEXT(entry); HeNEXT(entry) = *bep; if (!*bep) @@ -1515,7 +1515,8 @@ Perl_newHVhv(pTHX_ HV *ohv) if (!SvMAGICAL((SV *)ohv)) { /* It's an ordinary hash, so copy it fast. AMS 20010804 */ - int i, shared = !!HvSHAREKEYS(ohv); + STRLEN i; + bool shared = !!HvSHAREKEYS(ohv); HE **ents, **oents = (HE **)HvARRAY(ohv); char *a; New(0, a, PERL_HV_ARRAY_ALLOC_BYTES(hv_max+1), char); @@ -1859,7 +1860,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 flags) } while (!entry) { xhv->xhv_riter++; /* HvRITER(hv)++ */ - if (xhv->xhv_riter > xhv->xhv_max /* HvRITER(hv) > HvMAX(hv) */) { + if (xhv->xhv_riter > (I32)xhv->xhv_max /* HvRITER(hv) > HvMAX(hv) */) { xhv->xhv_riter = -1; /* HvRITER(hv) = -1 */ break; } @@ -2183,7 +2184,7 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags) xhv->xhv_keys++; /* HvKEYS(hv)++ */ if (i) { /* initial entry? */ xhv->xhv_fill++; /* HvFILL(hv)++ */ - if (xhv->xhv_keys > xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) + if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) hsplit(PL_strtab); } } diff --git a/locale.c b/locale.c index db9edb7..02d546d 100644 --- a/locale.c +++ b/locale.c @@ -216,7 +216,7 @@ Perl_new_collate(pTHX_ char *newcoll) SSize_t mult = fb - fa; if (mult < 1) Perl_croak(aTHX_ "strxfrm() gets absurd"); - PL_collxfrm_base = (fa > mult) ? (fa - mult) : 0; + PL_collxfrm_base = (fa > (Size_t)mult) ? (fa - mult) : 0; PL_collxfrm_mult = mult; } } @@ -561,7 +561,7 @@ Perl_mem_collxfrm(pTHX_ const char *s, STRLEN len, STRLEN *xlen) xused = strxfrm(xbuf + xout, s + xin, xAlloc - xout); if (xused == -1) goto bad; - if (xused < xAlloc - xout) + if ((STRLEN)xused < xAlloc - xout) break; xAlloc = (2 * xAlloc) + 1; Renew(xbuf, xAlloc, char); diff --git a/mg.c b/mg.c index 523c90e..80e9a54 100644 --- a/mg.c +++ b/mg.c @@ -400,7 +400,7 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg) paren = mg->mg_len; if (paren < 0) return 0; - if (paren <= rx->nparens && + if (paren <= (I32)rx->nparens && (s = rx->startp[paren]) != -1 && (t = rx->endp[paren]) != -1) { @@ -444,7 +444,7 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg) paren = atoi(mg->mg_ptr); /* $& is in [0] */ getparen: - if (paren <= rx->nparens && + if (paren <= (I32)rx->nparens && (s1 = rx->startp[paren]) != -1 && (t1 = rx->endp[paren]) != -1) { @@ -682,7 +682,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) */ paren = atoi(mg->mg_ptr); /* $& is in [0] */ getparen: - if (paren <= rx->nparens && + if (paren <= (I32)rx->nparens && (s1 = rx->startp[paren]) != -1 && (t1 = rx->endp[paren]) != -1) { @@ -1439,7 +1439,7 @@ Perl_magic_setdbline(pTHX_ SV *sv, MAGIC *mg) svp = av_fetch(GvAV(gv), atoi(MgPV(mg,n_a)), FALSE); if (svp && SvIOKp(*svp) && (o = INT2PTR(OP*,SvIVX(*svp)))) - o->op_private = i; + o->op_private = (U8)i; return 0; } @@ -1513,7 +1513,7 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *mg) if (pos < 0) pos = 0; } - else if (pos > len) + else if (pos > (SSize_t)len) pos = len; if (ulen) { @@ -1573,9 +1573,9 @@ Perl_magic_getsubstr(pTHX_ SV *sv, MAGIC *mg) if (SvUTF8(lsv)) sv_pos_u2b(lsv, &offs, &rem); - if (offs > len) + if (offs > (I32)len) offs = len; - if (rem + offs > len) + if (rem + offs > (I32)len) rem = len - offs; sv_setpvn(sv, tmps + offs, (STRLEN)rem); if (SvUTF8(lsv)) @@ -1840,7 +1840,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) sv_setsv(PL_bodytarget, sv); break; case '\003': /* ^C */ - PL_minus_c = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv); + PL_minus_c = (bool)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)); break; case '\004': /* ^D */ @@ -2254,7 +2254,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) } s = SvPV_force(sv,len); i = len; - if (i >= PL_origalen) { + if (i >= (I32)PL_origalen) { i = PL_origalen; /* don't allow system to limit $0 seen by script */ /* SvCUR_set(sv, i); *SvEND(sv) = '\0'; */ @@ -2266,7 +2266,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) Copy(s, PL_origargv[0], i, char); s = PL_origargv[0]+i; *s++ = '\0'; - while (++i < PL_origalen) + while (++i < (I32)PL_origalen) *s++ = ' '; s = PL_origargv[0]+i; for (i = 1; i < PL_origargc; i++) diff --git a/op.c b/op.c index e7f1042..f474031 100644 --- a/op.c +++ b/op.c @@ -195,7 +195,7 @@ Perl_pad_allocmy(pTHX_ char *name) SV **svp = AvARRAY(PL_comppad_name); HV *ourstash = (PL_curstash ? PL_curstash : PL_defstash); PADOFFSET top = AvFILLp(PL_comppad_name); - for (off = top; off > PL_comppad_name_floor; off--) { + for (off = top; (I32)off > PL_comppad_name_floor; off--) { if ((sv = svp[off]) && sv != &PL_sv_undef && (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0) @@ -308,8 +308,8 @@ S_pad_findlex(pTHX_ char *name, PADOFFSET newoff, U32 seq, CV* startcv, for (off = AvFILLp(curname); off > 0; off--) { if ((sv = svp[off]) && sv != &PL_sv_undef && - seq <= SvIVX(sv) && - seq > I_32(SvNVX(sv)) && + seq <= (U32)SvIVX(sv) && + seq > (U32)I_32(SvNVX(sv)) && strEQ(SvPVX(sv), name)) { I32 depth; @@ -471,8 +471,8 @@ Perl_pad_findmy(pTHX_ char *name) if ((sv = svp[off]) && sv != &PL_sv_undef && (!SvIVX(sv) || - (seq <= SvIVX(sv) && - seq > I_32(SvNVX(sv)))) && + (seq <= (U32)SvIVX(sv) && + seq > (U32)I_32(SvNVX(sv)))) && strEQ(SvPVX(sv), name)) { if (SvIVX(sv) || SvFLAGS(sv) & SVpad_OUR) @@ -778,7 +778,7 @@ Perl_op_free(pTHX_ OP *o) } type = o->op_type; if (type == OP_NULL) - type = o->op_targ; + type = (OPCODE)o->op_targ; /* COP* is not cleared by op_clear() so that we may track line * numbers etc even after null() */ @@ -2310,7 +2310,7 @@ Perl_block_end(pTHX_ I32 floor, OP *seq) PL_copline = copline; /* XXX newSTATEOP may reset PL_copline */ LEAVE_SCOPE(floor); PL_pad_reset_pending = FALSE; - PL_compiling.op_private = PL_hints; + PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); if (needblockscope) PL_hints |= HINT_BLOCK_SCOPE; /* propagate out */ pad_leavemy(PL_comppad_name_fill); @@ -2547,7 +2547,7 @@ Perl_convert(pTHX_ I32 type, I32 flags, OP *o) if (!(PL_opargs[type] & OA_MARK)) op_null(cLISTOPo->op_first); - o->op_type = type; + o->op_type = (OPCODE)type; o->op_ppaddr = PL_ppaddr[type]; o->op_flags |= flags; @@ -2664,11 +2664,11 @@ Perl_newLISTOP(pTHX_ I32 type, I32 flags, OP *first, OP *last) NewOp(1101, listop, 1, LISTOP); - listop->op_type = type; + listop->op_type = (OPCODE)type; listop->op_ppaddr = PL_ppaddr[type]; if (first || last) flags |= OPf_KIDS; - listop->op_flags = flags; + listop->op_flags = (U8)flags; if (!last && first) last = first; @@ -2696,12 +2696,12 @@ Perl_newOP(pTHX_ I32 type, I32 flags) { OP *o; NewOp(1101, o, 1, OP); - o->op_type = type; + o->op_type = (OPCODE)type; o->op_ppaddr = PL_ppaddr[type]; - o->op_flags = flags; + o->op_flags = (U8)flags; o->op_next = o; - o->op_private = 0 + (flags >> 8); + o->op_private = (U8)(0 | (flags >> 8)); if (PL_opargs[type] & OA_RETSCALAR) scalar(o); if (PL_opargs[type] & OA_TARGET) @@ -2720,11 +2720,11 @@ Perl_newUNOP(pTHX_ I32 type, I32 flags, OP *first) first = force_list(first); NewOp(1101, unop, 1, UNOP); - unop->op_type = type; + unop->op_type = (OPCODE)type; unop->op_ppaddr = PL_ppaddr[type]; unop->op_first = first; unop->op_flags = flags | OPf_KIDS; - unop->op_private = 1 | (flags >> 8); + unop->op_private = (U8)(1 | (flags >> 8)); unop = (UNOP*) CHECKOP(type, unop); if (unop->op_next) return (OP*)unop; @@ -2741,21 +2741,21 @@ Perl_newBINOP(pTHX_ I32 type, I32 flags, OP *first, OP *last) if (!first) first = newOP(OP_NULL, 0); - binop->op_type = type; + binop->op_type = (OPCODE)type; binop->op_ppaddr = PL_ppaddr[type]; binop->op_first = first; binop->op_flags = flags | OPf_KIDS; if (!last) { last = first; - binop->op_private = 1 | (flags >> 8); + binop->op_private = (U8)(1 | (flags >> 8)); } else { - binop->op_private = 2 | (flags >> 8); + binop->op_private = (U8)(2 | (flags >> 8)); first->op_sibling = last; } binop = (BINOP*)CHECKOP(type, binop); - if (binop->op_next || binop->op_type != type) + if (binop->op_next || binop->op_type != (OPCODE)type) return (OP*)binop; binop->op_last = binop->op_first->op_sibling; @@ -3015,17 +3015,17 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) tbl = (short*)cPVOPo->op_pv; if (complement) { Zero(tbl, 256, short); - for (i = 0; i < tlen; i++) + for (i = 0; i < (I32)tlen; i++) tbl[t[i]] = -1; for (i = 0, j = 0; i < 256; i++) { if (!tbl[i]) { - if (j >= rlen) { + if (j >= (I32)rlen) { if (del) tbl[i] = -2; else if (rlen) tbl[i] = r[j-1]; else - tbl[i] = i; + tbl[i] = (short)i; } else { if (i < 128 && r[j] >= 128) @@ -3040,12 +3040,12 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) if (!squash) o->op_private |= OPpTRANS_IDENTICAL; } - else if (j >= rlen) + else if (j >= (I32)rlen) j = rlen - 1; else cPVOPo->op_pv = (char*)Renew(tbl, 0x101+rlen-j, short); tbl[0x100] = rlen - j; - for (i=0; i < rlen - j; i++) + for (i=0; i < (I32)rlen - j; i++) tbl[0x101+i] = r[j+i]; } } @@ -3060,8 +3060,8 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) } for (i = 0; i < 256; i++) tbl[i] = -1; - for (i = 0, j = 0; i < tlen; i++,j++) { - if (j >= rlen) { + for (i = 0, j = 0; i < (I32)tlen; i++,j++) { + if (j >= (I32)rlen) { if (del) { if (tbl[t[i]] == -1) tbl[t[i]] = -2; @@ -3090,10 +3090,10 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags) PMOP *pmop; NewOp(1101, pmop, 1, PMOP); - pmop->op_type = type; + pmop->op_type = (OPCODE)type; pmop->op_ppaddr = PL_ppaddr[type]; - pmop->op_flags = flags; - pmop->op_private = 0 | (flags >> 8); + pmop->op_flags = (U8)flags; + pmop->op_private = (U8)(0 | (flags >> 8)); if (PL_hints & HINT_RE_TAINT) pmop->op_pmpermflags |= PMf_RETAINT; @@ -3192,7 +3192,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, OP *repl) if (pm->op_pmflags & PMf_EVAL) { curop = 0; if (CopLINE(PL_curcop) < PL_multi_end) - CopLINE_set(PL_curcop, PL_multi_end); + CopLINE_set(PL_curcop, (line_t)PL_multi_end); } #ifdef USE_5005THREADS else if (repl->op_type == OP_THREADSV @@ -3284,11 +3284,11 @@ Perl_newSVOP(pTHX_ I32 type, I32 flags, SV *sv) { SVOP *svop; NewOp(1101, svop, 1, SVOP); - svop->op_type = type; + svop->op_type = (OPCODE)type; svop->op_ppaddr = PL_ppaddr[type]; svop->op_sv = sv; svop->op_next = (OP*)svop; - svop->op_flags = flags; + svop->op_flags = (U8)flags; if (PL_opargs[type] & OA_RETSCALAR) scalar((OP*)svop); if (PL_opargs[type] & OA_TARGET) @@ -3301,14 +3301,14 @@ Perl_newPADOP(pTHX_ I32 type, I32 flags, SV *sv) { PADOP *padop; NewOp(1101, padop, 1, PADOP); - padop->op_type = type; + padop->op_type = (OPCODE)type; padop->op_ppaddr = PL_ppaddr[type]; padop->op_padix = pad_alloc(type, SVs_PADTMP); SvREFCNT_dec(PL_curpad[padop->op_padix]); PL_curpad[padop->op_padix] = sv; SvPADTMP_on(sv); padop->op_next = (OP*)padop; - padop->op_flags = flags; + padop->op_flags = (U8)flags; if (PL_opargs[type] & OA_RETSCALAR) scalar((OP*)padop); if (PL_opargs[type] & OA_TARGET) @@ -3332,11 +3332,11 @@ Perl_newPVOP(pTHX_ I32 type, I32 flags, char *pv) { PVOP *pvop; NewOp(1101, pvop, 1, PVOP); - pvop->op_type = type; + pvop->op_type = (OPCODE)type; pvop->op_ppaddr = PL_ppaddr[type]; pvop->op_pv = pv; pvop->op_next = (OP*)pvop; - pvop->op_flags = flags; + pvop->op_flags = (U8)flags; if (PL_opargs[type] & OA_RETSCALAR) scalar((OP*)pvop); if (PL_opargs[type] & OA_TARGET) @@ -3658,7 +3658,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) } curop = list(force_list(left)); o = newBINOP(OP_AASSIGN, flags, list(force_list(right)), curop); - o->op_private = 0 | (flags >> 8); + o->op_private = (U8)(0 | (flags >> 8)); for (curop = ((LISTOP*)curop)->op_first; curop; curop = curop->op_sibling) { @@ -3675,7 +3675,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) if (PL_opargs[curop->op_type] & OA_DANGEROUS) { if (curop->op_type == OP_GV) { GV *gv = cGVOPx_gv(curop); - if (gv == PL_defgv || SvCUR(gv) == PL_generation) + if (gv == PL_defgv || (int)SvCUR(gv) == PL_generation) break; SvCUR(gv) = PL_generation; } @@ -3685,7 +3685,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) curop->op_type == OP_PADANY) { SV **svp = AvARRAY(PL_comppad_name); SV *sv = svp[curop->op_targ]; - if (SvCUR(sv) == PL_generation) + if ((int)SvCUR(sv) == PL_generation) break; SvCUR(sv) = PL_generation; /* (SvCUR not used any more) */ } @@ -3705,7 +3705,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) #else GV *gv = (GV*)((PMOP*)curop)->op_pmreplroot; #endif - if (gv == PL_defgv || SvCUR(gv) == PL_generation) + if (gv == PL_defgv || (int)SvCUR(gv) == PL_generation) break; SvCUR(gv) = PL_generation; } @@ -3796,8 +3796,8 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o) cop->op_type = OP_NEXTSTATE; cop->op_ppaddr = PL_ppaddr[ OP_NEXTSTATE ]; } - cop->op_flags = flags; - cop->op_private = (PL_hints & HINT_PRIVATE_MASK); + cop->op_flags = (U8)flags; + cop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); #ifdef NATIVE_HINTS cop->op_private |= NATIVE_HINTS; #endif @@ -3942,7 +3942,7 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp) || k1->op_type == OP_EACH) { warnop = ((k1->op_type == OP_NULL) - ? k1->op_targ : k1->op_type); + ? (OPCODE)k1->op_targ : k1->op_type); } break; } @@ -3966,12 +3966,12 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp) NewOp(1101, logop, 1, LOGOP); - logop->op_type = type; + logop->op_type = (OPCODE)type; logop->op_ppaddr = PL_ppaddr[type]; logop->op_first = first; logop->op_flags = flags | OPf_KIDS; logop->op_other = LINKLIST(other); - logop->op_private = 1 | (flags >> 8); + logop->op_private = (U8)(1 | (flags >> 8)); /* establish postfix order */ logop->op_next = LINKLIST(first); @@ -4018,7 +4018,7 @@ Perl_newCONDOP(pTHX_ I32 flags, OP *first, OP *trueop, OP *falseop) logop->op_ppaddr = PL_ppaddr[OP_COND_EXPR]; logop->op_first = first; logop->op_flags = flags | OPf_KIDS; - logop->op_private = 1 | (flags >> 8); + logop->op_private = (U8)(1 | (flags >> 8)); logop->op_other = LINKLIST(trueop); logop->op_next = LINKLIST(falseop); @@ -4054,7 +4054,7 @@ Perl_newRANGE(pTHX_ I32 flags, OP *left, OP *right) range->op_flags = OPf_KIDS; leftstart = LINKLIST(left); range->op_other = LINKLIST(right); - range->op_private = 1 | (flags >> 8); + range->op_private = (U8)(1 | (flags >> 8)); left->op_sibling = right; @@ -4187,7 +4187,7 @@ Perl_newWHILEOP(pTHX_ I32 flags, I32 debuggable, LOOP *loop, I32 whileline, OP * next = unstack; cont = append_elem(OP_LINESEQ, cont, unstack); if ((line_t)whileline != NOLINE) { - PL_copline = whileline; + PL_copline = (line_t)whileline; cont = append_elem(OP_LINESEQ, cont, newSTATEOP(0, Nullch, Nullop)); } @@ -4197,7 +4197,7 @@ Perl_newWHILEOP(pTHX_ I32 flags, I32 debuggable, LOOP *loop, I32 whileline, OP * redo = LINKLIST(listop); if (expr) { - PL_copline = whileline; + PL_copline = (line_t)whileline; scalar(listop); o = new_logop(OP_AND, 0, &expr, &listop); if (o == expr && o->op_type == OP_CONST && !SvTRUE(cSVOPo->op_sv)) { @@ -5115,7 +5115,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) call_list(oldscope, PL_beginav); PL_curcop = &PL_compiling; - PL_compiling.op_private = PL_hints; + PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); LEAVE; } else if (strEQ(s, "END") && !PL_error_count) { @@ -5524,7 +5524,7 @@ Perl_ck_anoncode(pTHX_ OP *o) OP * Perl_ck_bitop(pTHX_ OP *o) { - o->op_private = PL_hints; + o->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); return o; } diff --git a/perl.c b/perl.c index f5c46e4..78fd402 100644 --- a/perl.c +++ b/perl.c @@ -2257,7 +2257,7 @@ Perl_moreswitches(pTHX_ char *s) else if (!rschar && numlen >= 2) PL_rs = newSVpvn("", 0); else { - char ch = rschar; + char ch = (char)rschar; PL_rs = newSVpvn(&ch, 1); } return s + numlen; diff --git a/perl.h b/perl.h index 920bd3c..5b7af54 100644 --- a/perl.h +++ b/perl.h @@ -3611,14 +3611,14 @@ EXTCONST char * PL_AMG_names[NofAMmeth]; END_EXTERN_C struct am_table { - long was_ok_sub; + U32 was_ok_sub; long was_ok_am; U32 flags; CV* table[NofAMmeth]; long fallback; }; struct am_table_short { - long was_ok_sub; + U32 was_ok_sub; long was_ok_am; U32 flags; }; diff --git a/perlio.c b/perlio.c index 60346b5..6e41997 100644 --- a/perlio.c +++ b/perlio.c @@ -1205,7 +1205,7 @@ PerlIO_context_layers(pTHX_ const char *mode) * Skip to write part */ const char *s = strchr(type, 0); - if (s && (s - type) < len) { + if (s && (STRLEN)(s - type) < len) { type = s + 1; } } @@ -1896,7 +1896,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 = (count < avail) ? count : avail; + take = ((SSize_t)count < avail) ? count : avail; if (take > 0) { STDCHAR *ptr = PerlIO_get_ptr(f); Copy(ptr, buf, take, STDCHAR); @@ -3008,7 +3008,7 @@ PerlIOBuf_fill(pTHX_ PerlIO *f) if (avail > 0) { STDCHAR *ptr = PerlIO_get_ptr(n); SSize_t cnt = avail; - if (avail > b->bufsiz) + if (avail > (SSize_t)b->bufsiz) avail = b->bufsiz; Copy(ptr, b->buf, avail, STDCHAR); PerlIO_set_ptrcnt(n, ptr + avail, cnt - avail); @@ -3367,11 +3367,11 @@ PerlIOPending_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) { SSize_t avail = PerlIO_get_cnt(f); SSize_t got = 0; - if (count < avail) + if ((SSize_t)count < avail) avail = count; if (avail > 0) got = PerlIOBuf_read(aTHX_ f, vbuf, avail); - if (got >= 0 && got < count) { + if (got >= 0 && got < (SSize_t)count) { SSize_t more = PerlIO_read(f, ((STDCHAR *) vbuf) + got, count - got); if (more >= 0 || got == 0) diff --git a/perly.c b/perly.c index 9fd86d3..cba0e74 100644 --- a/perly.c +++ b/perly.c @@ -1606,7 +1606,7 @@ break; case 2: #line 136 "perly.y" { if (PL_copline > (line_t)yyvsp[-3].ival) - PL_copline = yyvsp[-3].ival; + PL_copline = (line_t)yyvsp[-3].ival; yyval.opval = block_end(yyvsp[-2].ival, yyvsp[-1].opval); } break; case 3: @@ -1625,7 +1625,7 @@ break; case 5: #line 156 "perly.y" { if (PL_copline > (line_t)yyvsp[-3].ival) - PL_copline = yyvsp[-3].ival; + PL_copline = (line_t)yyvsp[-3].ival; yyval.opval = block_end(yyvsp[-2].ival, yyvsp[-1].opval); } break; case 6: @@ -1693,7 +1693,7 @@ case 19: break; case 20: #line 209 "perly.y" -{ yyval.opval = newFOROP(0, Nullch, yyvsp[-1].ival, +{ yyval.opval = newFOROP(0, Nullch, (line_t)yyvsp[-1].ival, Nullop, yyvsp[0].opval, yyvsp[-2].opval, Nullop); } break; case 21: @@ -1706,19 +1706,19 @@ case 22: break; case 23: #line 219 "perly.y" -{ PL_copline = yyvsp[-5].ival; +{ PL_copline = (line_t)yyvsp[-5].ival; yyval.opval = newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval); PL_hints |= HINT_BLOCK_SCOPE; } break; case 24: #line 226 "perly.y" -{ PL_copline = yyvsp[-6].ival; +{ PL_copline = (line_t)yyvsp[-6].ival; yyval.opval = block_end(yyvsp[-4].ival, newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval)); } break; case 25: #line 230 "perly.y" -{ PL_copline = yyvsp[-6].ival; +{ PL_copline = (line_t)yyvsp[-6].ival; yyval.opval = block_end(yyvsp[-4].ival, newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval)); } break; @@ -1732,7 +1732,7 @@ case 27: break; case 28: #line 244 "perly.y" -{ PL_copline = yyvsp[-6].ival; +{ PL_copline = (line_t)yyvsp[-6].ival; yyval.opval = block_end(yyvsp[-4].ival, newSTATEOP(0, yyvsp[-7].pval, newWHILEOP(0, 1, (LOOP*)Nullop, @@ -1740,7 +1740,7 @@ case 28: break; case 29: #line 250 "perly.y" -{ PL_copline = yyvsp[-6].ival; +{ PL_copline = (line_t)yyvsp[-6].ival; yyval.opval = block_end(yyvsp[-4].ival, newSTATEOP(0, yyvsp[-7].pval, newWHILEOP(0, 1, (LOOP*)Nullop, @@ -1749,23 +1749,23 @@ break; case 30: #line 256 "perly.y" { yyval.opval = block_end(yyvsp[-6].ival, - newFOROP(0, yyvsp[-9].pval, yyvsp[-8].ival, yyvsp[-5].opval, yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } + newFOROP(0, yyvsp[-9].pval, (line_t)yyvsp[-8].ival, yyvsp[-5].opval, yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } break; case 31: #line 259 "perly.y" { yyval.opval = block_end(yyvsp[-4].ival, - newFOROP(0, yyvsp[-8].pval, yyvsp[-7].ival, mod(yyvsp[-6].opval, OP_ENTERLOOP), + newFOROP(0, yyvsp[-8].pval, (line_t)yyvsp[-7].ival, mod(yyvsp[-6].opval, OP_ENTERLOOP), yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } break; case 32: #line 263 "perly.y" { yyval.opval = block_end(yyvsp[-4].ival, - newFOROP(0, yyvsp[-7].pval, yyvsp[-6].ival, Nullop, yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } + newFOROP(0, yyvsp[-7].pval, (line_t)yyvsp[-6].ival, Nullop, yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } break; case 33: #line 267 "perly.y" { OP *forop; - PL_copline = yyvsp[-9].ival; + PL_copline = (line_t)yyvsp[-9].ival; forop = newSTATEOP(0, yyvsp[-10].pval, newWHILEOP(0, 1, (LOOP*)Nullop, yyvsp[-9].ival, scalar(yyvsp[-4].opval), diff --git a/perly.y b/perly.y index 48049eb..f87f581 100644 --- a/perly.y +++ b/perly.y @@ -134,7 +134,7 @@ prog : progstart /* An ordinary block */ block : '{' remember lineseq '}' { if (PL_copline > (line_t)$1) - PL_copline = $1; + PL_copline = (line_t)$1; $$ = block_end($2, $3); } ; @@ -154,7 +154,7 @@ progstart: mblock : '{' mremember lineseq '}' { if (PL_copline > (line_t)$1) - PL_copline = $1; + PL_copline = (line_t)$1; $$ = block_end($2, $3); } ; @@ -206,7 +206,7 @@ sideff : error | expr UNTIL iexpr { $$ = newLOOPOP(OPf_PARENS, 1, $3, $1);} | expr FOR expr - { $$ = newFOROP(0, Nullch, $2, + { $$ = newFOROP(0, Nullch, (line_t)$2, Nullop, $3, $1, Nullop); } ; @@ -216,18 +216,18 @@ else : /* NULL */ | ELSE mblock { ($2)->op_flags |= OPf_PARENS; $$ = scope($2); } | ELSIF '(' mexpr ')' mblock else - { PL_copline = $1; + { PL_copline = (line_t)$1; $$ = newCONDOP(0, $3, scope($5), $6); PL_hints |= HINT_BLOCK_SCOPE; } ; /* Real conditional expressions */ cond : IF '(' remember mexpr ')' mblock else - { PL_copline = $1; + { PL_copline = (line_t)$1; $$ = block_end($3, newCONDOP(0, $4, scope($6), $7)); } | UNLESS '(' remember miexpr ')' mblock else - { PL_copline = $1; + { PL_copline = (line_t)$1; $$ = block_end($3, newCONDOP(0, $4, scope($6), $7)); } ; @@ -241,31 +241,31 @@ cont : /* NULL */ /* Loops: while, until, for, and a bare block */ loop : label WHILE '(' remember mtexpr ')' mblock cont - { PL_copline = $2; + { PL_copline = (line_t)$2; $$ = block_end($4, newSTATEOP(0, $1, newWHILEOP(0, 1, (LOOP*)Nullop, $2, $5, $7, $8))); } | label UNTIL '(' remember miexpr ')' mblock cont - { PL_copline = $2; + { PL_copline = (line_t)$2; $$ = block_end($4, newSTATEOP(0, $1, newWHILEOP(0, 1, (LOOP*)Nullop, $2, $5, $7, $8))); } | label FOR MY remember my_scalar '(' mexpr ')' mblock cont { $$ = block_end($4, - newFOROP(0, $1, $2, $5, $7, $9, $10)); } + newFOROP(0, $1, (line_t)$2, $5, $7, $9, $10)); } | label FOR scalar '(' remember mexpr ')' mblock cont { $$ = block_end($5, - newFOROP(0, $1, $2, mod($3, OP_ENTERLOOP), + newFOROP(0, $1, (line_t)$2, mod($3, OP_ENTERLOOP), $6, $8, $9)); } | label FOR '(' remember mexpr ')' mblock cont { $$ = block_end($4, - newFOROP(0, $1, $2, Nullop, $5, $7, $8)); } + newFOROP(0, $1, (line_t)$2, Nullop, $5, $7, $8)); } | label FOR '(' remember mnexpr ';' mtexpr ';' mnexpr ')' mblock /* basically fake up an initialize-while lineseq */ { OP *forop; - PL_copline = $2; + PL_copline = (line_t)$2; forop = newSTATEOP(0, $1, newWHILEOP(0, 1, (LOOP*)Nullop, $2, scalar($7), diff --git a/pp.c b/pp.c index 6c4f2ff..3b3d76d 100644 --- a/pp.c +++ b/pp.c @@ -62,7 +62,7 @@ PP(pp_padav) EXTEND(SP, maxarg); if (SvMAGICAL(TARG)) { U32 i; - for (i=0; i < maxarg; i++) { + for (i=0; i < (U32)maxarg; i++) { SV **svp = av_fetch((AV*)TARG, i, FALSE); SP[i+1] = (svp) ? *svp : &PL_sv_undef; } @@ -3161,7 +3161,7 @@ PP(pp_index) sv_pos_u2b(big, &offset, 0); if (offset < 0) offset = 0; - else if (offset > biglen) + else if (offset > (I32)biglen) offset = biglen; if (!(tmps2 = fbm_instr((unsigned char*)tmps + offset, (unsigned char*)tmps + biglen, little, 0))) @@ -3202,7 +3202,7 @@ PP(pp_rindex) } if (offset < 0) offset = 0; - else if (offset > blen) + else if (offset > (I32)blen) offset = blen; if (!(tmps2 = rninstr(tmps, tmps + offset, tmps2, tmps2 + llen))) @@ -3257,7 +3257,7 @@ PP(pp_chr) (void)SvUPGRADE(TARG,SVt_PV); if (value > 255 && !IN_BYTES) { - SvGROW(TARG, UNISKIP(value)+1); + SvGROW(TARG, (STRLEN)UNISKIP(value)+1); tmps = (char*)uvchr_to_utf8_flags((U8*)SvPVX(TARG), value, 0); SvCUR_set(TARG, tmps - SvPVX(TARG)); *tmps = '\0'; @@ -3270,7 +3270,7 @@ PP(pp_chr) SvGROW(TARG,2); SvCUR_set(TARG, 1); tmps = SvPVX(TARG); - *tmps++ = value; + *tmps++ = (char)value; *tmps = '\0'; (void)SvPOK_only(TARG); if (PL_encoding) @@ -3383,7 +3383,7 @@ PP(pp_lcfirst) tend = uvchr_to_utf8(tmpbuf, uv); - if (!SvPADTMP(sv) || tend - tmpbuf != ulen || SvREADONLY(sv)) { + if (!SvPADTMP(sv) || (STRLEN)(tend - tmpbuf) != ulen || SvREADONLY(sv)) { dTARGET; sv_setpvn(TARG, (char*)tmpbuf, tend - tmpbuf); sv_catpvn(TARG, (char*)(s + ulen), slen - ulen); @@ -4304,7 +4304,7 @@ PP(pp_reverse) while (down > up) { tmp = *up; *up++ = *down; - *down-- = tmp; + *down-- = (char)tmp; } } } @@ -4314,7 +4314,7 @@ PP(pp_reverse) while (down > up) { tmp = *up; *up++ = *down; - *down-- = tmp; + *down-- = (char)tmp; } (void)SvPOK_only_UTF8(TARG); } @@ -4544,7 +4544,7 @@ PP(pp_split) (void)SvUTF8_on(dstr); XPUSHs(dstr); if (rx->nparens) { - for (i = 1; i <= rx->nparens; i++) { + for (i = 1; i <= (I32)rx->nparens; i++) { s = rx->startp[i] + orig; m = rx->endp[i] + orig; diff --git a/pp_ctl.c b/pp_ctl.c index 886dd8c..7a440ae 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -93,7 +93,7 @@ PP(pp_regcomp) /* Check against the last compiled regexp. */ if (!PM_GETRE(pm) || !PM_GETRE(pm)->precomp || - PM_GETRE(pm)->prelen != len || + PM_GETRE(pm)->prelen != (I32)len || memNE(PM_GETRE(pm)->precomp, t, len)) { if (PM_GETRE(pm)) { @@ -405,7 +405,7 @@ PP(pp_formline) itemsize = len; if (DO_UTF8(sv)) { itemsize = sv_len_utf8(sv); - if (itemsize != len) { + if (itemsize != (I32)len) { I32 itembytes; if (itemsize > fieldsize) { itemsize = fieldsize; @@ -447,7 +447,7 @@ PP(pp_formline) itemsize = len; if (DO_UTF8(sv)) { itemsize = sv_len_utf8(sv); - if (itemsize != len) { + if (itemsize != (I32)len) { I32 itembytes; if (itemsize <= fieldsize) { send = chophere = s + itemsize; @@ -1560,7 +1560,7 @@ PP(pp_dbstate) register CV *cv; register PERL_CONTEXT *cx; I32 gimme = G_ARRAY; - I32 hasargs; + U8 hasargs; GV *gv; gv = PL_DBgv; @@ -2170,7 +2170,7 @@ PP(pp_goto) cx->blk_sub.hasargs = 0; } cx->blk_sub.cv = cv; - cx->blk_sub.olddepth = CvDEPTH(cv); + cx->blk_sub.olddepth = (U16)CvDEPTH(cv); CvDEPTH(cv)++; if (CvDEPTH(cv) < 2) (void)SvREFCNT_inc(cv); @@ -2656,7 +2656,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, char *code, AV** avp) *avp = (AV*)SvREFCNT_inc(PL_comppad); LEAVE; if (PL_curcop == &PL_compiling) - PL_compiling.op_private = PL_hints; + PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); #ifdef OP_IN_REGISTER op = PL_opsave; #endif @@ -3328,7 +3328,7 @@ PP(pp_entereval) MUTEX_UNLOCK(&PL_eval_mutex); #endif /* USE_5005THREADS */ ret = doeval(gimme, NULL); - if (PERLDB_INTER && was != PL_sub_generation /* Some subs defined here. */ + if (PERLDB_INTER && was != (I32)PL_sub_generation /* Some subs defined here. */ && ret != PL_op->op_next) { /* Successive compilation. */ strcpy(safestr, "_<(eval )"); /* Anything fake and short. */ } @@ -3526,14 +3526,14 @@ S_doparseform(pTHX_ SV *sv) if (postspace) *fpc++ = FF_SPACE; *fpc++ = FF_LITERAL; - *fpc++ = arg; + *fpc++ = (U16)arg; } postspace = FALSE; if (s <= send) skipspaces--; if (skipspaces) { *fpc++ = FF_SKIP; - *fpc++ = skipspaces; + *fpc++ = (U16)skipspaces; } skipspaces = 0; if (s <= send) @@ -3544,7 +3544,7 @@ S_doparseform(pTHX_ SV *sv) arg = fpc - linepc + 1; else arg = 0; - *fpc++ = arg; + *fpc++ = (U16)arg; } if (s < send) { linepc = fpc; @@ -3567,7 +3567,7 @@ S_doparseform(pTHX_ SV *sv) arg = (s - base) - 1; if (arg) { *fpc++ = FF_LITERAL; - *fpc++ = arg; + *fpc++ = (U16)arg; } base = s - 1; @@ -3592,7 +3592,7 @@ S_doparseform(pTHX_ SV *sv) } *fpc++ = s - base; /* fieldsize for FETCH */ *fpc++ = FF_DECIMAL; - *fpc++ = arg; + *fpc++ = (U16)arg; } else if (*s == '0' && s[1] == '#') { /* Zero padded decimals */ arg = ischop ? 512 : 0; @@ -3610,7 +3610,7 @@ S_doparseform(pTHX_ SV *sv) } *fpc++ = s - base; /* fieldsize for FETCH */ *fpc++ = FF_0DECIMAL; - *fpc++ = arg; + *fpc++ = (U16)arg; } else { I32 prespace = 0; @@ -3639,7 +3639,7 @@ S_doparseform(pTHX_ SV *sv) *fpc++ = ischop ? FF_CHECKCHOP : FF_CHECKNL; if (prespace) - *fpc++ = prespace; + *fpc++ = (U16)prespace; *fpc++ = FF_ITEM; if (ismore) *fpc++ = FF_MORE; diff --git a/pp_hot.c b/pp_hot.c index 3ff6dc6..492b50b 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -734,7 +734,7 @@ PP(pp_rv2av) EXTEND(SP, maxarg); if (SvRMAGICAL(av)) { U32 i; - for (i=0; i < maxarg; i++) { + for (i=0; i < (U32)maxarg; i++) { SV **svp = av_fetch(av, i, FALSE); SP[i+1] = (svp) ? *svp : &PL_sv_undef; } @@ -1232,7 +1232,7 @@ PP(pp_match) rx = PM_GETRE(pm); } - if (rx->minlen > len) + if (rx->minlen > (I32)len) goto failure; truebase = t = s; @@ -1975,7 +1975,7 @@ PP(pp_subst) } /* can do inplace substitution? */ - if (c && clen <= rx->minlen && (once || !(r_flags & REXEC_COPY_STR)) + if (c && (I32)clen <= rx->minlen && (once || !(r_flags & REXEC_COPY_STR)) && !(rx->reganch & ROPT_LOOKBEHIND_SEEN)) { if (!CALLREGEXEC(aTHX_ rx, s, strend, orig, 0, TARG, NULL, r_flags | REXEC_CHECKED)) diff --git a/pp_pack.c b/pp_pack.c index 63e9d4b..4cf3b93 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -104,8 +104,8 @@ S_mul128(pTHX_ SV *sv, U8 m) t--; while (t > s) { i = ((*t - '0') << 7) + m; - *(t--) = '0' + (i % 10); - m = i / 10; + *(t--) = '0' + (char)(i % 10); + m = (char)(i / 10); } return (sv); } @@ -202,7 +202,7 @@ S_measure_struct(pTHX_ char *pat, register char *patend) case 'U': /* XXXX Is it correct? */ case 'w': case 'u': - buf[0] = datumtype; + buf[0] = (char)datumtype; buf[1] = 0; Perl_croak(aTHX_ "%s not allowed in length fields", buf); case ',': /* grandfather in commas but with a warning */ @@ -458,7 +458,7 @@ Perl_unpack_str(pTHX_ char *pat, register char *patend, register char *s, char * #if defined(HAS_LONG_DOUBLE) && defined(USE_LONG_DOUBLE) long double aldouble; #endif - bool do_utf8 = flags & UNPACK_DO_UTF8; + bool do_utf8 = (flags & UNPACK_DO_UTF8) != 0; while ((pat = next_symbol(pat, patend)) < patend) { datumtype = *pat++ & 0xFF; @@ -1299,7 +1299,7 @@ Perl_unpack_str(pTHX_ char *pat, register char *patend, register char *s, char * sv = Perl_newSVpvf(aTHX_ "%.*"UVf, (int)TYPE_DIGITS(UV), auv); while (s < strend) { - sv = mul128(sv, *s & 0x7f); + sv = mul128(sv, (U8)(*s & 0x7f)); if (!(*s++ & 0x80)) { bytes = 0; break; @@ -1553,9 +1553,9 @@ Perl_unpack_str(pTHX_ char *pat, register char *patend, register char *s, char * d = PL_uudmap[*(U8*)s++] & 077; else d = 0; - hunk[0] = (a << 2) | (b >> 4); - hunk[1] = (b << 4) | (c >> 2); - hunk[2] = (c << 6) | d; + hunk[0] = (char)((a << 2) | (b >> 4)); + hunk[1] = (char)((b << 4) | (c >> 2)); + hunk[2] = (char)((c << 6) | d); sv_catpvn(sv, hunk, (len > 3) ? 3 : len); len -= 3; } @@ -1876,7 +1876,7 @@ Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beg /* FALL THROUGH */ case 'X': shrink: - if (SvCUR(cat) < len) + if ((I32)SvCUR(cat) < len) Perl_croak(aTHX_ "X outside of string"); SvCUR(cat) -= len; *SvEND(cat) = '\0'; @@ -1908,7 +1908,7 @@ Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beg if (datumtype == 'Z') ++len; } - if (fromlen >= len) { + if ((I32)fromlen >= len) { sv_catpvn(cat, aptr, len); if (datumtype == 'Z') *(SvEND(cat)-1) = '\0'; @@ -1947,7 +1947,7 @@ Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beg SvCUR(cat) += (len+7)/8; SvGROW(cat, SvCUR(cat) + 1); aptr = SvPVX(cat) + aint; - if (len > fromlen) + if (len > (I32)fromlen) len = fromlen; aint = len; items = 0; @@ -2003,7 +2003,7 @@ Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beg SvCUR(cat) += (len+1)/2; SvGROW(cat, SvCUR(cat) + 1); aptr = SvPVX(cat) + aint; - if (len > fromlen) + if (len > (I32)fromlen) len = fromlen; aint = len; items = 0; @@ -2249,7 +2249,7 @@ Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beg UV auv = SvUV(fromstr); do { - *--in = (auv & 0x7f) | 0x80; + *--in = (char)((auv & 0x7f) | 0x80); auv >>= 7; } while (auv); buf[sizeof(buf) - 1] &= 0x7f; /* clear continue bit */ @@ -2440,7 +2440,7 @@ Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beg while (fromlen > 0) { I32 todo; - if (fromlen > len) + if ((I32)fromlen > len) todo = len; else todo = fromlen; diff --git a/pp_sort.c b/pp_sort.c index af4d7f5..18ccfa1 100644 --- a/pp_sort.c +++ b/pp_sort.c @@ -753,7 +753,7 @@ S_qsortsvu(pTHX_ SV ** array, size_t num_elts, SVCOMPARE_t compare) register size_t n, j; register SV **q; for (n = num_elts, q = array; n > 1; ) { - j = n-- * Drand01(); + j = (size_t)(n-- * Drand01()); temp = q[j]; q[j] = q[n]; q[n] = temp; diff --git a/pp_sys.c b/pp_sys.c index 6ed8e0a..5e1908f 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -785,7 +785,7 @@ PP(pp_tie) ENTER; PUSHSTACKi(PERLSI_MAGIC); PUSHMARK(SP); - EXTEND(SP,items); + EXTEND(SP,(I32)items); while (items--) PUSHs(*MARK++); PUTBACK; @@ -803,7 +803,7 @@ PP(pp_tie) ENTER; PUSHSTACKi(PERLSI_MAGIC); PUSHMARK(SP); - EXTEND(SP,items); + EXTEND(SP,(I32)items); while (items--) PUSHs(*MARK++); PUTBACK; @@ -1593,7 +1593,7 @@ PP(pp_sysread) if (bufsize >= 256) bufsize = 255; #endif - buffer = SvGROW(bufsv, length+1); + buffer = SvGROW(bufsv, (STRLEN)(length+1)); /* 'offset' means 'flags' here */ count = PerlSock_recvfrom(PerlIO_fileno(IoIFP(io)), buffer, length, offset, (struct sockaddr *)namebuf, &bufsize); @@ -1626,7 +1626,7 @@ PP(pp_sysread) blen = sv_len_utf8(bufsv); } if (offset < 0) { - if (-offset > blen) + if (-offset > (int)blen) DIE(aTHX_ "Offset outside string"); offset += blen; } @@ -1636,7 +1636,7 @@ PP(pp_sysread) } more_bytes: bufsize = SvCUR(bufsv); - buffer = SvGROW(bufsv, length+offset+1); + buffer = SvGROW(bufsv, (STRLEN)(length+offset+1)); if (offset > bufsize) { /* Zero any newly allocated space */ Zero(buffer+bufsize, offset-bufsize, char); } @@ -1826,10 +1826,10 @@ PP(pp_send) if (MARK < SP) { offset = SvIVx(*++MARK); if (offset < 0) { - if (-offset > blen) + if (-offset > (IV)blen) DIE(aTHX_ "Offset outside string"); offset += blen; - } else if (offset >= blen && blen > 0) + } else if (offset >= (IV)blen && blen > 0) DIE(aTHX_ "Offset outside string"); } else offset = 0; @@ -4034,7 +4034,6 @@ PP(pp_system) I32 value; STRLEN n_a; int result; - int pp[2]; I32 did_pipes = 0; if (PL_tainting) { @@ -4057,71 +4056,73 @@ PP(pp_system) PERL_FLUSHALL_FOR_CHILD; #if (defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) && !defined(OS2) || defined(PERL_MICRO) { - Pid_t childpid; - int status; - Sigsave_t ihand,qhand; /* place to save signals during system() */ - - if (PerlProc_pipe(pp) >= 0) - did_pipes = 1; - while ((childpid = PerlProc_fork()) == -1) { - if (errno != EAGAIN) { - value = -1; - SP = ORIGMARK; - PUSHi(value); - if (did_pipes) { - PerlLIO_close(pp[0]); - PerlLIO_close(pp[1]); - } - RETURN; - } - sleep(5); - } - if (childpid > 0) { - if (did_pipes) - PerlLIO_close(pp[1]); + Pid_t childpid; + int pp[2]; + + if (PerlProc_pipe(pp) >= 0) + did_pipes = 1; + while ((childpid = PerlProc_fork()) == -1) { + if (errno != EAGAIN) { + value = -1; + SP = ORIGMARK; + PUSHi(value); + if (did_pipes) { + PerlLIO_close(pp[0]); + PerlLIO_close(pp[1]); + } + RETURN; + } + sleep(5); + } + if (childpid > 0) { + Sigsave_t ihand,qhand; /* place to save signals during system() */ + int status; + + if (did_pipes) + PerlLIO_close(pp[1]); #ifndef PERL_MICRO - rsignal_save(SIGINT, SIG_IGN, &ihand); - rsignal_save(SIGQUIT, SIG_IGN, &qhand); + rsignal_save(SIGINT, SIG_IGN, &ihand); + rsignal_save(SIGQUIT, SIG_IGN, &qhand); #endif - do { - result = wait4pid(childpid, &status, 0); - } while (result == -1 && errno == EINTR); + do { + result = wait4pid(childpid, &status, 0); + } while (result == -1 && errno == EINTR); #ifndef PERL_MICRO - (void)rsignal_restore(SIGINT, &ihand); - (void)rsignal_restore(SIGQUIT, &qhand); -#endif - STATUS_NATIVE_SET(result == -1 ? -1 : status); - do_execfree(); /* free any memory child malloced on fork */ - SP = ORIGMARK; - if (did_pipes) { - int errkid; - int n = 0, n1; - - while (n < sizeof(int)) { - n1 = PerlLIO_read(pp[0], - (void*)(((char*)&errkid)+n), - (sizeof(int)) - n); - if (n1 <= 0) - break; - n += n1; - } - PerlLIO_close(pp[0]); - if (n) { /* Error */ - if (n != sizeof(int)) - DIE(aTHX_ "panic: kid popen errno read"); - errno = errkid; /* Propagate errno from kid */ - STATUS_CURRENT = -1; - } - } - PUSHi(STATUS_CURRENT); - RETURN; - } - if (did_pipes) { - PerlLIO_close(pp[0]); + (void)rsignal_restore(SIGINT, &ihand); + (void)rsignal_restore(SIGQUIT, &qhand); +#endif + STATUS_NATIVE_SET(result == -1 ? -1 : status); + do_execfree(); /* free any memory child malloced on fork */ + SP = ORIGMARK; + if (did_pipes) { + int errkid; + int n = 0, n1; + + while (n < sizeof(int)) { + n1 = PerlLIO_read(pp[0], + (void*)(((char*)&errkid)+n), + (sizeof(int)) - n); + if (n1 <= 0) + break; + n += n1; + } + PerlLIO_close(pp[0]); + if (n) { /* Error */ + if (n != sizeof(int)) + DIE(aTHX_ "panic: kid popen errno read"); + errno = errkid; /* Propagate errno from kid */ + STATUS_CURRENT = -1; + } + } + PUSHi(STATUS_CURRENT); + RETURN; + } + if (did_pipes) { + PerlLIO_close(pp[0]); #if defined(HAS_FCNTL) && defined(F_SETFD) - fcntl(pp[1], F_SETFD, FD_CLOEXEC); + fcntl(pp[1], F_SETFD, FD_CLOEXEC); #endif - } + } } if (PL_op->op_flags & OPf_STACKED) { SV *really = *++MARK; @@ -4952,7 +4953,7 @@ PP(pp_gservent) else if (which == OP_GSBYPORT) { #ifdef HAS_GETSERVBYPORT char *proto = POPpbytex; - unsigned short port = POPu; + unsigned short port = (unsigned short)POPu; #ifdef HAS_HTONS port = PerlSock_htons(port); diff --git a/regcomp.c b/regcomp.c index 6726ba1..6388c7d 100644 --- a/regcomp.c +++ b/regcomp.c @@ -227,9 +227,9 @@ static scan_data_t zero_scan_data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #define SCF_DO_STCLASS (SCF_DO_STCLASS_AND|SCF_DO_STCLASS_OR) #define SCF_WHILEM_VISITED_POS 0x2000 -#define UTF RExC_utf8 -#define LOC (RExC_flags16 & PMf_LOCALE) -#define FOLD (RExC_flags16 & PMf_FOLD) +#define UTF (RExC_utf8 != 0) +#define LOC ((RExC_flags16 & PMf_LOCALE) != 0) +#define FOLD ((RExC_flags16 & PMf_FOLD) != 0) #define OOB_UNICODE 12345678 #define OOB_NAMEDCLASS -1 @@ -1171,7 +1171,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg if (OP(nxt) != CLOSE) goto nogo; /* Now we know that nxt2 is the only contents: */ - oscan->flags = ARG(nxt); + oscan->flags = (U8)ARG(nxt); OP(oscan) = CURLYN; OP(nxt1) = NOTHING; /* was OPEN. */ #ifdef DEBUGGING @@ -1207,7 +1207,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg if (OP(nxt) != CLOSE) FAIL("Panic opt close"); - oscan->flags = ARG(nxt); + oscan->flags = (U8)ARG(nxt); OP(nxt1) = OPTIMIZED; /* was OPEN. */ OP(nxt) = OPTIMIZED; /* was CLOSE. */ #ifdef DEBUGGING @@ -1251,8 +1251,8 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg if (OP(PREVOPER(nxt)) == NOTHING) /* LONGJMP */ nxt += ARG(nxt); - PREVOPER(nxt)->flags = data->whilem_c - | (RExC_whilem_seen << 4); /* On WHILEM */ + PREVOPER(nxt)->flags = (U8)(data->whilem_c + | (RExC_whilem_seen << 4)); /* On WHILEM */ } if (data && fl & (SF_HAS_PAR|SF_IN_PAR)) pars++; @@ -1593,7 +1593,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg else if (minnext > U8_MAX) { vFAIL2("Lookbehind longer than %"UVuf" not implemented", (UV)U8_MAX); } - scan->flags = minnext; + scan->flags = (U8)minnext; } if (data && data_fake.flags & (SF_HAS_PAR|SF_IN_PAR)) pars++; @@ -1613,7 +1613,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg pars++; } else if (OP(scan) == CLOSE) { - if (ARG(scan) == is_par) { + if ((I32)ARG(scan) == is_par) { next = regnext(scan); if ( next && (OP(next) != WHILEM) && next < last) @@ -1823,7 +1823,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm) RExC_emit_start = r->program; RExC_emit = r->program; /* Store the count of eval-groups for security checks: */ - RExC_emit->next_off = ((RExC_seen_evals > U16_MAX) ? U16_MAX : RExC_seen_evals); + RExC_emit->next_off = (U16)((RExC_seen_evals > U16_MAX) ? U16_MAX : RExC_seen_evals); REGC((U8)REG_MAGIC, (char*) RExC_emit++); r->data = 0; if (reg(pRExC_state, 0, &flags) == NULL) @@ -2019,7 +2019,8 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm) if ((!(r->anchored_substr || r->anchored_utf8) || r->anchored_offset) && stclass_flag && !(data.start_class->flags & ANYOF_EOS) - && !cl_is_anything(data.start_class)) { + && !cl_is_anything(data.start_class)) + { I32 n = add_data(pRExC_state, 1, "f"); New(1006, RExC_rx->data->data[n], 1, @@ -2074,7 +2075,8 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm) r->check_substr = r->check_utf8 = r->anchored_substr = r->anchored_utf8 = r->float_substr = r->float_utf8 = Nullsv; if (!(data.start_class->flags & ANYOF_EOS) - && !cl_is_anything(data.start_class)) { + && !cl_is_anything(data.start_class)) + { I32 n = add_data(pRExC_state, 1, "f"); New(1006, RExC_rx->data->data[n], 1, @@ -2486,7 +2488,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp) static char parens[] = "=!<,>"; if (paren && (p = strchr(parens, paren))) { - int node = ((p - parens) % 2) ? UNLESSM : IFMATCH; + U8 node = ((p - parens) % 2) ? UNLESSM : IFMATCH; int flag = (p - parens) > 1; if (paren == '>') @@ -2499,7 +2501,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp) /* Check for proper termination. */ if (paren) { - RExC_flags16 = oregflags; + RExC_flags16 = (U16)oregflags; if (RExC_parse >= RExC_end || *nextchar(pRExC_state) != ')') { RExC_parse = oregcomp_parse; vFAIL("Unmatched ("); @@ -2681,8 +2683,8 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp) if (max && max < min) vFAIL("Can't do {n,m} with n > m"); if (!SIZE_ONLY) { - ARG1_SET(ret, min); - ARG2_SET(ret, max); + ARG1_SET(ret, (U16)min); + ARG2_SET(ret, (U16)max); } goto nest_check; @@ -2904,13 +2906,13 @@ tryagain: Set_Node_Length(ret, 2); /* MJD */ break; case 'w': - ret = reg_node(pRExC_state, LOC ? ALNUML : ALNUM); + ret = reg_node(pRExC_state, (U8)(LOC ? ALNUML : ALNUM)); *flagp |= HASWIDTH|SIMPLE; nextchar(pRExC_state); Set_Node_Length(ret, 2); /* MJD */ break; case 'W': - ret = reg_node(pRExC_state, LOC ? NALNUML : NALNUM); + ret = reg_node(pRExC_state, (U8)(LOC ? NALNUML : NALNUM)); *flagp |= HASWIDTH|SIMPLE; nextchar(pRExC_state); Set_Node_Length(ret, 2); /* MJD */ @@ -2918,7 +2920,7 @@ tryagain: case 'b': RExC_seen_zerolen++; RExC_seen |= REG_SEEN_LOOKBEHIND; - ret = reg_node(pRExC_state, LOC ? BOUNDL : BOUND); + ret = reg_node(pRExC_state, (U8)(LOC ? BOUNDL : BOUND)); *flagp |= SIMPLE; nextchar(pRExC_state); Set_Node_Length(ret, 2); /* MJD */ @@ -2926,19 +2928,19 @@ tryagain: case 'B': RExC_seen_zerolen++; RExC_seen |= REG_SEEN_LOOKBEHIND; - ret = reg_node(pRExC_state, LOC ? NBOUNDL : NBOUND); + ret = reg_node(pRExC_state, (U8)(LOC ? NBOUNDL : NBOUND)); *flagp |= SIMPLE; nextchar(pRExC_state); Set_Node_Length(ret, 2); /* MJD */ break; case 's': - ret = reg_node(pRExC_state, LOC ? SPACEL : SPACE); + ret = reg_node(pRExC_state, (U8)(LOC ? SPACEL : SPACE)); *flagp |= HASWIDTH|SIMPLE; nextchar(pRExC_state); Set_Node_Length(ret, 2); /* MJD */ break; case 'S': - ret = reg_node(pRExC_state, LOC ? NSPACEL : NSPACE); + ret = reg_node(pRExC_state, (U8)(LOC ? NSPACEL : NSPACE)); *flagp |= HASWIDTH|SIMPLE; nextchar(pRExC_state); Set_Node_Length(ret, 2); /* MJD */ @@ -3010,12 +3012,12 @@ tryagain: while (isDIGIT(*RExC_parse)) RExC_parse++; - if (!SIZE_ONLY && num > RExC_rx->nparens) + if (!SIZE_ONLY && num > (I32)RExC_rx->nparens) vFAIL("Reference to nonexistent group"); RExC_sawback = 1; - ret = reganode(pRExC_state, FOLD - ? (LOC ? REFFL : REFF) - : REF, num); + ret = reganode(pRExC_state, + (U8)(FOLD ? (LOC ? REFFL : REFF) : REF), + num); *flagp |= HASWIDTH; /* override incorrect value set in reganode MJD */ @@ -3060,9 +3062,8 @@ tryagain: defchar: ender = 0; - ret = reg_node(pRExC_state, FOLD - ? (LOC ? EXACTFL : EXACTF) - : EXACT); + ret = reg_node(pRExC_state, + (U8)(FOLD ? (LOC ? EXACTFL : EXACTF) : EXACT)); s = STRING(ret); for (len = 0, p = RExC_parse - 1; len < 127 && p < RExC_end; @@ -3237,7 +3238,7 @@ tryagain: } else { len++; - REGC(ender, s++); + REGC((char)ender, s++); } break; } @@ -3274,7 +3275,7 @@ tryagain: len--; } else - REGC(ender, s++); + REGC((char)ender, s++); } loopdone: RExC_parse = p - 1; @@ -4048,7 +4049,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state) } /* end of namedclass \blah */ if (range) { - if (prevvalue > value) /* b-a */ { + if (prevvalue > (IV)value) /* b-a */ { Simple_vFAIL4("Invalid [] range \"%*.*s\"", RExC_parse - rangebegin, RExC_parse - rangebegin, @@ -4124,7 +4125,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state) * character, insert also the folded version * to the charclass. */ if (f != value) { - if (foldlen == UNISKIP(f)) + if (foldlen == (STRLEN)UNISKIP(f)) Perl_sv_catpvf(aTHX_ listsv, "%04"UVxf"\n", f); else { @@ -4187,7 +4188,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state) ) { for (value = 0; value < 256; ++value) { if (ANYOF_BITMAP_TEST(ret, value)) { - IV fold = PL_fold[value]; + UV fold = PL_fold[value]; if (fold != value) ANYOF_BITMAP_SET(ret, fold); diff --git a/regexec.c b/regexec.c index 4380fd8..de3caaf 100644 --- a/regexec.c +++ b/regexec.c @@ -87,7 +87,7 @@ #define RF_evaled 4 /* Did an EVAL with setting? */ #define RF_utf8 8 /* String contains multibyte chars? */ -#define UTF (PL_reg_flags & RF_utf8) +#define UTF ((PL_reg_flags & RF_utf8) != 0) #define RS_init 1 /* eval environment created */ #define RS_set 2 /* replsv value is set */ @@ -239,7 +239,7 @@ S_regcppop(pTHX) ); } DEBUG_r( - if (*PL_reglastparen + 1 <= PL_regnpar) { + if ((I32)(*PL_reglastparen + 1) <= PL_regnpar) { PerlIO_printf(Perl_debug_log, " restoring \\%"IVdf"..\\%"IVdf" to undef\n", (IV)(*PL_reglastparen + 1), (IV)PL_regnpar); @@ -256,8 +256,8 @@ S_regcppop(pTHX) * building DynaLoader will fail: * "Error: '*' not in typemap in DynaLoader.xs, line 164" * --jhi */ - for (paren = *PL_reglastparen + 1; paren <= PL_regnpar; paren++) { - if (paren > PL_regsize) + for (paren = *PL_reglastparen + 1; (I32)paren <= PL_regnpar; paren++) { + if ((I32)paren > PL_regsize) PL_regstartp[paren] = -1; PL_regendp[paren] = -1; } @@ -1045,7 +1045,7 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta if ( c == c1 && (ln == len || ibcmp_utf8(s, (char **)0, 0, do_utf8, - m, (char **)0, ln, UTF)) + m, (char **)0, ln, (bool)UTF)) && (norun || regtry(prog, s)) ) goto got_it; else { @@ -1057,7 +1057,7 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta !ibcmp_utf8((char *) foldbuf, (char **)0, foldlen, do_utf8, m, - (char **)0, ln, UTF)) + (char **)0, ln, (bool)UTF)) && (norun || regtry(prog, s)) ) goto got_it; } @@ -1084,7 +1084,7 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta if ( (c == c1 || c == c2) && (ln == len || ibcmp_utf8(s, (char **)0, 0, do_utf8, - m, (char **)0, ln, UTF)) + m, (char **)0, ln, (bool)UTF)) && (norun || regtry(prog, s)) ) goto got_it; else { @@ -1096,7 +1096,7 @@ S_find_byclass(pTHX_ regexp * prog, regnode *c, char *s, char *strend, char *sta !ibcmp_utf8((char *) foldbuf, (char **)0, foldlen, do_utf8, m, - (char **)0, ln, UTF)) + (char **)0, ln, (bool)UTF)) && (norun || regtry(prog, s)) ) goto got_it; } @@ -2134,7 +2134,7 @@ S_regtry(pTHX_ regexp *prog, char *startpos) sp = prog->startp; ep = prog->endp; if (prog->nparens) { - for (i = prog->nparens; i > *PL_reglastparen; i--) { + for (i = prog->nparens; i > (I32)*PL_reglastparen; i--) { *++sp = -1; *++ep = -1; } @@ -2384,7 +2384,7 @@ S_regmatch(pTHX_ regnode *prog) case EXACT: s = STRING(scan); ln = STR_LEN(scan); - if (do_utf8 != (UTF!=0)) { + if (do_utf8 != UTF) { /* The target and the pattern have differing utf8ness. */ char *l = locinput; char *e = s + ln; @@ -2445,7 +2445,7 @@ S_regmatch(pTHX_ regnode *prog) char *l = locinput; char *e = PL_regeol; - if (ibcmp_utf8(s, 0, ln, UTF, + if (ibcmp_utf8(s, 0, ln, (bool)UTF, l, &e, 0, do_utf8)) { /* One more case for the sharp s: * pack("U0U*", 0xDF) =~ /ss/i, @@ -2727,7 +2727,7 @@ S_regmatch(pTHX_ regnode *prog) n = ARG(scan); /* which paren pair */ ln = PL_regstartp[n]; PL_reg_leftiter = PL_reg_maxiter; /* Void cache */ - if (*PL_reglastparen < n || ln == -1) + if ((I32)*PL_reglastparen < n || ln == -1) sayNO; /* Do not match unless seen CLOSEn. */ if (ln == PL_regendp[n]) break; @@ -2926,13 +2926,13 @@ S_regmatch(pTHX_ regnode *prog) n = ARG(scan); /* which paren pair */ PL_regstartp[n] = PL_reg_start_tmp[n] - PL_bostr; PL_regendp[n] = locinput - PL_bostr; - if (n > *PL_reglastparen) + if (n > (I32)*PL_reglastparen) *PL_reglastparen = n; *PL_reglastcloseparen = n; break; case GROUPP: n = ARG(scan); /* which paren pair */ - sw = (*PL_reglastparen >= n && PL_regendp[n] != -1); + sw = ((I32)*PL_reglastparen >= n && PL_regendp[n] != -1); break; case IFTHEN: PL_reg_leftiter = PL_reg_maxiter; /* Void cache */ @@ -3034,7 +3034,7 @@ S_regmatch(pTHX_ regnode *prog) PL_regcc = &cc; /* XXXX Probably it is better to teach regpush to support parenfloor > PL_regsize... */ - if (parenfloor > *PL_reglastparen) + if (parenfloor > (I32)*PL_reglastparen) parenfloor = *PL_reglastparen; /* Pessimization... */ cc.parenfloor = parenfloor; cc.cur = -1; @@ -3118,7 +3118,7 @@ S_regmatch(pTHX_ regnode *prog) if (PL_reg_leftiter-- == 0) { I32 size = (PL_reg_maxiter + 7)/8; if (PL_reg_poscache) { - if (PL_reg_poscache_size < size) { + if ((I32)PL_reg_poscache_size < size) { Renew(PL_reg_poscache, size, char); PL_reg_poscache_size = size; } @@ -3303,7 +3303,7 @@ S_regmatch(pTHX_ regnode *prog) if (paren) { if (paren > PL_regsize) PL_regsize = paren; - if (paren > *PL_reglastparen) + if (paren > (I32)*PL_reglastparen) *PL_reglastparen = paren; } scan = NEXTOPER(scan) + NODE_STEP_REGNODE; @@ -3337,7 +3337,7 @@ S_regmatch(pTHX_ regnode *prog) ln = PL_regstartp[n]; /* assume yes if we haven't seen CLOSEn */ if ( - *PL_reglastparen < n || + (I32)*PL_reglastparen < n || ln == -1 || ln == PL_regendp[n] ) { @@ -3419,7 +3419,7 @@ S_regmatch(pTHX_ regnode *prog) ln = PL_regstartp[n]; /* assume yes if we haven't seen CLOSEn */ if ( - *PL_reglastparen < n || + (I32)*PL_reglastparen < n || ln == -1 || ln == PL_regendp[n] ) { @@ -3479,7 +3479,7 @@ S_regmatch(pTHX_ regnode *prog) paren = scan->flags; /* Which paren to set */ if (paren > PL_regsize) PL_regsize = paren; - if (paren > *PL_reglastparen) + if (paren > (I32)*PL_reglastparen) *PL_reglastparen = paren; ln = ARG1(scan); /* min to match */ n = ARG2(scan); /* max to match */ @@ -3528,7 +3528,7 @@ S_regmatch(pTHX_ regnode *prog) ln = PL_regstartp[n]; /* assume yes if we haven't seen CLOSEn */ if ( - *PL_reglastparen < n || + (I32)*PL_reglastparen < n || ln == -1 || ln == PL_regendp[n] ) { @@ -3627,7 +3627,7 @@ S_regmatch(pTHX_ regnode *prog) utf8n_to_uvchr((U8*)locinput, UTF8_MAXLEN, &len, ckWARN(WARN_UTF8) ? - 0 : UTF8_ALLOW_ANY) != c1) { + 0 : UTF8_ALLOW_ANY) != (UV)c1) { locinput += len; count++; } @@ -3639,7 +3639,7 @@ S_regmatch(pTHX_ regnode *prog) UTF8_MAXLEN, &len, ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY); - if (c == c1 || c == c2) + if (c == (UV)c1 || c == (UV)c2) break; locinput += len; count++; @@ -3679,7 +3679,7 @@ S_regmatch(pTHX_ regnode *prog) else c = UCHARAT(PL_reginput); /* If it could work, try it. */ - if (c == c1 || c == c2) + if (c == (UV)c1 || c == (UV)c2) { TRYPAREN(paren, n, PL_reginput); REGCP_UNWIND(lastcp); @@ -3730,7 +3730,7 @@ S_regmatch(pTHX_ regnode *prog) c = UCHARAT(PL_reginput); } /* If it could work, try it. */ - if (c1 == -1000 || c == c1 || c == c2) + if (c1 == -1000 || c == (UV)c1 || c == (UV)c2) { TRYPAREN(paren, n, PL_reginput); REGCP_UNWIND(lastcp); @@ -3753,7 +3753,7 @@ S_regmatch(pTHX_ regnode *prog) c = UCHARAT(PL_reginput); } /* If it could work, try it. */ - if (c1 == -1000 || c == c1 || c == c2) + if (c1 == -1000 || c == (UV)c1 || c == (UV)c2) { TRYPAREN(paren, n, PL_reginput); REGCP_UNWIND(lastcp); @@ -4384,7 +4384,7 @@ S_reginclass(pTHX_ register regnode *n, register U8* p, STRLEN* lenp, register b if (ANYOF_BITMAP_TEST(n, c)) match = TRUE; else if (flags & ANYOF_FOLD) { - I32 f; + U8 f; if (flags & ANYOF_LOCALE) { PL_reg_flags |= RF_tainted; diff --git a/sv.c b/sv.c index 40b7b87..677b535 100644 --- a/sv.c +++ b/sv.c @@ -2867,7 +2867,7 @@ uiv_2buf(char *buf, IV iv, UV uv, int is_uv, char **peob) sign = 1; } do { - *--ptr = '0' + (uv % 10); + *--ptr = '0' + (char)(uv % 10); } while (uv /= 10); if (sign) *--ptr = '-'; @@ -2967,7 +2967,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) int left = 0; int right = 4; char need_newline = 0; - U16 reganch = (re->reganch & PMf_COMPILETIME) >> 12; + U16 reganch = (U16)((re->reganch & PMf_COMPILETIME) >> 12); while((ch = *fptr++)) { if(reganch & 1) { @@ -3090,7 +3090,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) ptr = uiv_2buf(buf, 0, SvUVX(sv), 1, &ebuf); else ptr = uiv_2buf(buf, SvIVX(sv), 0, 0, &ebuf); - SvGROW(sv, ebuf - ptr + 1); /* inlined from sv_setpvn */ + SvGROW(sv, (STRLEN)(ebuf - ptr + 1)); /* inlined from sv_setpvn */ Move(ptr,SvPVX(sv),ebuf - ptr,char); SvCUR_set(sv, ebuf - ptr); s = SvEND(sv); @@ -3746,7 +3746,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) default: if (SvGMAGICAL(sstr) && (flags & SV_GMAGIC)) { mg_get(sstr); - if (SvTYPE(sstr) != stype) { + if ((int)SvTYPE(sstr) != stype) { stype = SvTYPE(sstr); if (stype == SVt_PVGV && dtype <= SVt_PVGV) goto glob_assign; @@ -3755,7 +3755,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) if (stype == SVt_PVLV) (void)SvUPGRADE(dstr, SVt_PVNV); else - (void)SvUPGRADE(dstr, stype); + (void)SvUPGRADE(dstr, (U32)stype); } sflags = SvFLAGS(sstr); @@ -5367,7 +5367,7 @@ Perl_sv_pos_b2u(pTHX_ register SV *sv, I32* offsetp) return; s = (U8*)SvPV(sv, len); - if (len < *offsetp) + if ((I32)len < *offsetp) Perl_croak(aTHX_ "panic: sv_pos_b2u: bad byte offset"); send = s + *offsetp; len = 0; @@ -5721,7 +5721,7 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append) /* Grab the size of the record we're getting */ recsize = SvIV(SvRV(PL_rs)); (void)SvPOK_only(sv); /* Validate pointer */ - buffer = SvGROW(sv, recsize + 1); + buffer = SvGROW(sv, (STRLEN)(recsize + 1)); /* Go yank in */ #ifdef VMS /* VMS wants read instead of fread, because fread doesn't respect */ @@ -5807,15 +5807,15 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append) cnt = PerlIO_get_cnt(fp); /* get count into register */ (void)SvPOK_only(sv); /* validate pointer */ - if (SvLEN(sv) - append <= cnt + 1) { /* make sure we have the room */ - if (cnt > 80 && SvLEN(sv) > append) { + if ((I32)(SvLEN(sv) - append) <= cnt + 1) { /* make sure we have the room */ + if (cnt > 80 && (I32)SvLEN(sv) > append) { shortbuffered = cnt - SvLEN(sv) + append + 1; cnt -= shortbuffered; } else { shortbuffered = 0; /* remember that cnt can be negative */ - SvGROW(sv, append + (cnt <= 0 ? 2 : (cnt + 1))); + SvGROW(sv, (STRLEN)(append + (cnt <= 0 ? 2 : (cnt + 1)))); } } else @@ -5889,14 +5889,14 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append) SvGROW(sv, bpx + cnt + 2); bp = (STDCHAR*)SvPVX(sv) + bpx; /* unbox after relocation */ - *bp++ = i; /* store character from PerlIO_getc */ + *bp++ = (STDCHAR)i; /* store character from PerlIO_getc */ if (rslen && (STDCHAR)i == rslast) /* all done for now? */ goto thats_all_folks; } thats_all_folks: - if ((rslen > 1 && (bp - (STDCHAR*)SvPVX(sv) < rslen)) || + if ((rslen > 1 && (STRLEN)(bp - (STDCHAR*)SvPVX(sv)) < rslen) || memNE((char*)bp - rslen, rsptr, rslen)) goto screamer; /* go back to the fray */ thats_really_all_folks: @@ -5932,7 +5932,7 @@ screamer2: if (rslen) { register STDCHAR *bpe = buf + sizeof(buf); bp = buf; - while ((i = PerlIO_getc(fp)) != EOF && (*bp++ = i) != rslast && bp < bpe) + while ((i = PerlIO_getc(fp)) != EOF && (*bp++ = (STDCHAR)i) != rslast && bp < bpe) ; /* keep reading */ cnt = bp - buf; } @@ -8547,7 +8547,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV SvGROW(sv, SvCUR(sv) + need + dotstrlen + 1); p = SvEND(sv); if (esignlen && fill == '0') { - for (i = 0; i < esignlen; i++) + for (i = 0; i < (int)esignlen; i++) *p++ = esignbuf[i]; } if (gap && !left) { @@ -8555,7 +8555,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV p += gap; } if (esignlen && fill != '0') { - for (i = 0; i < esignlen; i++) + for (i = 0; i < (int)esignlen; i++) *p++ = esignbuf[i]; } if (zeros) { @@ -9324,10 +9324,12 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) PERL_HV_ARRAY_ALLOC_BYTES(dxhv->xhv_max+1), char); while (i <= sxhv->xhv_max) { ((HE**)dxhv->xhv_array)[i] = he_dup(((HE**)sxhv->xhv_array)[i], - !!HvSHAREKEYS(sstr), param); + (bool)!!HvSHAREKEYS(sstr), + param); ++i; } - dxhv->xhv_eiter = he_dup(sxhv->xhv_eiter, !!HvSHAREKEYS(sstr), param); + dxhv->xhv_eiter = he_dup(sxhv->xhv_eiter, + (bool)!!HvSHAREKEYS(sstr), param); } else { SvPVX(dstr) = Nullch; diff --git a/toke.c b/toke.c index 2e862b4..cf04cfa 100644 --- a/toke.c +++ b/toke.c @@ -302,7 +302,7 @@ S_missingterm(pTHX_ char *s) s = tmpbuf; } else { - *tmpbuf = PL_multi_close; + *tmpbuf = (char)PL_multi_close; tmpbuf[1] = '\0'; s = tmpbuf; } @@ -711,7 +711,7 @@ S_lop(pTHX_ I32 f, int x, char *s) PL_expect = x; PL_bufptr = s; PL_last_lop = PL_oldbufptr; - PL_last_lop_op = f; + PL_last_lop_op = (OPCODE)f; if (PL_nexttoke) return LSTOP; if (*s == '(') @@ -1069,7 +1069,7 @@ S_sublex_push(pTHX) *PL_lex_casestack = '\0'; PL_lex_starts = 0; PL_lex_state = LEX_INTERPCONCAT; - CopLINE_set(PL_curcop, PL_multi_start); + CopLINE_set(PL_curcop, (line_t)PL_multi_start); PL_lex_inwhat = PL_sublex_info.sub_inwhat; if (PL_lex_inwhat == OP_MATCH || PL_lex_inwhat == OP_QR || PL_lex_inwhat == OP_SUBST) @@ -1288,7 +1288,7 @@ S_scan_const(pTHX_ char *start) else #endif for (i = min; i <= max; i++) - *d++ = i; + *d++ = (char)i; /* mark the range as done, and continue */ dorange = FALSE; @@ -1496,8 +1496,8 @@ S_scan_const(pTHX_ char *start) while (src >= (U8 *)SvPVX(sv)) { if (!NATIVE_IS_INVARIANT(*src)) { U8 ch = NATIVE_TO_ASCII(*src); - *dst-- = UTF8_EIGHT_BIT_LO(ch); - *dst-- = UTF8_EIGHT_BIT_HI(ch); + *dst-- = (U8)UTF8_EIGHT_BIT_LO(ch); + *dst-- = (U8)UTF8_EIGHT_BIT_HI(ch); } else { *dst-- = *src; @@ -1573,11 +1573,11 @@ S_scan_const(pTHX_ char *start) *d = '\0'; sv_utf8_upgrade(sv); /* this just broke our allocation above... */ - SvGROW(sv, send - start); + SvGROW(sv, (STRLEN)(send - start)); d = SvPVX(sv) + SvCUR(sv); has_utf8 = TRUE; } - if (len > e - s + 4) { /* I _guess_ 4 is \N{} --jhi */ + if (len > (STRLEN)(e - s + 4)) { /* I _guess_ 4 is \N{} --jhi */ char *odest = SvPVX(sv); SvGROW(sv, (SvLEN(sv) + len - (e - s + 4))); @@ -2039,7 +2039,7 @@ Perl_filter_read(pTHX_ int idx, SV *buf_sv, int maxlen) int old_len = SvCUR(buf_sv) ; /* ensure buf_sv is large enough */ - SvGROW(buf_sv, old_len + maxlen) ; + SvGROW(buf_sv, (STRLEN)(old_len + maxlen)) ; if ((len = PerlIO_read(PL_rsfp, SvPVX(buf_sv) + old_len, maxlen)) <= 0){ if (PerlIO_error(PL_rsfp)) return -1; /* error */ @@ -2251,7 +2251,7 @@ Perl_yylex(pTHX) "### Saw case modifier at '%s'\n", PL_bufptr); }); s = PL_bufptr + 1; if (strnEQ(s, "L\\u", 3) || strnEQ(s, "U\\l", 3)) - tmp = *s, *s = s[2], s[2] = tmp; /* misordered... */ + tmp = *s, *s = s[2], s[2] = (char)tmp; /* misordered... */ if (strchr("LU", *s) && (strchr(PL_lex_casestack, 'L') || strchr(PL_lex_casestack, 'U'))) { @@ -2535,7 +2535,7 @@ Perl_yylex(pTHX) if (!PL_preprocess) bof = PerlIO_tell(PL_rsfp) == SvCUR(PL_linestr); #else - bof = PerlIO_tell(PL_rsfp) == SvCUR(PL_linestr); + bof = PerlIO_tell(PL_rsfp) == (Off_t)SvCUR(PL_linestr); #endif if (bof) { PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); @@ -2830,7 +2830,7 @@ Perl_yylex(pTHX) break; } if (ftst) { - PL_last_lop_op = ftst; + PL_last_lop_op = (OPCODE)ftst; DEBUG_T( { PerlIO_printf(Perl_debug_log, "### Saw file test %c\n", (int)ftst); } ); @@ -6523,7 +6523,7 @@ S_scan_heredoc(pTHX_ register char *s) CopLINE_inc(PL_curcop); } if (s >= bufend) { - CopLINE_set(PL_curcop, PL_multi_start); + CopLINE_set(PL_curcop, (line_t)PL_multi_start); missingterm(PL_tokenbuf); } sv_setpvn(herewas,bufptr,d-bufptr+1); @@ -6543,7 +6543,7 @@ S_scan_heredoc(pTHX_ register char *s) CopLINE_inc(PL_curcop); } if (s >= PL_bufend) { - CopLINE_set(PL_curcop, PL_multi_start); + CopLINE_set(PL_curcop, (line_t)PL_multi_start); missingterm(PL_tokenbuf); } sv_setpvn(tmpstr,d+1,s-d); @@ -6561,7 +6561,7 @@ S_scan_heredoc(pTHX_ register char *s) while (s >= PL_bufend) { /* multiple line string? */ if (!outer || !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = filter_gets(PL_linestr, PL_rsfp, 0))) { - CopLINE_set(PL_curcop, PL_multi_start); + CopLINE_set(PL_curcop, (line_t)PL_multi_start); missingterm(PL_tokenbuf); } CopLINE_inc(PL_curcop); @@ -6954,7 +6954,7 @@ S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims) if (!PL_rsfp || !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = filter_gets(PL_linestr, PL_rsfp, 0))) { sv_free(sv); - CopLINE_set(PL_curcop, PL_multi_start); + CopLINE_set(PL_curcop, (line_t)PL_multi_start); return Nullch; } /* we read a line, so increment our line counter */ diff --git a/universal.c b/universal.c index 926d1c3..b92bd7a 100644 --- a/universal.c +++ b/universal.c @@ -49,7 +49,7 @@ S_isa_lookup(pTHX_ HV *stash, const char *name, HV* name_stash, if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (subgen = GvSV(gv)) && (hv = GvHV(gv))) { - if (SvIV(subgen) == PL_sub_generation) { + if (SvIV(subgen) == (IV)PL_sub_generation) { SV* sv; SV** svp = (SV**)hv_fetch(hv, name, len, FALSE); if (svp && (sv = *svp) != (SV*)&PL_sv_undef) { @@ -513,7 +513,7 @@ XS(XS_Internals_hv_clear_placehold) /* I don't care how many parameters were passed in, but I want to avoid the unused variable warning. */ - items = HvPLACEHOLDERS(hv); + items = (I32)HvPLACEHOLDERS(hv); if (items) { HE *entry; diff --git a/utf8.c b/utf8.c index 3ad3a95..c2818c8 100644 --- a/utf8.c +++ b/utf8.c @@ -75,7 +75,7 @@ Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) "Unicode character 0x%04"UVxf" is illegal", uv); } if (UNI_IS_INVARIANT(uv)) { - *d++ = UTF_TO_NATIVE(uv); + *d++ = (U8)UTF_TO_NATIVE(uv); return d; } #if defined(EBCDIC) @@ -83,76 +83,76 @@ Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) STRLEN len = UNISKIP(uv); U8 *p = d+len-1; while (p > d) { - *p-- = UTF_TO_NATIVE((uv & UTF_CONTINUATION_MASK) | UTF_CONTINUATION_MARK); + *p-- = (U8)UTF_TO_NATIVE((uv & UTF_CONTINUATION_MASK) | UTF_CONTINUATION_MARK); uv >>= UTF_ACCUMULATION_SHIFT; } - *p = UTF_TO_NATIVE((uv & UTF_START_MASK(len)) | UTF_START_MARK(len)); + *p = (U8)UTF_TO_NATIVE((uv & UTF_START_MASK(len)) | UTF_START_MARK(len)); return d+len; } #else /* Non loop style */ if (uv < 0x800) { - *d++ = (( uv >> 6) | 0xc0); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = (U8)(( uv >> 6) | 0xc0); + *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } if (uv < 0x10000) { - *d++ = (( uv >> 12) | 0xe0); - *d++ = (((uv >> 6) & 0x3f) | 0x80); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = (U8)(( uv >> 12) | 0xe0); + *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); + *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } if (uv < 0x200000) { - *d++ = (( uv >> 18) | 0xf0); - *d++ = (((uv >> 12) & 0x3f) | 0x80); - *d++ = (((uv >> 6) & 0x3f) | 0x80); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = (U8)(( uv >> 18) | 0xf0); + *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); + *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } if (uv < 0x4000000) { - *d++ = (( uv >> 24) | 0xf8); - *d++ = (((uv >> 18) & 0x3f) | 0x80); - *d++ = (((uv >> 12) & 0x3f) | 0x80); - *d++ = (((uv >> 6) & 0x3f) | 0x80); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = (U8)(( uv >> 24) | 0xf8); + *d++ = (U8)(((uv >> 18) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); + *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } if (uv < 0x80000000) { - *d++ = (( uv >> 30) | 0xfc); - *d++ = (((uv >> 24) & 0x3f) | 0x80); - *d++ = (((uv >> 18) & 0x3f) | 0x80); - *d++ = (((uv >> 12) & 0x3f) | 0x80); - *d++ = (((uv >> 6) & 0x3f) | 0x80); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = (U8)(( uv >> 30) | 0xfc); + *d++ = (U8)(((uv >> 24) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 18) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); + *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } #ifdef HAS_QUAD if (uv < UTF8_QUAD_MAX) #endif { - *d++ = 0xfe; /* Can't match U+FEFF! */ - *d++ = (((uv >> 30) & 0x3f) | 0x80); - *d++ = (((uv >> 24) & 0x3f) | 0x80); - *d++ = (((uv >> 18) & 0x3f) | 0x80); - *d++ = (((uv >> 12) & 0x3f) | 0x80); - *d++ = (((uv >> 6) & 0x3f) | 0x80); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = 0xfe; /* Can't match U+FEFF! */ + *d++ = (U8)(((uv >> 30) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 24) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 18) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); + *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } #ifdef HAS_QUAD { - *d++ = 0xff; /* Can't match U+FFFE! */ - *d++ = 0x80; /* 6 Reserved bits */ - *d++ = (((uv >> 60) & 0x0f) | 0x80); /* 2 Reserved bits */ - *d++ = (((uv >> 54) & 0x3f) | 0x80); - *d++ = (((uv >> 48) & 0x3f) | 0x80); - *d++ = (((uv >> 42) & 0x3f) | 0x80); - *d++ = (((uv >> 36) & 0x3f) | 0x80); - *d++ = (((uv >> 30) & 0x3f) | 0x80); - *d++ = (((uv >> 24) & 0x3f) | 0x80); - *d++ = (((uv >> 18) & 0x3f) | 0x80); - *d++ = (((uv >> 12) & 0x3f) | 0x80); - *d++ = (((uv >> 6) & 0x3f) | 0x80); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = 0xff; /* Can't match U+FFFE! */ + *d++ = 0x80; /* 6 Reserved bits */ + *d++ = (U8)(((uv >> 60) & 0x0f) | 0x80); /* 2 Reserved bits */ + *d++ = (U8)(((uv >> 54) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 48) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 42) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 36) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 30) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 24) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 18) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); + *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } #endif @@ -208,7 +208,7 @@ Perl_is_utf8_char(pTHX_ U8 *s) s++; } - if (UNISKIP(uv) < len) + if ((STRLEN)UNISKIP(uv) < len) return 0; return len; @@ -388,7 +388,7 @@ Perl_utf8n_to_uvuni(pTHX_ U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) !(flags & UTF8_ALLOW_SURROGATE)) { warning = UTF8_WARN_SURROGATE; goto malformed; - } else if ((expectlen > UNISKIP(uv)) && + } else if ((expectlen > (STRLEN)UNISKIP(uv)) && !(flags & UTF8_ALLOW_LONG)) { warning = UTF8_WARN_LONG; goto malformed; @@ -779,10 +779,10 @@ Perl_bytes_to_utf8(pTHX_ U8 *s, STRLEN *len) while (s < send) { UV uv = NATIVE_TO_ASCII(*s++); if (UNI_IS_INVARIANT(uv)) - *d++ = UTF_TO_NATIVE(uv); + *d++ = (U8)UTF_TO_NATIVE(uv); else { - *d++ = UTF8_EIGHT_BIT_HI(uv); - *d++ = UTF8_EIGHT_BIT_LO(uv); + *d++ = (U8)UTF8_EIGHT_BIT_HI(uv); + *d++ = (U8)UTF8_EIGHT_BIT_LO(uv); } } *d = '\0'; @@ -811,12 +811,12 @@ Perl_utf16_to_utf8(pTHX_ U8* p, U8* d, I32 bytelen, I32 *newlen) UV uv = (p[0] << 8) + p[1]; /* UTF-16BE */ p += 2; if (uv < 0x80) { - *d++ = uv; + *d++ = (U8)uv; continue; } if (uv < 0x800) { - *d++ = (( uv >> 6) | 0xc0); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = (U8)(( uv >> 6) | 0xc0); + *d++ = (U8)(( uv & 0x3f) | 0x80); continue; } if (uv >= 0xd800 && uv < 0xdbff) { /* surrogates */ @@ -826,16 +826,16 @@ Perl_utf16_to_utf8(pTHX_ U8* p, U8* d, I32 bytelen, I32 *newlen) uv = ((uv - 0xd800) << 10) + (low - 0xdc00) + 0x10000; } if (uv < 0x10000) { - *d++ = (( uv >> 12) | 0xe0); - *d++ = (((uv >> 6) & 0x3f) | 0x80); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = (U8)(( uv >> 12) | 0xe0); + *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); + *d++ = (U8)(( uv & 0x3f) | 0x80); continue; } else { - *d++ = (( uv >> 18) | 0xf0); - *d++ = (((uv >> 12) & 0x3f) | 0x80); - *d++ = (((uv >> 6) & 0x3f) | 0x80); - *d++ = (( uv & 0x3f) | 0x80); + *d++ = (U8)(( uv >> 18) | 0xf0); + *d++ = (U8)(((uv >> 12) & 0x3f) | 0x80); + *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); + *d++ = (U8)(( uv & 0x3f) | 0x80); continue; } } @@ -1127,13 +1127,13 @@ Perl_is_utf8_alnum(pTHX_ U8 *p) * descendant of isalnum(3), in other words, it doesn't * contain the '_'. --jhi */ PL_utf8_alnum = swash_init("utf8", "IsWord", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_alnum, p, TRUE); + return swash_fetch(PL_utf8_alnum, p, TRUE) != 0; /* return *p == '_' || is_utf8_alpha(p) || is_utf8_digit(p); */ #ifdef SURPRISINGLY_SLOWER /* probably because alpha is usually true */ if (!PL_utf8_alnum) PL_utf8_alnum = swash_init("utf8", "", sv_2mortal(newSVpv("+utf8::IsAlpha\n+utf8::IsDigit\n005F\n",0)), 0, 0); - return swash_fetch(PL_utf8_alnum, p, TRUE); + return swash_fetch(PL_utf8_alnum, p, TRUE) != 0; #endif } @@ -1144,13 +1144,13 @@ Perl_is_utf8_alnumc(pTHX_ U8 *p) return FALSE; if (!PL_utf8_alnum) PL_utf8_alnum = swash_init("utf8", "IsAlnumC", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_alnum, p, TRUE); + return swash_fetch(PL_utf8_alnum, p, TRUE) != 0; /* return is_utf8_alpha(p) || is_utf8_digit(p); */ #ifdef SURPRISINGLY_SLOWER /* probably because alpha is usually true */ if (!PL_utf8_alnum) PL_utf8_alnum = swash_init("utf8", "", sv_2mortal(newSVpv("+utf8::IsAlpha\n+utf8::IsDigit\n005F\n",0)), 0, 0); - return swash_fetch(PL_utf8_alnum, p, TRUE); + return swash_fetch(PL_utf8_alnum, p, TRUE) != 0; #endif } @@ -1163,7 +1163,7 @@ Perl_is_utf8_idfirst(pTHX_ U8 *p) /* The naming is historical. */ return FALSE; if (!PL_utf8_idstart) /* is_utf8_idstart would be more logical. */ PL_utf8_idstart = swash_init("utf8", "IdStart", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_idstart, p, TRUE); + return swash_fetch(PL_utf8_idstart, p, TRUE) != 0; } bool @@ -1175,7 +1175,7 @@ Perl_is_utf8_idcont(pTHX_ U8 *p) return FALSE; if (!PL_utf8_idcont) PL_utf8_idcont = swash_init("utf8", "IdContinue", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_idcont, p, TRUE); + return swash_fetch(PL_utf8_idcont, p, TRUE) != 0; } bool @@ -1185,7 +1185,7 @@ Perl_is_utf8_alpha(pTHX_ U8 *p) return FALSE; if (!PL_utf8_alpha) PL_utf8_alpha = swash_init("utf8", "IsAlpha", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_alpha, p, TRUE); + return swash_fetch(PL_utf8_alpha, p, TRUE) != 0; } bool @@ -1195,7 +1195,7 @@ Perl_is_utf8_ascii(pTHX_ U8 *p) return FALSE; if (!PL_utf8_ascii) PL_utf8_ascii = swash_init("utf8", "IsAscii", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_ascii, p, TRUE); + return swash_fetch(PL_utf8_ascii, p, TRUE) != 0; } bool @@ -1205,7 +1205,7 @@ Perl_is_utf8_space(pTHX_ U8 *p) return FALSE; if (!PL_utf8_space) PL_utf8_space = swash_init("utf8", "IsSpacePerl", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_space, p, TRUE); + return swash_fetch(PL_utf8_space, p, TRUE) != 0; } bool @@ -1215,7 +1215,7 @@ Perl_is_utf8_digit(pTHX_ U8 *p) return FALSE; if (!PL_utf8_digit) PL_utf8_digit = swash_init("utf8", "IsDigit", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_digit, p, TRUE); + return swash_fetch(PL_utf8_digit, p, TRUE) != 0; } bool @@ -1225,7 +1225,7 @@ Perl_is_utf8_upper(pTHX_ U8 *p) return FALSE; if (!PL_utf8_upper) PL_utf8_upper = swash_init("utf8", "IsUpper", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_upper, p, TRUE); + return swash_fetch(PL_utf8_upper, p, TRUE) != 0; } bool @@ -1235,7 +1235,7 @@ Perl_is_utf8_lower(pTHX_ U8 *p) return FALSE; if (!PL_utf8_lower) PL_utf8_lower = swash_init("utf8", "IsLower", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_lower, p, TRUE); + return swash_fetch(PL_utf8_lower, p, TRUE) != 0; } bool @@ -1245,7 +1245,7 @@ Perl_is_utf8_cntrl(pTHX_ U8 *p) return FALSE; if (!PL_utf8_cntrl) PL_utf8_cntrl = swash_init("utf8", "IsCntrl", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_cntrl, p, TRUE); + return swash_fetch(PL_utf8_cntrl, p, TRUE) != 0; } bool @@ -1255,7 +1255,7 @@ Perl_is_utf8_graph(pTHX_ U8 *p) return FALSE; if (!PL_utf8_graph) PL_utf8_graph = swash_init("utf8", "IsGraph", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_graph, p, TRUE); + return swash_fetch(PL_utf8_graph, p, TRUE) != 0; } bool @@ -1265,7 +1265,7 @@ Perl_is_utf8_print(pTHX_ U8 *p) return FALSE; if (!PL_utf8_print) PL_utf8_print = swash_init("utf8", "IsPrint", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_print, p, TRUE); + return swash_fetch(PL_utf8_print, p, TRUE) != 0; } bool @@ -1275,7 +1275,7 @@ Perl_is_utf8_punct(pTHX_ U8 *p) return FALSE; if (!PL_utf8_punct) PL_utf8_punct = swash_init("utf8", "IsPunct", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_punct, p, TRUE); + return swash_fetch(PL_utf8_punct, p, TRUE) != 0; } bool @@ -1285,7 +1285,7 @@ Perl_is_utf8_xdigit(pTHX_ U8 *p) return FALSE; if (!PL_utf8_xdigit) PL_utf8_xdigit = swash_init("utf8", "IsXDigit", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_xdigit, p, TRUE); + return swash_fetch(PL_utf8_xdigit, p, TRUE) != 0; } bool @@ -1295,7 +1295,7 @@ Perl_is_utf8_mark(pTHX_ U8 *p) return FALSE; if (!PL_utf8_mark) PL_utf8_mark = swash_init("utf8", "IsM", &PL_sv_undef, 0, 0); - return swash_fetch(PL_utf8_mark, p, TRUE); + return swash_fetch(PL_utf8_mark, p, TRUE) != 0; } /* @@ -1551,7 +1551,7 @@ Perl_swash_init(pTHX_ char* pkg, char* name, SV *listsv, I32 minbits, I32 none) char* pv = SvPV(tokenbufsv, len); Copy(pv, PL_tokenbuf, len+1, char); - PL_curcop->op_private = PL_hints; + PL_curcop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); } if (!SvROK(retval) || SvTYPE(SvRV(retval)) != SVt_PVHV) { if (SvPOK(retval)) @@ -1583,8 +1583,8 @@ Perl_swash_fetch(pTHX_ SV *sv, U8 *ptr, bool do_utf8) UV c = NATIVE_TO_ASCII(*ptr); if (!do_utf8 && !UNI_IS_INVARIANT(c)) { - tmputf8[0] = UTF8_EIGHT_BIT_HI(c); - tmputf8[1] = UTF8_EIGHT_BIT_LO(c); + tmputf8[0] = (U8)UTF8_EIGHT_BIT_HI(c); + tmputf8[1] = (U8)UTF8_EIGHT_BIT_LO(c); ptr = tmputf8; } /* Given a UTF-X encoded char 0xAA..0xYY,0xZZ @@ -1664,7 +1664,7 @@ Perl_swash_fetch(pTHX_ SV *sv, U8 *ptr, bool do_utf8) FREETMPS; LEAVE; if (PL_curcop == &PL_compiling) - PL_curcop->op_private = PL_hints; + PL_curcop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); svp = hv_store(hv, (char*)ptr, klen, retval, 0); @@ -1880,11 +1880,11 @@ Perl_ibcmp_utf8(pTHX_ const char *s1, char **pe1, register UV l1, bool u1, const if (pe1) e1 = *(U8**)pe1; - if (e1 == 0 || (l1 && l1 < e1 - (U8*)s1)) + if (e1 == 0 || (l1 && l1 < (UV)(e1 - (U8*)s1))) f1 = (U8*)s1 + l1; if (pe2) e2 = *(U8**)pe2; - if (e2 == 0 || (l2 && l2 < e2 - (U8*)s2)) + if (e2 == 0 || (l2 && l2 < (UV)(e2 - (U8*)s2))) f2 = (U8*)s2 + l2; if ((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0)) diff --git a/util.c b/util.c index 5336ad0..6b95a4d 100644 --- a/util.c +++ b/util.c @@ -546,7 +546,7 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags) } } BmRARE(sv) = s[rarest]; - BmPREVIOUS(sv) = rarest; + BmPREVIOUS(sv) = (U16)rarest; BmUSEFUL(sv) = 100; /* Initial value */ if (flags & FBMcf_TAIL) SvTAIL_on(sv); @@ -578,9 +578,9 @@ Perl_fbm_instr(pTHX_ unsigned char *big, register unsigned char *bigend, SV *lit register STRLEN littlelen = l; register I32 multiline = flags & FBMrf_MULTILINE; - if (bigend - big < littlelen) { + if ((STRLEN)(bigend - big) < littlelen) { if ( SvTAIL(littlestr) - && (bigend - big == littlelen - 1) + && ((STRLEN)(bigend - big) == littlelen - 1) && (littlelen == 1 || (*big == *little && memEQ((char *)big, (char *)little, littlelen - 1)))) @@ -707,7 +707,7 @@ Perl_fbm_instr(pTHX_ unsigned char *big, register unsigned char *bigend, SV *lit register unsigned char *table = little + littlelen + FBM_TABLE_OFFSET; register unsigned char *oldlittle; - if (littlelen > bigend - big) + if (littlelen > (STRLEN)(bigend - big)) return Nullch; --littlelen; /* Last char found by table lookup */ @@ -2524,6 +2524,9 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags) hv_iterinit(PL_pidstatus); if ((entry = hv_iternext(PL_pidstatus))) { + SV *sv; + char spid[TYPE_CHARS(int)]; + pid = atoi(hv_iterkey(entry,(I32*)statusp)); sv = hv_iterval(PL_pidstatus,entry); *statusp = SvIVX(sv); diff --git a/vms/perly_c.vms b/vms/perly_c.vms index 90726fe..2b99328 100644 --- a/vms/perly_c.vms +++ b/vms/perly_c.vms @@ -1616,7 +1616,7 @@ break; case 2: #line 136 "perly.y" { if (PL_copline > (line_t)yyvsp[-3].ival) - PL_copline = yyvsp[-3].ival; + PL_copline = (line_t)yyvsp[-3].ival; yyval.opval = block_end(yyvsp[-2].ival, yyvsp[-1].opval); } break; case 3: @@ -1635,7 +1635,7 @@ break; case 5: #line 156 "perly.y" { if (PL_copline > (line_t)yyvsp[-3].ival) - PL_copline = yyvsp[-3].ival; + PL_copline = (line_t)yyvsp[-3].ival; yyval.opval = block_end(yyvsp[-2].ival, yyvsp[-1].opval); } break; case 6: @@ -1703,7 +1703,7 @@ case 19: break; case 20: #line 209 "perly.y" -{ yyval.opval = newFOROP(0, Nullch, yyvsp[-1].ival, +{ yyval.opval = newFOROP(0, Nullch, (line_t)yyvsp[-1].ival, Nullop, yyvsp[0].opval, yyvsp[-2].opval, Nullop); } break; case 21: @@ -1716,19 +1716,19 @@ case 22: break; case 23: #line 219 "perly.y" -{ PL_copline = yyvsp[-5].ival; +{ PL_copline = (line_t)yyvsp[-5].ival; yyval.opval = newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval); PL_hints |= HINT_BLOCK_SCOPE; } break; case 24: #line 226 "perly.y" -{ PL_copline = yyvsp[-6].ival; +{ PL_copline = (line_t)yyvsp[-6].ival; yyval.opval = block_end(yyvsp[-4].ival, newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval)); } break; case 25: #line 230 "perly.y" -{ PL_copline = yyvsp[-6].ival; +{ PL_copline = (line_t)yyvsp[-6].ival; yyval.opval = block_end(yyvsp[-4].ival, newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval)); } break; @@ -1742,7 +1742,7 @@ case 27: break; case 28: #line 244 "perly.y" -{ PL_copline = yyvsp[-6].ival; +{ PL_copline = (line_t)yyvsp[-6].ival; yyval.opval = block_end(yyvsp[-4].ival, newSTATEOP(0, yyvsp[-7].pval, newWHILEOP(0, 1, (LOOP*)Nullop, @@ -1750,7 +1750,7 @@ case 28: break; case 29: #line 250 "perly.y" -{ PL_copline = yyvsp[-6].ival; +{ PL_copline = (line_t)yyvsp[-6].ival; yyval.opval = block_end(yyvsp[-4].ival, newSTATEOP(0, yyvsp[-7].pval, newWHILEOP(0, 1, (LOOP*)Nullop, @@ -1759,23 +1759,23 @@ break; case 30: #line 256 "perly.y" { yyval.opval = block_end(yyvsp[-6].ival, - newFOROP(0, yyvsp[-9].pval, yyvsp[-8].ival, yyvsp[-5].opval, yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } + newFOROP(0, yyvsp[-9].pval, (line_t)yyvsp[-8].ival, yyvsp[-5].opval, yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } break; case 31: #line 259 "perly.y" { yyval.opval = block_end(yyvsp[-4].ival, - newFOROP(0, yyvsp[-8].pval, yyvsp[-7].ival, mod(yyvsp[-6].opval, OP_ENTERLOOP), + newFOROP(0, yyvsp[-8].pval, (line_t)yyvsp[-7].ival, mod(yyvsp[-6].opval, OP_ENTERLOOP), yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } break; case 32: #line 263 "perly.y" { yyval.opval = block_end(yyvsp[-4].ival, - newFOROP(0, yyvsp[-7].pval, yyvsp[-6].ival, Nullop, yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } + newFOROP(0, yyvsp[-7].pval, (line_t)yyvsp[-6].ival, Nullop, yyvsp[-3].opval, yyvsp[-1].opval, yyvsp[0].opval)); } break; case 33: #line 267 "perly.y" { OP *forop; - PL_copline = yyvsp[-9].ival; + PL_copline = (line_t)yyvsp[-9].ival; forop = newSTATEOP(0, yyvsp[-10].pval, newWHILEOP(0, 1, (LOOP*)Nullop, yyvsp[-9].ival, scalar(yyvsp[-4].opval), diff --git a/win32/perllib.c b/win32/perllib.c index 4e4c113..4aeb741 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -167,7 +167,6 @@ RunPerl(int argc, char **argv, char **env) * want to free() argv after main() returns. As luck would have it, * Borland's CRT does the right thing to argv[0] already. */ char szModuleName[MAX_PATH]; - char *ptr; GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); (void)win32_longpath(szModuleName); diff --git a/win32/win32.c b/win32/win32.c index 67aeae6..28619fd 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -208,7 +208,6 @@ get_emd_part(SV **prev_pathp, char *trailing_path, ...) char *ptr; char *optr; char *strip; - int oldsize, newsize; STRLEN baselen; va_start(ap, trailing_path); @@ -286,8 +285,6 @@ win32_get_xlib(const char *pl, const char *xlib, const char *libname) dTHX; char regstr[40]; char pathstr[MAX_PATH+1]; - DWORD datalen; - int len, newsize; SV *sv1 = Nullsv; SV *sv2 = Nullsv; @@ -1022,7 +1019,7 @@ find_pid(int pid) dTHX; long child = w32_num_children; while (--child >= 0) { - if (w32_child_pids[child] == pid) + if ((int)w32_child_pids[child] == pid) return child; } return -1; @@ -1049,7 +1046,7 @@ find_pseudo_pid(int pid) dTHX; long child = w32_num_pseudo_children; while (--child >= 0) { - if (w32_pseudo_child_pids[child] == pid) + if ((int)w32_pseudo_child_pids[child] == pid) return child; } return -1; @@ -1220,7 +1217,7 @@ win32_stat(const char *path, Stat_t *sbuf) #if defined(WIN64) || defined(USE_LARGE_FILES) res = _wstati64(pwbuffer, sbuf); #else - res = _wstat(pwbuffer, sbuf); + res = _wstat(pwbuffer, (struct _stat*)sbuf); #endif } else { @@ -1952,7 +1949,6 @@ win32_internal_wait(int *status, DWORD timeout) } } -FAILED: errno = GetLastError(); return -1; } @@ -3551,7 +3547,7 @@ qualified_path(const char *cmd) if (*pathstr == '"') { /* foo;"baz;etc";bar */ pathstr++; /* skip initial '"' */ while (*pathstr && *pathstr != '"') { - if (curfullcmd-fullcmd < MAX_PATH-cmdlen-5) + if ((STRLEN)(curfullcmd-fullcmd) < MAX_PATH-cmdlen-5) *curfullcmd++ = *pathstr; pathstr++; } @@ -3559,7 +3555,7 @@ qualified_path(const char *cmd) pathstr++; /* skip trailing '"' */ } else { - if (curfullcmd-fullcmd < MAX_PATH-cmdlen-5) + if ((STRLEN)(curfullcmd-fullcmd) < MAX_PATH-cmdlen-5) *curfullcmd++ = *pathstr; pathstr++; } @@ -3572,7 +3568,7 @@ qualified_path(const char *cmd) *curfullcmd++ = '\\'; } } -GIVE_UP: + Safefree(fullcmd); return Nullch; } diff --git a/win32/win32sck.c b/win32/win32sck.c index 70a3038..947a42a 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -291,7 +291,7 @@ win32_select(int nfds, Perl_fd_set* rd, Perl_fd_set* wr, Perl_fd_set* ex, const int r; #ifdef USE_SOCKETS_AS_HANDLES Perl_fd_set dummy; - int i, fd, bit, offset; + int i, fd; FD_SET nrd, nwr, nex, *prd, *pwr, *pex; /* winsock seems incapable of dealing with all three null fd_sets,