SvIVX(sv) = (IV)atol(SvPVX(sv));
}
else {
- if (dowarn && !localizing)
+ if (dowarn && !localizing && !(SvFLAGS(sv) & SVs_PADTMP))
warn(warn_uninit);
return 0;
}
SvNVX(sv) = atof(SvPVX(sv));
}
else {
- if (dowarn && !localizing)
+ if (dowarn && !localizing && !(SvFLAGS(sv) & SVs_PADTMP))
warn(warn_uninit);
return 0.0;
}
while (*s) s++;
}
else {
- if (dowarn && !localizing)
+ if (dowarn && !localizing && !(SvFLAGS(sv) & SVs_PADTMP))
warn(warn_uninit);
*lp = 0;
return "";
}
GvCV(dstr) = (CV*)sref;
break;
+ case SVt_PVIO:
+ if (intro)
+ SAVESPTR(GvIOp(dstr));
+ else
+ dref = (SV*)GvIOp(dstr);
+ GvIOp(dstr) = (IO*)sref;
+ break;
default:
if (intro)
SAVESPTR(GvSV(dstr));
{
MAGIC* mg;
MAGIC** mgp;
- if (SvTYPE(sv) < SVt_PVMG)
+ if (SvTYPE(sv) < SVt_PVMG || !SvMAGIC(sv))
return 0;
mgp = &SvMAGIC(sv);
for (mg = *mgp; mg; mg = *mgp) {
else
mgp = &mg->mg_moremagic;
}
- if (!SvMAGICAL(sv) && !SvMAGIC(sv)) {
+ if (!SvMAGIC(sv)) {
SvMAGICAL_off(sv);
SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
}
mg_free(sv);
switch (SvTYPE(sv)) {
case SVt_PVIO:
+ io_close((IO*)sv);
Safefree(IoTOP_NAME(sv));
Safefree(IoFMT_NAME(sv));
Safefree(IoBOTTOM_NAME(sv));
}
else {
cnt = fread((char*)buf, 1, sizeof(buf), fp);
- i = (cnt == EOF) ? EOF : (U8)buf[cnt - 1];
+ i = cnt ? (U8)buf[cnt - 1] : EOF;
}
if (append)