[macruby-changes] [4554] MacRuby/trunk/ext/zlib/zlib.c
source_changes at macosforge.org
source_changes at macosforge.org
Tue Sep 28 16:38:59 PDT 2010
Revision: 4554
http://trac.macosforge.org/projects/ruby/changeset/4554
Author: watson1978 at gmail.com
Date: 2010-09-28 16:38:57 -0700 (Tue, 28 Sep 2010)
Log Message:
-----------
Fixed what was not able to handle String including '\0' in Zlib::GzipWriter#comment= and Zlib::GzipWriter#orig_name=.
Modified Paths:
--------------
MacRuby/trunk/ext/zlib/zlib.c
Modified: MacRuby/trunk/ext/zlib/zlib.c
===================================================================
--- MacRuby/trunk/ext/zlib/zlib.c 2010-09-28 22:32:38 UTC (rev 4553)
+++ MacRuby/trunk/ext/zlib/zlib.c 2010-09-28 23:38:57 UTC (rev 4554)
@@ -2379,7 +2379,8 @@
s = rb_str_dup(rb_str_to_str(str));
p = memchr(RSTRING_PTR(s), '\0', RSTRING_LEN(s));
if (p) {
- rb_str_resize(s, p - RSTRING_PTR(s));
+ long beg = p - RSTRING_PTR(s);
+ rb_str_delete(s, beg, RSTRING_LEN(s) - beg);
}
gz->orig_name = s;
return str;
@@ -2401,7 +2402,8 @@
s = rb_str_dup(rb_str_to_str(str));
p = memchr(RSTRING_PTR(s), '\0', RSTRING_LEN(s));
if (p) {
- rb_str_resize(s, p - (char*)BSTRING_PTR(s));
+ long beg = p - RSTRING_PTR(s);
+ rb_str_delete(s, beg, RSTRING_LEN(s) - beg);
}
gz->comment = s;
return str;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100928/68555056/attachment-0001.html>
More information about the macruby-changes
mailing list