mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (rb_io_getc): use default external encoding if fptr->enc is
not set. [ruby-dev:32565] * lib/rubygems/package.rb (Gem::TarReader::Entry::rewind): typo fixed. [ruby-dev:32565] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0ca7036682
commit
b754d62f72
4 changed files with 14 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Thu Dec 13 08:56:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (rb_io_getc): use default external encoding if fptr->enc is
|
||||||
|
not set. [ruby-dev:32565]
|
||||||
|
|
||||||
|
* lib/rubygems/package.rb (Gem::TarReader::Entry::rewind): typo fixed.
|
||||||
|
[ruby-dev:32565]
|
||||||
|
|
||||||
Thu Dec 13 08:24:16 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Thu Dec 13 08:24:16 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (read_all): should associate default external encoding.
|
* io.c (read_all): should associate default external encoding.
|
||||||
|
|
6
io.c
6
io.c
|
@ -2132,15 +2132,17 @@ rb_io_getc(VALUE io)
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
int r, n;
|
int r, n;
|
||||||
VALUE str;
|
VALUE str;
|
||||||
|
rb_encoding *enc;
|
||||||
|
|
||||||
GetOpenFile(io, fptr);
|
GetOpenFile(io, fptr);
|
||||||
rb_io_check_readable(fptr);
|
rb_io_check_readable(fptr);
|
||||||
|
|
||||||
|
enc = fptr->enc ? fptr->enc : rb_default_external_encoding();
|
||||||
READ_CHECK(fptr);
|
READ_CHECK(fptr);
|
||||||
if (io_fillbuf(fptr) < 0) {
|
if (io_fillbuf(fptr) < 0) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
r = rb_enc_precise_mbclen(fptr->rbuf+fptr->rbuf_off, fptr->rbuf+fptr->rbuf_off+fptr->rbuf_len, fptr->enc);
|
r = rb_enc_precise_mbclen(fptr->rbuf+fptr->rbuf_off, fptr->rbuf+fptr->rbuf_off+fptr->rbuf_len, enc);
|
||||||
if ((n = MBCLEN_CHARFOUND(r)) != 0 && n <= fptr->rbuf_len) {
|
if ((n = MBCLEN_CHARFOUND(r)) != 0 && n <= fptr->rbuf_len) {
|
||||||
str = rb_str_new(fptr->rbuf+fptr->rbuf_off, n);
|
str = rb_str_new(fptr->rbuf+fptr->rbuf_off, n);
|
||||||
fptr->rbuf_off += n;
|
fptr->rbuf_off += n;
|
||||||
|
@ -2154,7 +2156,7 @@ getc_needmore:
|
||||||
rb_str_cat(str, fptr->rbuf+fptr->rbuf_off, 1);
|
rb_str_cat(str, fptr->rbuf+fptr->rbuf_off, 1);
|
||||||
fptr->rbuf_off++;
|
fptr->rbuf_off++;
|
||||||
fptr->rbuf_len--;
|
fptr->rbuf_len--;
|
||||||
r = rb_enc_precise_mbclen(RSTRING_PTR(str), RSTRING_PTR(str)+RSTRING_LEN(str), fptr->enc);
|
r = rb_enc_precise_mbclen(RSTRING_PTR(str), RSTRING_PTR(str)+RSTRING_LEN(str), enc);
|
||||||
if (MBCLEN_NEEDMORE(r)) {
|
if (MBCLEN_NEEDMORE(r)) {
|
||||||
goto getc_needmore;
|
goto getc_needmore;
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ module Gem::Package
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :is_directory, :is_directory?
|
alias_method :is_directory, :is_directory?
|
||||||
alias_method :is_file, :is_file
|
alias_method :is_file, :is_file?
|
||||||
|
|
||||||
def bytes_read
|
def bytes_read
|
||||||
@read
|
@read
|
||||||
|
|
|
@ -10,7 +10,7 @@ module XSD
|
||||||
|
|
||||||
|
|
||||||
module Charset
|
module Charset
|
||||||
@internal_encoding = $KCODE
|
@internal_encoding = "ASCII"
|
||||||
|
|
||||||
class XSDError < StandardError; end
|
class XSDError < StandardError; end
|
||||||
class CharsetError < XSDError; end
|
class CharsetError < XSDError; end
|
||||||
|
|
Loading…
Reference in a new issue