[macruby-changes] [3692] MacRuby/branches/icu/string.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 3 22:04:00 PST 2010
Revision: 3692
http://trac.macosforge.org/projects/ruby/changeset/3692
Author: lsansonetti at apple.com
Date: 2010-03-03 22:03:57 -0800 (Wed, 03 Mar 2010)
Log Message:
-----------
fixed misc bugs in #dump and #inspect
Modified Paths:
--------------
MacRuby/branches/icu/string.c
Modified: MacRuby/branches/icu/string.c
===================================================================
--- MacRuby/branches/icu/string.c 2010-03-04 05:32:03 UTC (rev 3691)
+++ MacRuby/branches/icu/string.c 2010-03-04 06:03:57 UTC (rev 3692)
@@ -2395,15 +2395,17 @@
const long len = uchars
? str_length(str, true) : str->length_in_bytes;
+ VALUE result;
if (len == 0) {
- return rb_str_new2("\"\"");
+ result = rb_str_new2("\"\"");
+ goto bail;
}
// Allocate an UTF-8 string with a good initial capacity.
// Binary strings will likely have most bytes escaped.
const long result_init_len =
BINARY_ENC(str->encoding) ? (len * 5) + 2 : len + 2;
- VALUE result = rb_unicode_str_new(NULL, result_init_len);
+ result = rb_unicode_str_new(NULL, result_init_len);
#define GET_UCHAR(pos) \
((uchars \
@@ -2464,6 +2466,10 @@
#undef GET_UCHAR
+bail:
+ if (OBJ_TAINTED(str)) {
+ OBJ_TAINT(result);
+ }
return result;
}
@@ -2484,7 +2490,9 @@
static VALUE
rstr_dump(VALUE self, SEL sel)
{
- return str_inspect(RSTR(self), true);
+ VALUE res = str_inspect(RSTR(self), true);
+ *(VALUE *)res = *(VALUE *)self;
+ return res;
}
/*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100303/5ab11f0a/attachment-0001.html>
More information about the macruby-changes
mailing list