From: Steve Hay Date: Mon, 17 Oct 2005 10:14:46 +0000 (+0000) Subject: Make some casts explicit to keep VC++ 7 happy X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=585ec06d680e861557397efeb05210638532c6dc;p=p5sagit%2Fp5-mst-13.2.git Make some casts explicit to keep VC++ 7 happy Specifically, this silences the warnings from the following smoke: http://www.nntp.perl.org/group/perl.daily-build.reports/32258 (Hmm. Looks like you need to decode the base64 yourself before you can read that.) p4raw-id: //depot/perl@25779 --- diff --git a/numeric.c b/numeric.c index 2970dad..0f353cf 100644 --- a/numeric.c +++ b/numeric.c @@ -151,7 +151,7 @@ Perl_grok_bin(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { NV value_nv = 0; const UV max_div_2 = UV_MAX / 2; - const bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; + const bool allow_underscores = (bool)(*flags & PERL_SCAN_ALLOW_UNDERSCORES); bool overflowed = FALSE; char bit; @@ -268,7 +268,7 @@ Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { NV value_nv = 0; const UV max_div_16 = UV_MAX / 16; - const bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; + const bool allow_underscores = (bool)(*flags & PERL_SCAN_ALLOW_UNDERSCORES); bool overflowed = FALSE; if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { @@ -382,7 +382,7 @@ Perl_grok_oct(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { NV value_nv = 0; const UV max_div_8 = UV_MAX / 8; - const bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; + const bool allow_underscores = (bool)(*flags & PERL_SCAN_ALLOW_UNDERSCORES); bool overflowed = FALSE; for (; len-- && *s; s++) { diff --git a/op.c b/op.c index 7272538..5d593f8 100644 --- a/op.c +++ b/op.c @@ -2324,7 +2324,7 @@ Perl_newUNOP(pTHX_ I32 type, I32 flags, OP *first) unop->op_type = (OPCODE)type; unop->op_ppaddr = PL_ppaddr[type]; unop->op_first = first; - unop->op_flags = flags | OPf_KIDS; + unop->op_flags = (U8)(flags | OPf_KIDS); unop->op_private = (U8)(1 | (flags >> 8)); unop = (UNOP*) CHECKOP(type, unop); if (unop->op_next) @@ -2346,7 +2346,7 @@ Perl_newBINOP(pTHX_ I32 type, I32 flags, OP *first, OP *last) binop->op_type = (OPCODE)type; binop->op_ppaddr = PL_ppaddr[type]; binop->op_first = first; - binop->op_flags = flags | OPf_KIDS; + binop->op_flags = (U8)(flags | OPf_KIDS); if (!last) { last = first; binop->op_private = (U8)(1 | (flags >> 8)); @@ -2643,7 +2643,7 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) j = rlen - 1; else cPVOPo->op_pv = (char*)Renew(tbl, 0x101+rlen-j, short); - tbl[0x100] = rlen - j; + tbl[0x100] = (short)(rlen - j); for (i=0; i < (I32)rlen - j; i++) tbl[0x101+i] = r[j+i]; } @@ -3625,7 +3625,7 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp) logop->op_type = (OPCODE)type; logop->op_ppaddr = PL_ppaddr[type]; logop->op_first = first; - logop->op_flags = flags | OPf_KIDS; + logop->op_flags = (U8)(flags | OPf_KIDS); logop->op_other = LINKLIST(other); logop->op_private = (U8)(1 | (flags >> 8)); @@ -3676,7 +3676,7 @@ Perl_newCONDOP(pTHX_ I32 flags, OP *first, OP *trueop, OP *falseop) logop->op_type = OP_COND_EXPR; logop->op_ppaddr = PL_ppaddr[OP_COND_EXPR]; logop->op_first = first; - logop->op_flags = flags | OPf_KIDS; + logop->op_flags = (U8)(flags | OPf_KIDS); logop->op_private = (U8)(1 | (flags >> 8)); logop->op_other = LINKLIST(trueop); logop->op_next = LINKLIST(falseop); diff --git a/pp_pack.c b/pp_pack.c index 92d0a36..24faef5 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -2987,7 +2987,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) ckWARN(WARN_PACK)) Perl_warner(aTHX_ packWARN(WARN_PACK), "Character in 'c' format wrapped in pack"); - PUSH_BYTE(utf8, cur, aiv & 0xff); + PUSH_BYTE(utf8, cur, (U8)(aiv & 0xff)); } break; case 'C': @@ -3004,7 +3004,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) ckWARN(WARN_PACK)) Perl_warner(aTHX_ packWARN(WARN_PACK), "Character in 'C' format wrapped in pack"); - *cur++ = aiv & 0xff; + *cur++ = (char)(aiv & 0xff); } break; case 'W': { diff --git a/toke.c b/toke.c index 890e681..ba3fbb1 100644 --- a/toke.c +++ b/toke.c @@ -446,7 +446,7 @@ S_missingterm(pTHX_ char *s) #endif ) { *tmpbuf = '^'; - tmpbuf[1] = toCTRL(PL_multi_close); + tmpbuf[1] = (char)toCTRL(PL_multi_close); tmpbuf[2] = '\0'; s = tmpbuf; }