зеркало из https://github.com/github/ruby.git
* ext/zlib/zlib.c (zstream_shift_buffer): should restore class
field of a buffer. [ruby-dev:24562] * eval.c (rb_alias): should warn on method discarding. [ruby-dev:24546] * ext/zlib/zlib.c (zstream_expand_buffer_into): hide internal string buffer by clearing klass. [ruby-dev:24548] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9cd654ea26
Коммит
d9d60e8c12
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,8 @@
|
|||
Fri Oct 22 00:22:31 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* ext/zlib/zlib.c (zstream_shift_buffer): should restore class
|
||||
field of a buffer. [ruby-dev:24562]
|
||||
|
||||
Fri Oct 22 00:20:33 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_include): should not treat char as negative value.
|
||||
|
@ -14,6 +19,12 @@ Thu Oct 21 13:11:31 2004 WATANABE Hirofumi <eban@ruby-lang.org>
|
|||
|
||||
Thu Oct 21 00:36:41 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_alias): should warn on method discarding.
|
||||
[ruby-dev:24546]
|
||||
|
||||
* ext/zlib/zlib.c (zstream_expand_buffer_into): hide internal
|
||||
string buffer by clearing klass. [ruby-dev:24548]
|
||||
|
||||
* parse.y (lex_getline): should not touch ruby_debug_lines if
|
||||
RIPPER is defined. [ruby-dev:24547]
|
||||
|
||||
|
|
3
eval.c
3
eval.c
|
@ -2016,6 +2016,9 @@ rb_alias(klass, name, def)
|
|||
if (FL_TEST(klass, FL_SINGLETON)) {
|
||||
singleton = rb_iv_get(klass, "__attached__");
|
||||
}
|
||||
if (RTEST(ruby_verbose) && klass == origin && orig->nd_cnt == 0 && orig->nd_body) {
|
||||
rb_warning("discarding old %s", rb_id2name(name));
|
||||
}
|
||||
body = orig->nd_body;
|
||||
orig->nd_cnt++;
|
||||
if (nd_type(body) == NODE_FBODY) { /* was alias */
|
||||
|
|
|
@ -471,6 +471,7 @@ zstream_expand_buffer_into(z, size)
|
|||
z->buf_filled = 0;
|
||||
z->stream.next_out = RSTRING(z->buf)->ptr;
|
||||
z->stream.avail_out = size;
|
||||
RBASIC(z->buf)->klass = 0;
|
||||
}
|
||||
else if (z->stream.avail_out != size) {
|
||||
rb_str_resize(z->buf, z->buf_filled + size);
|
||||
|
@ -491,6 +492,7 @@ zstream_append_buffer(z, src, len)
|
|||
z->buf_filled = len;
|
||||
z->stream.next_out = RSTRING(z->buf)->ptr;
|
||||
z->stream.avail_out = 0;
|
||||
RBASIC(z->buf)->klass = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -526,13 +528,13 @@ zstream_detach_buffer(z)
|
|||
else {
|
||||
dst = z->buf;
|
||||
rb_str_resize(dst, z->buf_filled);
|
||||
RBASIC(dst)->klass = rb_cString;
|
||||
}
|
||||
|
||||
z->buf = Qnil;
|
||||
z->buf_filled = 0;
|
||||
z->stream.next_out = 0;
|
||||
z->stream.avail_out = 0;
|
||||
RBASIC(dst)->klass = rb_cString;
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
@ -548,6 +550,7 @@ zstream_shift_buffer(z, len)
|
|||
}
|
||||
|
||||
dst = rb_str_substr(z->buf, 0, len);
|
||||
RBASIC(dst)->klass = rb_cString;
|
||||
z->buf_filled -= len;
|
||||
memmove(RSTRING(z->buf)->ptr, RSTRING(z->buf)->ptr + len,
|
||||
z->buf_filled);
|
||||
|
|
2
io.c
2
io.c
|
@ -1132,11 +1132,13 @@ io_readpartial(argc, argv, io)
|
|||
|
||||
READ_CHECK(fptr->f);
|
||||
if (RSTRING(str)->len != len) {
|
||||
modified:
|
||||
rb_raise(rb_eRuntimeError, "buffer string modified");
|
||||
}
|
||||
n = read_buffered_data(RSTRING(str)->ptr, len, fptr->f);
|
||||
if (n <= 0) {
|
||||
again:
|
||||
if (RSTRING(str)->len != len) goto modified;
|
||||
TRAP_BEG;
|
||||
n = read(fileno(fptr->f), RSTRING(str)->ptr, len);
|
||||
TRAP_END;
|
||||
|
|
Загрузка…
Ссылка в новой задаче