#!./perl -w
-print "1..3980\n";
+print "1..4016\n";
my $test = 0;
my %templates = (
for my $nl (1, 0) {
for my $value (123, 1234, 12345) {
test($enc, $value, $value, $bom, $nl, $value);
+ # This has the unfortunate side effect of causing an infinite
+ # loop without the bug fix it corresponds to:
+ test($enc, "($value)", $value, $bom, $nl, "($value)");
}
next if $enc eq 'utf8';
# Arguably a bug that currently string literals from UTF-8 file
SV *const utf8_buffer = filter;
IV status = IoPAGE(filter);
const bool reverse = IoLINES(filter);
+ I32 retval;
/* As we're automatically added, at the lowest level, and hence only called
from this file, we can be sure that we're not called in block mode. Hence
nl = SvEND(utf8_buffer);
}
if (nl) {
- sv_catpvn(sv, SvPVX(utf8_buffer), nl - SvPVX(utf8_buffer));
+ STRLEN got = nl - SvPVX(utf8_buffer);
+ /* Did we have anything to append? */
+ retval = got != 0;
+ sv_catpvn(sv, SvPVX(utf8_buffer), got);
/* Everything else in this code works just fine if SVp_POK isn't
set. This, however, needs it, and we need it to work, else
we loop infinitely because the buffer is never consumed. */
status,
(UV)SvCUR(utf16_buffer), (UV)SvCUR(utf8_buffer)));
DEBUG_P({ sv_dump(utf8_buffer); sv_dump(sv);});
- return SvCUR(sv);
+ return retval;
}
static U8 *