diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-03-25 20:49:11 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-03-25 20:49:11 +0000 |
commit | 8040349a05f5a3f1e93bde55d8359e415c47bf01 (patch) | |
tree | 3c0e03a9c3f33711c4cd87499665c9015fc48fec | |
parent | a144b9898613715625621889c13893a8238e4af6 (diff) | |
download | perl-8040349a05f5a3f1e93bde55d8359e415c47bf01.tar.gz |
Avoid at leasy one of undefined warnings in Encode.
p4raw-id: //depot/perlio@9345
-rw-r--r-- | ext/Encode/Encode.pm | 6 | ||||
-rw-r--r-- | ext/Encode/Encode.xs | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index fd85520311..650180647b 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -273,7 +273,7 @@ use base 'Encode::Encoding'; # Encoding is 16-bit network order Unicode (no surogates) # Used for X font encodings -__PACKAGE__->Define(qw(UCS-2 iso10646-1)); +__PACKAGE__->Define(qw(UCS-2 iso-10646-1)); sub decode { @@ -285,7 +285,7 @@ sub decode $uni .= chr($code); } $_[1] = $str if $chk; - Encode::utf8_upgrade($uni); + utf8::upgrade($uni); return $uni; } @@ -586,7 +586,7 @@ UTF-16 is similar to UCS-2, 16 bit or 2-byte chunks. UCS-2 can only represent 0..0xFFFF, while UTF-16 has a "surogate pair" scheme which allows it to cover the whole Unicode range. -Encode implements big-endian UCS-2 aliased to "iso10646-1" as that +Encode implements big-endian UCS-2 aliased to "iso-10646-1" as that happens to be the name used by that representation when used with X11 fonts. UTF-32 or UCS-4 is 32-bit or 4-byte chunks. Perl's logical characters diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index 74303c9389..13ba7045c4 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -219,9 +219,11 @@ PerlIOEncode_flush(PerlIO *f) { PerlIOEncode *e = PerlIOSelf(f,PerlIOEncode); IV code = 0; - dTHX; - if (e->bufsv && (PerlIOBase(f)->flags & (PERLIO_F_RDBUF|PERLIO_F_WRBUF))) + if (e->bufsv && (PerlIOBase(f)->flags & (PERLIO_F_RDBUF|PERLIO_F_WRBUF)) + &&(e->base.ptr > e->base.buf) + ) { + dTHX; dSP; SV *str; char *s; @@ -452,6 +454,11 @@ encode_method(pTHX_ encode_t *enc, encpage_t *dir, SV *src, int check) SvCUR_set(src,SvCUR(src)-slen); } } + else + { + SvCUR_set(dst,slen); + SvPOK_on(dst); + } return dst; } |