Skip to content

Commit

Permalink
* io.c (read_all): should associate default external encoding.
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
matz committed Dec 12, 2007
1 parent b92cee1 commit 0ca7036
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -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:
Expand Down
27 changes: 13 additions & 14 deletions io.c
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions version.h
@@ -1,15 +1,15 @@
#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
#define RUBY_VERSION_MINOR 9
#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[];
Expand Down

0 comments on commit 0ca7036

Please sign in to comment.