* io.c (read_all): fix if.

* io.c (rb_io_getline_1): move needless set encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-02-27 20:56:03 +00:00
parent ee695fb164
commit 343a1504e3

4
io.c
View File

@ -1384,7 +1384,7 @@ read_all(rb_io_t *fptr, long siz, VALUE str)
} }
if (bytes != siz) rb_str_resize(str, bytes); if (bytes != siz) rb_str_resize(str, bytes);
str = io_enc_str(str, fptr); str = io_enc_str(str, fptr);
if (fptr->enc2) { if (!fptr->enc2) {
ENC_CODERANGE_SET(str, cr); ENC_CODERANGE_SET(str, cr);
} }
return str; return str;
@ -1960,10 +1960,10 @@ rb_io_getline_1(VALUE rs, long limit, VALUE io)
swallow(fptr, '\n'); swallow(fptr, '\n');
} }
} }
str = io_enc_str(str, fptr);
} }
if (!NIL_P(str)) { if (!NIL_P(str)) {
str = io_enc_str(str, fptr);
if (!nolimit) { if (!nolimit) {
fptr->lineno++; fptr->lineno++;
lineno = INT2FIX(fptr->lineno); lineno = INT2FIX(fptr->lineno);