Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Integrate:
[ 23076]
Perl_mode_from_discipline must update len. (else SEGV)
Diagnosis and patch from clkao

[ 23083]
Perl_is_utf8_string(pTHX_ U8 *s, STRLEN len)
Can now handle the case
     is_utf8_string(NULL,0)
again.
Why do we have code dup for Perl_is_utf8_string_loc() ?

[ 23084]
NI-S: IMHO utf8_upgrade is just changing representation not the value
so it has no business calling SvSETMAGIC.

[ 23085]
Bodge to make Tk work - like the UTF8 flag, the READONLY flag has too
many meanings. const const vs mutable in this case.
p4raw-link: @23085 on //depot/perl: d52b788
p4raw-link: @23084 on //depot/perl: 7a5fa8a
p4raw-link: @23083 on //depot/perl: 61468b0
p4raw-link: @23076 on //depot/perl: 18a33fb

p4raw-id: //depot/maint-5.8/perl@23087
p4raw-edited: from //depot/perl@23086 'edit in' sv.c (@23084..)
p4raw-integrated: from //depot/perl@23086 'copy in' utf8.c (@22764..)
	'merge in' doio.c (@22741..)
  • Loading branch information
nwc10 committed Jul 12, 2004
1 parent 65f5503 commit d6e8a19
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions doio.c
Expand Up @@ -1172,6 +1172,7 @@ Perl_mode_from_discipline(pTHX_ SV *discp)
#ifndef PERLIO_LAYERS
Perl_croak(aTHX_ "IO layers (like '%.*s') unavailable", end-s, s);
#else
len -= end-s;
s = end;
#endif
}
Expand Down
10 changes: 7 additions & 3 deletions sv.c
Expand Up @@ -3451,11 +3451,16 @@ Perl_sv_utf8_upgrade_flags(pTHX_ register SV *sv, I32 flags)
return 0;
if (!SvPOK(sv)) {
STRLEN len = 0;
(void) SvPV_force(sv,len);
if (SvREADONLY(sv) && (SvPOKp(sv) || SvIOKp(sv) || SvNOKp(sv))) {
(void) sv_2pv_flags(sv,&len, flags);
if (SvUTF8(sv))
return len;
} else {
(void) SvPV_force(sv,len);
}
}

if (SvUTF8(sv)) {
SvSETMAGIC(sv);
return SvCUR(sv);
}

Expand Down Expand Up @@ -3492,7 +3497,6 @@ Perl_sv_utf8_upgrade_flags(pTHX_ register SV *sv, I32 flags)
/* Mark as UTF-8 even if no hibit - saves scanning loop */
SvUTF8_on(sv);
}
SvSETMAGIC(sv);
return SvCUR(sv);
}

Expand Down
4 changes: 2 additions & 2 deletions utf8.c
Expand Up @@ -232,7 +232,7 @@ Perl_is_utf8_string(pTHX_ U8 *s, STRLEN len)
U8* send;
STRLEN c;

if (!len)
if (!len && s)
len = strlen((char *)s);
send = s + len;

Expand Down Expand Up @@ -272,7 +272,7 @@ Perl_is_utf8_string_loc(pTHX_ U8 *s, STRLEN len, U8 **p)
U8* send;
STRLEN c;

if (!len)
if (!len && s)
len = strlen((char *)s);
send = s + len;

Expand Down

0 comments on commit d6e8a19

Please sign in to comment.