diff options
author | Christian Hansen <chansen@cpan.org> | 2012-03-25 17:23:39 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-12-11 07:44:21 -0700 |
commit | c47992b404786dcb8752239045e21cbcd7e3d103 (patch) | |
tree | c3b97b19ade372f931c8d2aab9865dcc08743eac /ext/PerlIO-scalar | |
parent | 0ee4a8bde32174274ad80c192e06b5e15d9d0ca4 (diff) | |
download | perl-c47992b404786dcb8752239045e21cbcd7e3d103.tar.gz |
PerlIO-scalar: Fix fail to detect incomplete seqs at EOF
Diffstat (limited to 'ext/PerlIO-scalar')
-rw-r--r-- | ext/PerlIO-scalar/scalar.pm | 2 | ||||
-rw-r--r-- | ext/PerlIO-scalar/scalar.xs | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/ext/PerlIO-scalar/scalar.pm b/ext/PerlIO-scalar/scalar.pm index 4ed4e4060d..dcba127162 100644 --- a/ext/PerlIO-scalar/scalar.pm +++ b/ext/PerlIO-scalar/scalar.pm @@ -1,5 +1,5 @@ package PerlIO::scalar; -our $VERSION = '0.24'; +our $VERSION = '0.25'; require XSLoader; XSLoader::load(); 1; diff --git a/ext/PerlIO-scalar/scalar.xs b/ext/PerlIO-scalar/scalar.xs index f3dff499bd..dcb8283e72 100644 --- a/ext/PerlIO-scalar/scalar.xs +++ b/ext/PerlIO-scalar/scalar.xs @@ -15,6 +15,19 @@ typedef struct { Off_t posn; } PerlIOScalar; +IV +PerlIOScalar_eof(pTHX_ PerlIO * f) +{ + if (PerlIOBase(f)->flags & PERLIO_F_CANREAD) { + PerlIOScalar *s = PerlIOSelf(f, PerlIOScalar); + char *p; + STRLEN len; + p = SvPV(s->var, len); + return len - (STRLEN)(s->posn) <= 0; + } + return 1; +} + static IV PerlIOScalar_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, PerlIO_funcs * tab) @@ -406,7 +419,7 @@ static PERLIO_FUNCS_DECL(PerlIO_scalar) = { PerlIOScalar_close, PerlIOScalar_flush, PerlIOScalar_fill, - PerlIOBase_eof, + PerlIOScalar_eof, PerlIOBase_error, PerlIOBase_clearerr, PerlIOBase_setlinebuf, |