summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorSpider Boardman <spider@orb.nashua.nh.us>2000-09-07 22:21:02 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2000-09-08 14:19:49 +0000
commit33b454808819084359e76a3f223a41b842c180b7 (patch)
tree7637e666df742859e20f1b79353fca4d01eb68d5 /doop.c
parentc5d572932fd269096c2a3545999d11f5ab9563b7 (diff)
downloadperl-33b454808819084359e76a3f223a41b842c180b7.tar.gz
Re-allow vec() for characters > 255.
Subject: [PATCH] Re: [ID 20000907.005] Not OK: perl v5.7.0 +devel-7030 on alpha-dec_osf-perlio 4.0f (UNINSTALLED) Message-Id: <200009080621.CAA03409@leggy.zk3.dec.com> p4raw-id: //depot/perl@7039
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/doop.c b/doop.c
index 46ffc1b284..77c7324e31 100644
--- a/doop.c
+++ b/doop.c
@@ -537,8 +537,7 @@ Perl_do_sprintf(pTHX_ SV *sv, I32 len, SV **sarg)
SvTAINTED_on(sv);
}
-/* currently converts input to bytes if needed and croaks if a character
- > 255 is encountered */
+/* currently converts input to bytes if possible, but doesn't sweat failure */
UV
Perl_do_vecget(pTHX_ SV *sv, I32 offset, I32 size)
{
@@ -552,12 +551,7 @@ Perl_do_vecget(pTHX_ SV *sv, I32 offset, I32 size)
Perl_croak(aTHX_ "Illegal number of bits in vec");
if (SvUTF8(sv)) {
- if (Perl_utf8_to_bytes(aTHX_ (U8*) s, &srclen)) {
- SvUTF8_off(sv);
- SvCUR_set(sv, srclen);
- }
- else
- Perl_croak(aTHX_ "Character > 255 in vec()");
+ (void) Perl_sv_utf8_downgrade(aTHX_ sv, TRUE);
}
offset *= size; /* turn into bit offset */
@@ -681,8 +675,10 @@ Perl_do_vecget(pTHX_ SV *sv, I32 offset, I32 size)
return retnum;
}
-/* currently converts input to bytes if needed and croaks if a character
- > 255 is encountered */
+/* currently converts input to bytes if possible but doesn't sweat failures,
+ * although it does ensure that the string it clobbers is not marked as
+ * utf8-valid any more
+ */
void
Perl_do_vecset(pTHX_ SV *sv)
{
@@ -699,12 +695,11 @@ Perl_do_vecset(pTHX_ SV *sv)
return;
s = (unsigned char*)SvPV_force(targ, targlen);
if (SvUTF8(targ)) {
- if (Perl_utf8_to_bytes(aTHX_ (U8*) s, &targlen)) {
- /* SvUTF8_off(targ); SvPOK_only below ensures this */
- SvCUR_set(targ, targlen);
- }
- else
- Perl_croak(aTHX_ "Character > 255 in vec()");
+ /* This is handled by the SvPOK_only below...
+ if (!Perl_sv_utf8_downgrade(aTHX_ targ, TRUE))
+ SvUTF8_off(targ);
+ */
+ (void) Perl_sv_utf8_downgrade(aTHX_ targ, TRUE);
}
(void)SvPOK_only(targ);