p4raw-id: //depot/perlio@16064
if (SvLEN(e->dataSV) && SvPVX(e->dataSV)) {
Safefree(SvPVX(e->dataSV));
}
- if (use > e->base.bufsiz) {
+ if (use > (SSize_t)e->base.bufsiz) {
- use = e->base.bufsiz;
+ if (e->flags & NEEDS_LINES) {
+ /* Have to grow buffer */
+ e->base.bufsiz = use;
+ PerlIOEncode_get_base(aTHX_ f);
+ }
+ else {
+ use = e->base.bufsiz;
+ }
}
SvPVX(e->dataSV) = (char *) ptr;
SvLEN(e->dataSV) = 0; /* Hands off sv.c - it isn't yours */