[macruby-changes] [2512] MacRuby/trunk/ext/zlib/zlib.c
source_changes at macosforge.org
source_changes at macosforge.org
Tue Sep 8 11:42:41 PDT 2009
Revision: 2512
http://trac.macosforge.org/projects/ruby/changeset/2512
Author: lsansonetti at apple.com
Date: 2009-09-08 11:42:37 -0700 (Tue, 08 Sep 2009)
Log Message:
-----------
fixed a bug in gzfile_read_raw_rescue()
Modified Paths:
--------------
MacRuby/trunk/ext/zlib/zlib.c
Modified: MacRuby/trunk/ext/zlib/zlib.c
===================================================================
--- MacRuby/trunk/ext/zlib/zlib.c 2009-09-07 07:56:22 UTC (rev 2511)
+++ MacRuby/trunk/ext/zlib/zlib.c 2009-09-08 18:42:37 UTC (rev 2512)
@@ -1,9 +1,10 @@
-/*
- * zlib.c - An interface for zlib.
+/*
+ * MacRuby Zlib API.
*
- * Copyright (C) UENO Katsuhiro 2000-2003
- *
- * $Id: zlib.c 16304 2008-05-06 15:56:21Z matz $
+ * This file is covered by the Ruby license. See COPYING for more details.
+ *
+ * Copyright (C) 2007-2008, Apple Inc. All rights reserved.
+ * Copyright (C) UENO Katsuhiro 2000-2003
*/
#include "ruby/ruby.h"
@@ -445,17 +446,17 @@
zstream_append_buffer(struct zstream *z, const Bytef *src, int len)
{
if (NIL_P(z->buf)) {
- GC_WB(&z->buf, rb_bytestring_new_with_data((UInt8*)src, len));
- z->buf_filled = len;
- z->stream.next_out = BSTRING_PTR_BYTEF(z->buf);
- z->stream.avail_out = 0;
- return;
+ GC_WB(&z->buf, rb_bytestring_new_with_data((UInt8*)src, len));
+ z->buf_filled = len;
+ z->stream.next_out = BSTRING_PTR_BYTEF(z->buf);
+ z->stream.avail_out = 0;
+ return;
}
CFMutableDataRef data = rb_bytestring_wrapped_data(z->buf);
if (CFDataGetLength(data) < (z->buf_filled + len)) {
- CFDataSetLength(data, z->buf_filled + len);
- z->stream.avail_out = 0;
+ CFDataSetLength(data, z->buf_filled + len);
+ z->stream.avail_out = 0;
} else if (z->stream.avail_out >= len) {
z->stream.avail_out -= len;
} else {
@@ -535,9 +536,9 @@
if (len <= 0) return;
if (NIL_P(z->input)) {
- GC_WB(&z->input, rb_bytestring_new_with_data((UInt8*)src, len));
+ GC_WB(&z->input, rb_bytestring_new_with_data((UInt8*)src, len));
} else {
- rb_bytestring_append_bytes(z->input, (const UInt8*)src, len);
+ rb_bytestring_append_bytes(z->input, (const UInt8*)src, len);
}
}
@@ -1702,12 +1703,14 @@
return str;
}
+VALUE rb_vm_current_exception(void);
+
static VALUE
gzfile_read_raw_rescue(VALUE arg)
{
struct gzfile *gz = (struct gzfile*)arg;
VALUE str = Qnil;
- if (rb_obj_is_kind_of(rb_errinfo(), rb_eNoMethodError)) {
+ if (rb_obj_is_kind_of(rb_vm_current_exception(), rb_eNoMethodError)) {
str = rb_funcall(gz->io, id_read, 1, INT2FIX(GZFILE_READ_SIZE));
if (!NIL_P(str)) {
Check_Type(str, T_STRING);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090908/b8dba744/attachment.html>
More information about the macruby-changes
mailing list