summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-01-20 20:34:36 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-01-20 20:34:36 +0000
commit2bc69dc436cd7865c8739d78d00640e6d7154cd2 (patch)
tree83018c414a663a6ee9e664b2663ab892d28580f0 /pp.c
parent1b83bdba13fdb3b419d0118497fface385a6c39c (diff)
downloadperl-2bc69dc436cd7865c8739d78d00640e6d7154cd2.tar.gz
Integrate mainline
p4raw-id: //depot/perlio@14362
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/pp.c b/pp.c
index ef0c75e9d5..997e633032 100644
--- a/pp.c
+++ b/pp.c
@@ -2791,8 +2791,18 @@ PP(pp_hex)
STRLEN len;
NV result_nv;
UV result_uv;
+ SV* sv = POPs;
- tmps = (SvPVx(POPs, len));
+ tmps = (SvPVx(sv, len));
+ if (DO_UTF8(sv)) {
+ /* If Unicode, try to downgrade
+ * If not possible, croak. */
+ SV* tsv = sv_2mortal(newSVsv(sv));
+
+ SvUTF8_on(tsv);
+ sv_utf8_downgrade(tsv, FALSE);
+ tmps = SvPVX(tsv);
+ }
result_uv = grok_hex (tmps, &len, &flags, &result_nv);
if (flags & PERL_SCAN_GREATER_THAN_UV_MAX) {
XPUSHn(result_nv);
@@ -2811,8 +2821,18 @@ PP(pp_oct)
STRLEN len;
NV result_nv;
UV result_uv;
+ SV* sv = POPs;
- tmps = (SvPVx(POPs, len));
+ tmps = (SvPVx(sv, len));
+ if (DO_UTF8(sv)) {
+ /* If Unicode, try to downgrade
+ * If not possible, croak. */
+ SV* tsv = sv_2mortal(newSVsv(sv));
+
+ SvUTF8_on(tsv);
+ sv_utf8_downgrade(tsv, FALSE);
+ tmps = SvPVX(tsv);
+ }
while (*tmps && len && isSPACE(*tmps))
tmps++, len--;
if (*tmps == '0')
@@ -3178,15 +3198,15 @@ PP(pp_crypt)
STRLEN n_a;
STRLEN len;
char *tmps = SvPV(left, len);
+
if (DO_UTF8(left)) {
- /* If Unicode, try to dowgrade.
+ /* If Unicode, try to downgrade.
* If not possible, croak.
* Yes, we made this up. */
SV* tsv = sv_2mortal(newSVsv(left));
-
+
SvUTF8_on(tsv);
- if (!sv_utf8_downgrade(tsv, FALSE))
- Perl_croak(aTHX_ "Wide character in crypt");
+ sv_utf8_downgrade(tsv, FALSE);
tmps = SvPVX(tsv);
}
# ifdef FCRYPT