summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-19 07:51:39 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-19 07:51:39 +0000
commit560a288e13336a11c08649232e4f81decff70a5d (patch)
treebe4aa56ad6e5af2d78e1a0b9e76c4c6423c47874 /toke.c
parent8d2a6795a8433e9623ccf677a19bf470170549e9 (diff)
downloadperl-560a288e13336a11c08649232e4f81decff70a5d.tar.gz
make comparisons promote to utf8 as necessary (from Gisle Aas)
p4raw-id: //depot/perl@5138
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toke.c b/toke.c
index b6ffc2bdce..d978140f4a 100644
--- a/toke.c
+++ b/toke.c
@@ -6904,7 +6904,7 @@ Perl_scan_num(pTHX_ char *start)
pos++;
if (*pos == '.' && isDIGIT(pos[1])) {
UV rev;
- U8 tmpbuf[10];
+ U8 tmpbuf[UTF8_MAXLEN];
U8 *tmpend;
NV nshift = 1.0;
bool utf8 = FALSE;
@@ -6930,7 +6930,6 @@ Perl_scan_num(pTHX_ char *start)
tmpbuf[0] = (U8)rev;
tmpend = &tmpbuf[1];
}
- *tmpend = '\0';
sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
if (rev > 0)
SvNVX(sv) += (NV)rev/nshift;
@@ -6943,7 +6942,6 @@ Perl_scan_num(pTHX_ char *start)
s = pos;
tmpend = uv_to_utf8(tmpbuf, rev);
utf8 = utf8 || rev > 127;
- *tmpend = '\0';
sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
if (rev > 0)
SvNVX(sv) += (NV)rev/nshift;
@@ -6951,8 +6949,10 @@ Perl_scan_num(pTHX_ char *start)
SvPOK_on(sv);
SvNOK_on(sv);
SvREADONLY_on(sv);
- if (utf8)
+ if (utf8) {
SvUTF8_on(sv);
+ sv_utf8_downgrade(sv, TRUE);
+ }
}
}
break;