* ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended
part. [ruby-dev:25618] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9b6581dc47
commit
729249159e
@ -1,3 +1,8 @@
|
|||||||
|
Wed Feb 2 23:52:53 2005 sheepman <sheepman@tcn.zaq.ne.jp>
|
||||||
|
|
||||||
|
* ext/stringio/stringio.c (strio_truncate): should MEMZERO an extended
|
||||||
|
part. [ruby-dev:25618]
|
||||||
|
|
||||||
Wed Feb 2 21:56:01 2005 Kouhei Sutou <kou@cozmixng.org>
|
Wed Feb 2 21:56:01 2005 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rss/rss.rb (RSS::Element#convert): added.
|
* lib/rss/rss.rb (RSS::Element#convert): added.
|
||||||
|
@ -934,10 +934,14 @@ strio_truncate(self, len)
|
|||||||
{
|
{
|
||||||
VALUE string = writable(StringIO(self))->string;
|
VALUE string = writable(StringIO(self))->string;
|
||||||
long l = NUM2LONG(len);
|
long l = NUM2LONG(len);
|
||||||
|
long plen = RSTRING(string)->len;
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
error_inval("negative legnth");
|
error_inval("negative legnth");
|
||||||
}
|
}
|
||||||
rb_str_resize(string, l);
|
rb_str_resize(string, l);
|
||||||
|
if (plen < l) {
|
||||||
|
MEMZERO(RSTRING(string)->ptr + plen, char, l - plen);
|
||||||
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user