fix upstream bug 34297
This commit is contained in:
parent
943555ef58
commit
748f9091f4
26
perl-5.8.8-U34297_C28006.patch
Normal file
26
perl-5.8.8-U34297_C28006.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
--- perl-5.8.8/pp.c.U34297_C28006 2006-07-13 12:40:37.000000000 -0400
|
||||||
|
+++ perl-5.8.8/pp.c 2006-07-13 13:03:19.000000000 -0400
|
||||||
|
@@ -2949,7 +2949,22 @@
|
||||||
|
dSP; dTARGET;
|
||||||
|
SV *sv = TOPs;
|
||||||
|
|
||||||
|
- if (DO_UTF8(sv))
|
||||||
|
+ if (SvAMAGIC(sv)) {
|
||||||
|
+ /* For an overloaded scalar, we can't know in advance if it's going to
|
||||||
|
+ be UTF-8 or not. Also, we can't call sv_len_utf8 as it likes to
|
||||||
|
+ cache the length. Maybe that should be a documented feature of it.
|
||||||
|
+ */
|
||||||
|
+ STRLEN len;
|
||||||
|
+ const char *const p = SvPV_const(sv, len);
|
||||||
|
+
|
||||||
|
+ if (DO_UTF8(sv)) {
|
||||||
|
+ SETi(utf8_length((U8*)p, (U8*)p + len));
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ SETi(len);
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ else if (DO_UTF8(sv))
|
||||||
|
SETi(sv_len_utf8(sv));
|
||||||
|
else
|
||||||
|
SETi(sv_len(sv));
|
Loading…
Reference in New Issue
Block a user