[macruby-changes] [2395] MacRuby/trunk/ext/zlib/zlib.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 26 18:51:41 PDT 2009
Revision: 2395
http://trac.macosforge.org/projects/ruby/changeset/2395
Author: lsansonetti at apple.com
Date: 2009-08-26 18:51:40 -0700 (Wed, 26 Aug 2009)
Log Message:
-----------
do not assume that the input is always a ByteString (since the IO could be a StringIO object returning regular strings), fixing a crasher in rubygems
Modified Paths:
--------------
MacRuby/trunk/ext/zlib/zlib.c
Modified: MacRuby/trunk/ext/zlib/zlib.c
===================================================================
--- MacRuby/trunk/ext/zlib/zlib.c 2009-08-27 01:51:00 UTC (rev 2394)
+++ MacRuby/trunk/ext/zlib/zlib.c 2009-08-27 01:51:40 UTC (rev 2395)
@@ -541,8 +541,14 @@
}
}
-#define zstream_append_input2(z,v)\
- zstream_append_input((z), BSTRING_PTR_BYTEF(v), BSTRING_LEN(v))
+#define zstream_append_input2(z,v) \
+ do { \
+ if (*(VALUE *)v != rb_cByteString) { \
+ v = rb_coerce_to_bytestring(v); \
+ } \
+ zstream_append_input((z), BSTRING_PTR_BYTEF(v), BSTRING_LEN(v)); \
+ } \
+ while(0)
static void
zstream_discard_input(struct zstream *z, unsigned int len)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090826/a7b8aab1/attachment.html>
More information about the macruby-changes
mailing list