summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2000-11-23 23:04:05 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2000-11-23 23:04:05 +0000
commit63dbdb066b93ac25a070d3a7942d248c23ec6088 (patch)
tree61be3e4baada73645eafd1010e5e9dd863276630 /perlio.c
parent60382766f71ec2a2d8e34a951c5c77b494bd86bb (diff)
downloadperl-63dbdb066b93ac25a070d3a7942d248c23ec6088.tar.gz
Win32 passes all but t/lib/peek.t with perlio and home-grown crlf.
peek fail is showing a real problem (multiple crlf layers are getting pushed.) p4raw-id: //depot/perlio@7843
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/perlio.c b/perlio.c
index 697fc869d2..69aba4b72c 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2156,12 +2156,36 @@ PerlIOCrlf_set_ptrcnt(PerlIO *f, STDCHAR *ptr, SSize_t cnt)
PerlIO_get_base(f);
if (!ptr)
{
- ptr = ((c->nl) ? (c->nl+1) : b->end) - cnt;
+ if (c->nl)
+ ptr = c->nl+1;
+ else
+ {
+ ptr = b->end;
+ if (ptr > b->buf && ptr[-1] == 0xd)
+ ptr--;
+ }
+ ptr -= cnt;
}
else
{
- if (ptr != (((c->nl) ? (c->nl+1) : b->end) - cnt))
- abort();
+ /* Test code - delete when it works ... */
+ STDCHAR *chk;
+ if (c->nl)
+ chk = c->nl+1;
+ else
+ {
+ chk = b->end;
+ if (chk > b->buf && chk[-1] == 0xd)
+ chk--;
+ }
+ chk -= cnt;
+
+ if (ptr != chk)
+ {
+ dTHX;
+ Perl_croak(aTHX_ "ptr wrong %p != %p nl=%p e=%p for %d",
+ ptr, chk, c->nl, b->end, cnt);
+ }
}
if (c->nl)
{