In perl.git, the branch smoke-me/leont/utf8-readline has been updated <http://perl5.git.perl.org/perl.git/commitdiff/6fe0d0725d25e0502d7b1875700e1ffa147e4779?hp=ea07014e9c7ac1de8b452bfa4e2de6d0bc90147c>
discards ea07014e9c7ac1de8b452bfa4e2de6d0bc90147c (commit) - Log ----------------------------------------------------------------- commit 6fe0d0725d25e0502d7b1875700e1ffa147e4779 Author: Leon Timmermans <faw...@gmail.com> Date: Mon Apr 9 21:49:11 2012 +0200 Made :utf8 an actual layer It will check the input for validity, by default strict validity though less strict forms are provided. This also means PerlIO::get_layers doesn't return a "utf8" pseudo-layer anymore, which can break some code making that assumption. ----------------------------------------------------------------------- Summary of changes: ext/PerlIO-scalar/scalar.pm | 2 +- ext/PerlIO-scalar/scalar.xs | 1 + ext/PerlIO-via/via.xs | 1 + perlio.c | 15 +++++---------- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ext/PerlIO-scalar/scalar.pm b/ext/PerlIO-scalar/scalar.pm index dcba127162..ce328ede23 100644 --- a/ext/PerlIO-scalar/scalar.pm +++ b/ext/PerlIO-scalar/scalar.pm @@ -1,5 +1,5 @@ package PerlIO::scalar; -our $VERSION = '0.25'; +our $VERSION = '0.26'; require XSLoader; XSLoader::load(); 1; diff --git a/ext/PerlIO-scalar/scalar.xs b/ext/PerlIO-scalar/scalar.xs index dcb8283e72..f463dde92e 100644 --- a/ext/PerlIO-scalar/scalar.xs +++ b/ext/PerlIO-scalar/scalar.xs @@ -428,6 +428,7 @@ static PERLIO_FUNCS_DECL(PerlIO_scalar) = { PerlIOScalar_get_ptr, PerlIOScalar_get_cnt, PerlIOScalar_set_ptrcnt, + PerlIOBuf_readdelim, }; diff --git a/ext/PerlIO-via/via.xs b/ext/PerlIO-via/via.xs index 8a7f1fc9ed..29ccf729f7 100644 --- a/ext/PerlIO-via/via.xs +++ b/ext/PerlIO-via/via.xs @@ -631,6 +631,7 @@ static PERLIO_FUNCS_DECL(PerlIO_object) = { PerlIOVia_get_ptr, PerlIOVia_get_cnt, PerlIOVia_set_ptrcnt, + PerlIOBase_readdelim, // PerlIOVia_readdelim }; diff --git a/perlio.c b/perlio.c index 1a3da1cac6..5bb9403051 100644 --- a/perlio.c +++ b/perlio.c @@ -5249,10 +5249,9 @@ static IV PerlIOUnicode_fill(pTHX_ PerlIO* f) { SSize_t PerlIOUnicode_readdelim(pTHX_ PerlIO *f, STDCHAR *vbuf, Size_t count, STDCHAR delim) { -/* - if (PerlIO_fast_gets(PerlIONext(f))) + if (0 && PerlIO_fast_gets(PerlIONext(f))) return PerlIOBuf_readdelim(aTHX_ f, vbuf, count, delim); - else {*/ + else { PerlIOUnicode * const u = PerlIOSelf(f, PerlIOUnicode); PerlIOBuf * const b = &u->buf; PerlIO *n = PerlIONext(f); @@ -5263,10 +5262,6 @@ PerlIOUnicode_readdelim(pTHX_ PerlIO *f, STDCHAR *vbuf, Size_t count, STDCHAR de int seen = FALSE; if (avail == 0) { - SSize_t avail; - STDCHAR *end; - SSize_t fit; - if (PerlIO_flush(f) != 0) return -1; if (PerlIOBase(f)->flags & PERLIO_F_TTY) @@ -5292,10 +5287,10 @@ PerlIOUnicode_readdelim(pTHX_ PerlIO *f, STDCHAR *vbuf, Size_t count, STDCHAR de STDCHAR* ptr = PerlIO_get_ptr(f); STDCHAR* found = (STDCHAR*) memchr(ptr, delim, wanted); if (found) { - Size_t len = found - ptr + 1; + Size_t len = found + 1 - ptr; Copy(ptr, vbuf, len, char); read += len; - PerlIO_set_ptrcnt(f, found + 1, len); + PerlIO_set_ptrcnt(f, found + 1, avail - len); seen = TRUE; } else { @@ -5318,7 +5313,7 @@ PerlIOUnicode_readdelim(pTHX_ PerlIO *f, STDCHAR *vbuf, Size_t count, STDCHAR de } PerlIOBase(f)->flags |= PERLIO_F_RDBUF; return read; - /*}*/ + } } PERLIO_FUNCS_DECL(PerlIO_utf8) = { -- Perl5 Master Repository