summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/utf8.c b/utf8.c
index 8ea2d7a76d..743dea4b5c 100644
--- a/utf8.c
+++ b/utf8.c
@@ -560,10 +560,12 @@ malformed:
if (s == s0)
Perl_sv_catpvf(aTHX_ sv, "(unexpected non-continuation byte 0x%02"UVxf", immediately after start byte 0x%02"UVxf")",
(UV)s[1], startbyte);
- else
+ else {
+ const int len = (int)(s-s0);
Perl_sv_catpvf(aTHX_ sv, "(unexpected non-continuation byte 0x%02"UVxf", %d byte%s after start byte 0x%02"UVxf", expected %d bytes)",
- (UV)s[1], s - s0, s - s0 > 1 ? "s" : "", startbyte, (int)expectlen);
-
+ (UV)s[1], len, len > 1 ? "s" : "", startbyte, (int)expectlen);
+ }
+
break;
case UTF8_WARN_FE_FF:
Perl_sv_catpvf(aTHX_ sv, "(byte 0x%02"UVxf")", uv);