1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (read_all): should associate default external encoding.

* io.c (io_read): should NOT associate default external encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-12-12 23:46:58 +00:00
parent b92cee1ddb
commit 0ca7036682
3 changed files with 22 additions and 17 deletions

View file

@ -1,3 +1,9 @@
Thu Dec 13 08:24:16 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (read_all): should associate default external encoding.
* io.c (io_read): should NOT associate default external encoding.
Wed Dec 12 23:22:58 2007 Tanaka Akira <akr@fsij.org>
* re.c, regerror.c, string.c, parse.y, ruby.c, file.c:

27
io.c
View file

@ -1266,6 +1266,16 @@ remain_size(rb_io_t *fptr)
return (long)siz;
}
static VALUE
io_enc_str(VALUE str, rb_io_t *fptr)
{
OBJ_TAINT(str);
if (fptr->enc) {
rb_enc_associate(str, fptr->enc);
}
return str;
}
static VALUE
read_all(rb_io_t *fptr, long siz, VALUE str)
{
@ -1291,9 +1301,7 @@ read_all(rb_io_t *fptr, long siz, VALUE str)
rb_str_resize(str, siz);
}
if (bytes != siz) rb_str_resize(str, bytes);
OBJ_TAINT(str);
return str;
return io_enc_str(str, fptr);
}
void rb_io_set_nonblock(rb_io_t *fptr)
@ -1521,16 +1529,6 @@ rb_io_write_nonblock(VALUE io, VALUE str)
return LONG2FIX(n);
}
static VALUE
io_enc_str(VALUE str, rb_io_t *fptr)
{
OBJ_TAINT(str);
if (fptr->enc) {
rb_enc_associate(str, fptr->enc);
}
return str;
}
/*
* call-seq:
* ios.read([length [, buffer]]) => string, buffer, or nil
@ -1597,7 +1595,8 @@ io_read(int argc, VALUE *argv, VALUE io)
return Qnil;
}
rb_str_resize(str, n);
return io_enc_str(str, fptr);
return str;
}
static int

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-12-12"
#define RUBY_RELEASE_DATE "2007-12-13"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20071212
#define RUBY_RELEASE_CODE 20071213
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 12
#define RUBY_RELEASE_DAY 12
#define RUBY_RELEASE_DAY 13
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];