[macruby-changes] [3548] MacRuby/branches/icu
source_changes at macosforge.org
source_changes at macosforge.org
Mon Feb 15 19:04:06 PST 2010
Revision: 3548
http://trac.macosforge.org/projects/ruby/changeset/3548
Author: lsansonetti at apple.com
Date: 2010-02-15 19:04:03 -0800 (Mon, 15 Feb 2010)
Log Message:
-----------
added flags support
Modified Paths:
--------------
MacRuby/branches/icu/object.c
MacRuby/branches/icu/string.c
Modified: MacRuby/branches/icu/object.c
===================================================================
--- MacRuby/branches/icu/object.c 2010-02-16 02:54:51 UTC (rev 3547)
+++ MacRuby/branches/icu/object.c 2010-02-16 03:04:03 UTC (rev 3548)
@@ -21,6 +21,7 @@
#include <float.h>
#include "objc.h"
#include "vm.h"
+#include "encoding.h"
#include "array.h"
#include "hash.h"
@@ -812,7 +813,7 @@
}
// fall through
case T_STRING:
- if (*(VALUE *)obj == rb_cByteString) {
+ if (rb_klass_is_rstr(*(VALUE *)obj)) {
return RBASIC(obj)->flags & FL_TAINT ? Qtrue : Qfalse;
}
// fall through
@@ -865,7 +866,7 @@
}
// fall through
case T_STRING:
- if (*(VALUE *)obj == rb_cByteString) {
+ if (rb_klass_is_rstr(*(VALUE *)obj)) {
RBASIC(obj)->flags |= FL_TAINT;
break;
}
@@ -919,7 +920,7 @@
}
// fall through
case T_STRING:
- if (*(VALUE *)obj == rb_cByteString) {
+ if (rb_klass_is_rstr(*(VALUE *)obj)) {
RBASIC(obj)->flags &= ~FL_TAINT;
break;
}
@@ -963,7 +964,7 @@
}
// fall through
case T_STRING:
- if (*(VALUE *)obj == rb_cByteString) {
+ if (rb_klass_is_rstr(*(VALUE *)obj)) {
return RBASIC(obj)->flags & FL_UNTRUSTED ? Qtrue : Qfalse;
}
// fall through
@@ -1003,7 +1004,7 @@
}
// fall through
case T_STRING:
- if (*(VALUE *)obj == rb_cByteString) {
+ if (rb_klass_is_rstr(*(VALUE *)obj)) {
RBASIC(obj)->flags &= ~FL_UNTRUSTED;
break;
}
@@ -1049,7 +1050,7 @@
}
// fall through
case T_STRING:
- if (*(VALUE *)obj == rb_cByteString) {
+ if (rb_klass_is_rstr(*(VALUE *)obj)) {
RBASIC(obj)->flags |= FL_UNTRUSTED;
break;
}
@@ -1134,7 +1135,7 @@
}
// fall through
case T_STRING:
- if (*(VALUE *)obj == rb_cByteString) {
+ if (rb_klass_is_rstr(*(VALUE *)obj)) {
RBASIC(obj)->flags |= FL_FREEZE;
break;
}
@@ -1198,7 +1199,7 @@
}
// fall through
case T_STRING:
- if (*(VALUE *)obj == rb_cByteString) {
+ if (rb_klass_is_rstr(*(VALUE *)obj)) {
return RBASIC(obj)->flags & FL_FREEZE ? Qtrue : Qfalse;
}
// fall through
Modified: MacRuby/branches/icu/string.c
===================================================================
--- MacRuby/branches/icu/string.c 2010-02-16 02:54:51 UTC (rev 3547)
+++ MacRuby/branches/icu/string.c 2010-02-16 03:04:03 UTC (rev 3548)
@@ -1388,10 +1388,24 @@
rb_str_new4(VALUE source)
{
VALUE str = rb_str_new3(source);
- // TODO: freeze str
+ OBJ_FREEZE(str);
return str;
}
+VALUE
+rb_tainted_str_new(const char *cstr, long len)
+{
+ VALUE str = rb_str_new(cstr, len);
+ OBJ_TAINT(str);
+ return str;
+}
+
+VALUE
+rb_tainted_str_new2(const char *cstr)
+{
+ return rb_tainted_str_new(cstr, strlen(cstr));
+}
+
const char *
rb_str_cstr(VALUE str)
{
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100215/7f5bbafe/attachment.html>
More information about the macruby-changes
mailing list