}
}
else {
- if (this_map == (short) TR_UNMAPPED)
+ if (this_map == (short) TR_UNMAPPED) {
*d++ = *s;
+ previous_map = (short) TR_OOB;
+ }
else {
assert(this_map == (short) TR_DELETE);
matches++;
}
- previous_map = (short) TR_OOB;
}
s++;
else if (sch == (short) TR_UNMAPPED) {
Move(s, d, len, U8);
d += len;
+ pch = TR_OOB;
}
else if (sch == (short) TR_DELETE)
matches++;
}
s += len;
- pch = TR_OOB;
}
if (grows) {
* assume cannot */
if (! out_is_utf8 && (PL_op->op_private & OPpTRANS_CAN_FORCE_UTF8)) {
inplace = FALSE;
- if (max_expansion < 2) {
- max_expansion = 2;
- }
}
s = (U8*)SvPV_nomg(sv, len);
else {
/* Here, we can't edit in place. We have no idea how much, if any,
* this particular input string will grow. However, the compilation
- * calculated the maximum expansion possible. Use that to allocale
- * based on the worst case scenario. */
+ * calculated the maximum expansion possible. Use that to allocate
+ * based on the worst case scenario. (First +1 is to round up; 2nd is
+ * for \0) */
Newx(d, (STRLEN) (len * max_expansion + 1 + 1), U8);
d0 = d;
}
if (to == (UV) TR_SPECIAL_HANDLING) {
if (delete_unfound) {
- previous_map = to;
s += s_len;
continue;
}
SvTAINTED_on(sv);
}
-/* currently converts input to bytes if possible, but doesn't sweat failure */
UV
Perl_do_vecget(pTHX_ SV *sv, STRLEN offset, int size)
{
s = (unsigned char *) SvPV_flags(sv, srclen, svpv_flags);
}
else {
- Perl_croak(aTHX_ "Use of strings with code points over 0xFF as arguments to vec is forbidden");
+ Perl_croak(aTHX_ "Use of strings with code points over 0xFF"
+ " as arguments to vec is forbidden");
}
}
}
}
else if (size < 8)
- retnum = (s[uoffset] >> bitoffs) & ((1 << size) - 1);
+ retnum = (s[uoffset] >> bitoffs) & nBIT_MASK(size);
else {
if (size == 8)
retnum = s[uoffset];
}
if (size < 8) {
- mask = (1 << size) - 1;
+ mask = nBIT_MASK(size);
lval &= mask;
s[offset] &= ~(mask << bitoffs);
s[offset] |= lval << bitoffs;
lsave = lc;
rsave = rc;
- SvCUR_set(sv, len);
(void)SvPOK_only(sv);
if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) {
dc = SvPV_force_nomg_nolen(sv);
sv_usepvn_flags(sv, dc, needlen, SV_HAS_TRAILING_NUL);
dc = SvPVX(sv); /* sv_usepvn() calls Renew() */
}
+ SvCUR_set(sv, len);
if (len >= sizeof(long)*4 &&
!(PTR2nat(dc) % sizeof(long)) &&