summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-21 16:13:32 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-21 16:13:32 +0000
commitd9d60e8c1258bda8f730a91c78458622034909a5 (patch)
tree52ff4fcd7d032590e609f46d774ec2a05cf21792 /ext/zlib/zlib.c
parent9cd654ea2645598d088eb6e54c6957084bb2966d (diff)
* 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
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r--ext/zlib/zlib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index f5fe2e3fa4..aed2a26134 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -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);