* io.c (rb_io_binmode): should not alter encoding. [ruby-dev:32918]
* io.c (io_read_encoding): need not to return ASCII-8BIT for binary IO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b3f93b1f43
commit
81064a7688
@ -1,3 +1,10 @@
|
||||
Thu Jan 10 02:41:22 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_binmode): should not alter encoding. [ruby-dev:32918]
|
||||
|
||||
* io.c (io_read_encoding): need not to return ASCII-8BIT for
|
||||
binary IO.
|
||||
|
||||
Wed Jan 9 22:04:17 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||
|
||||
* lib/mathn.rb (Prime#each): returns an enumerator if no block
|
||||
|
11
io.c
11
io.c
@ -374,9 +374,7 @@ io_read_encoding(rb_io_t *fptr)
|
||||
if (fptr->enc) {
|
||||
return fptr->enc;
|
||||
}
|
||||
return (fptr->mode & FMODE_BINMODE)
|
||||
? rb_ascii8bit_encoding()
|
||||
: rb_default_external_encoding();
|
||||
return rb_default_external_encoding();
|
||||
}
|
||||
|
||||
static rb_encoding*
|
||||
@ -2949,16 +2947,14 @@ rb_io_binmode(VALUE io)
|
||||
rb_io_t *fptr;
|
||||
|
||||
GetOpenFile(io, fptr);
|
||||
#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
|
||||
if (!(fptr->mode & FMODE_BINMODE) && READ_DATA_BUFFERED(fptr)) {
|
||||
rb_raise(rb_eIOError, "buffer already filled with text-mode content");
|
||||
}
|
||||
#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
|
||||
if (0 <= fptr->fd && setmode(fptr->fd, O_BINARY) == -1)
|
||||
rb_sys_fail(fptr->path);
|
||||
|
||||
#endif
|
||||
fptr->mode |= FMODE_BINMODE;
|
||||
fptr->enc = rb_ascii8bit_encoding();
|
||||
return io;
|
||||
}
|
||||
|
||||
@ -3198,9 +3194,6 @@ rb_io_mode_enc(rb_io_t *fptr, const char *mode)
|
||||
{
|
||||
const char *p = strchr(mode, ':');
|
||||
if (p) {
|
||||
if (fptr->mode & FMODE_BINMODE) {
|
||||
rb_raise(rb_eArgError, "encoding in binary mode");
|
||||
}
|
||||
mode_enc(fptr, p+1);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ EOT
|
||||
with_tmpdir {
|
||||
generate_file('tmp', "")
|
||||
open("tmp", "rb") {|f|
|
||||
assert_equal(Encoding::ASCII_8BIT, f.external_encoding)
|
||||
assert_equal(Encoding.default_external, f.external_encoding)
|
||||
assert_equal(nil, f.internal_encoding)
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#define RUBY_VERSION "1.9.0"
|
||||
#define RUBY_RELEASE_DATE "2008-01-09"
|
||||
#define RUBY_RELEASE_DATE "2008-01-10"
|
||||
#define RUBY_VERSION_CODE 190
|
||||
#define RUBY_RELEASE_CODE 20080109
|
||||
#define RUBY_RELEASE_CODE 20080110
|
||||
#define RUBY_PATCHLEVEL 0
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
@ -9,7 +9,7 @@
|
||||
#define RUBY_VERSION_TEENY 0
|
||||
#define RUBY_RELEASE_YEAR 2008
|
||||
#define RUBY_RELEASE_MONTH 1
|
||||
#define RUBY_RELEASE_DAY 9
|
||||
#define RUBY_RELEASE_DAY 10
|
||||
|
||||
#ifdef RUBY_EXTERN
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
|
Loading…
x
Reference in New Issue
Block a user