зеркало из https://github.com/github/ruby.git
* io.c (rb_io_each_byte): caused infinite loop. [ruby-dev:31652]
* io.c (rb_io_getc): should return nil at EOF, not EOFError. * lib/delegate.rb (SimpleDelegator::__setobj__): use raise argument to specify backtrace. * test/ruby/test_fnmatch.rb (TestFnmatch::bracket_test): String#include? no longer works for Fixnum. use #chr. [ruby-dev:31652] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
98d6d636e3
Коммит
1a0b7d0fb6
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Mon Aug 27 00:41:13 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_each_byte): caused infinite loop. [ruby-dev:31652]
|
||||
|
||||
* io.c (rb_io_getc): should return nil at EOF, not EOFError.
|
||||
|
||||
* lib/delegate.rb (SimpleDelegator::__setobj__): use raise
|
||||
argument to specify backtrace.
|
||||
|
||||
* test/ruby/test_fnmatch.rb (TestFnmatch::bracket_test):
|
||||
String#include? no longer works for Fixnum. use #chr.
|
||||
[ruby-dev:31652]
|
||||
|
||||
Sun Aug 26 12:27:14 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* cont.c: fix to remove Fiber.new until fiber.so is not loaded.
|
||||
|
|
8
io.c
8
io.c
|
@ -2022,12 +2022,14 @@ rb_io_each_byte(VALUE io)
|
|||
rb_yield(INT2FIX(*p & 0xff));
|
||||
p++;
|
||||
}
|
||||
fptr->rbuf_off += fptr->rbuf_len;
|
||||
fptr->rbuf_len = 0;
|
||||
rb_io_check_readable(fptr);
|
||||
READ_CHECK(fptr);
|
||||
if (io_fillbuf(fptr) < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return io;
|
||||
}
|
||||
|
||||
|
@ -2090,7 +2092,7 @@ rb_io_getc(VALUE io)
|
|||
|
||||
READ_CHECK(fptr);
|
||||
if (io_fillbuf(fptr) < 0) {
|
||||
rb_eof_error();
|
||||
return Qnil;
|
||||
}
|
||||
n = rb_enc_mbclen(fptr->rbuf+fptr->rbuf_off, enc);
|
||||
if (n < fptr->rbuf_len) {
|
||||
|
@ -2103,7 +2105,7 @@ rb_io_getc(VALUE io)
|
|||
left = fptr->rbuf_len;
|
||||
MEMCPY(RSTRING_PTR(str), fptr->rbuf+fptr->rbuf_off, char, left);
|
||||
if (io_fillbuf(fptr) < 0) {
|
||||
rb_eof_error();
|
||||
return Qnil;
|
||||
}
|
||||
MEMCPY(RSTRING_PTR(str)+left, fptr->rbuf, char, n-left);
|
||||
fptr->rbuf_off += left;
|
||||
|
|
|
@ -283,8 +283,7 @@ def DelegateClass(superclass)
|
|||
begin
|
||||
@delegate_dc_obj.__send(:#{method}, *args, &block)
|
||||
rescue
|
||||
$@[0,2] = nil
|
||||
raise
|
||||
raise $!, $@[2..-1]
|
||||
end
|
||||
end
|
||||
EOS
|
||||
|
|
|
@ -4,9 +4,9 @@ class TestFnmatch < Test::Unit::TestCase
|
|||
|
||||
def bracket_test(s, t) # `s' should start with neither '!' nor '^'
|
||||
0x21.upto(0x7E) do |i|
|
||||
assert_equal(t.include?(i), File.fnmatch("[#{s}]", i.chr, File::FNM_DOTMATCH))
|
||||
assert_equal(t.include?(i), !File.fnmatch("[^#{s}]", i.chr, File::FNM_DOTMATCH))
|
||||
assert_equal(t.include?(i), !File.fnmatch("[!#{s}]", i.chr, File::FNM_DOTMATCH))
|
||||
assert_equal(t.include?(i.chr), File.fnmatch("[#{s}]", i.chr, File::FNM_DOTMATCH))
|
||||
assert_equal(t.include?(i.chr), !File.fnmatch("[^#{s}]", i.chr, File::FNM_DOTMATCH))
|
||||
assert_equal(t.include?(i.chr), !File.fnmatch("[!#{s}]", i.chr, File::FNM_DOTMATCH))
|
||||
end
|
||||
end
|
||||
def test_fnmatch
|
||||
|
|
Загрузка…
Ссылка в новой задаче