diff options
author | Spider Boardman <spider@orb.nashua.nh.us> | 2000-09-07 22:21:02 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-09-08 14:19:49 +0000 |
commit | 33b454808819084359e76a3f223a41b842c180b7 (patch) | |
tree | 7637e666df742859e20f1b79353fca4d01eb68d5 /doop.c | |
parent | c5d572932fd269096c2a3545999d11f5ab9563b7 (diff) | |
download | perl-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.c | 27 |
1 files changed, 11 insertions, 16 deletions
@@ -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); |