[macruby-changes] [1636] MacRuby/branches/experimental/ext/json/ext

source_changes at macosforge.org source_changes at macosforge.org
Fri May 29 14:18:33 PDT 2009


Revision: 1636
          http://trac.macosforge.org/projects/ruby/changeset/1636
Author:   lsansonetti at apple.com
Date:     2009-05-29 14:18:33 -0700 (Fri, 29 May 2009)
Log Message:
-----------
fix for #257 (patch by Dan Sinclair)

Modified Paths:
--------------
    MacRuby/branches/experimental/ext/json/ext/generator/generator.c
    MacRuby/branches/experimental/ext/json/ext/parser/parser.c
    MacRuby/branches/experimental/ext/json/ext/parser/parser.rl

Modified: MacRuby/branches/experimental/ext/json/ext/generator/generator.c
===================================================================
--- MacRuby/branches/experimental/ext/json/ext/generator/generator.c	2009-05-29 21:17:51 UTC (rev 1635)
+++ MacRuby/branches/experimental/ext/json/ext/generator/generator.c	2009-05-29 21:18:33 UTC (rev 1636)
@@ -490,7 +490,12 @@
         state->object_nl = tmp;
     }
     tmp = ID2SYM(i_check_circular);
+
+#if WITH_OBJC
+    if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
+#else
     if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
+#endif
         tmp = rb_hash_aref(opts, ID2SYM(i_check_circular));
         state->check_circular = RTEST(tmp);
     } else {
@@ -498,7 +503,11 @@
     }
     tmp = ID2SYM(i_max_nesting);
     state->max_nesting = 19;
+#if WITH_OBJC
+    if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
+#else
     if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
+#endif
         VALUE max_nesting = rb_hash_aref(opts, tmp);
         if (RTEST(max_nesting)) {
             Check_Type(max_nesting, T_FIXNUM);

Modified: MacRuby/branches/experimental/ext/json/ext/parser/parser.c
===================================================================
--- MacRuby/branches/experimental/ext/json/ext/parser/parser.c	2009-05-29 21:17:51 UTC (rev 1635)
+++ MacRuby/branches/experimental/ext/json/ext/parser/parser.c	2009-05-29 21:18:33 UTC (rev 1636)
@@ -1473,7 +1473,11 @@
             rb_raise(rb_eArgError, "opts needs to be like a hash");
         } else {
             VALUE tmp = ID2SYM(i_max_nesting);
+#if WITH_OBJC
+            if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
+#else
             if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
+#endif
                 VALUE max_nesting = rb_hash_aref(opts, tmp);
                 if (RTEST(max_nesting)) {
                     Check_Type(max_nesting, T_FIXNUM);
@@ -1485,14 +1489,22 @@
                 json->max_nesting = 19;
             }
             tmp = ID2SYM(i_allow_nan);
+#if WITH_OBJC
+            if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
+#else
             if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
+#endif
                 VALUE allow_nan = rb_hash_aref(opts, tmp);
                 json->allow_nan = RTEST(allow_nan) ? 1 : 0;
             } else {
                 json->allow_nan = 0;
             }
             tmp = ID2SYM(i_create_additions);
+#if WITH_OBJC
+            if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
+#else
             if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
+#endif
                 VALUE create_additions = rb_hash_aref(opts, tmp);
                 if (RTEST(create_additions)) {
                     json->create_id = rb_funcall(mJSON, i_create_id, 0);

Modified: MacRuby/branches/experimental/ext/json/ext/parser/parser.rl
===================================================================
--- MacRuby/branches/experimental/ext/json/ext/parser/parser.rl	2009-05-29 21:17:51 UTC (rev 1635)
+++ MacRuby/branches/experimental/ext/json/ext/parser/parser.rl	2009-05-29 21:18:33 UTC (rev 1636)
@@ -498,7 +498,11 @@
             rb_raise(rb_eArgError, "opts needs to be like a hash");
         } else {
             VALUE tmp = ID2SYM(i_max_nesting);
+#if WITH_OBJC
+            if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
+#else
             if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
+#endif
                 VALUE max_nesting = rb_hash_aref(opts, tmp);
                 if (RTEST(max_nesting)) {
                     Check_Type(max_nesting, T_FIXNUM);
@@ -510,14 +514,22 @@
                 json->max_nesting = 19;
             }
             tmp = ID2SYM(i_allow_nan);
+#if WITH_OBJC
+            if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
+#else
             if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
+#endif
                 VALUE allow_nan = rb_hash_aref(opts, tmp);
                 json->allow_nan = RTEST(allow_nan) ? 1 : 0;
             } else {
                 json->allow_nan = 0;
             }
             tmp = ID2SYM(i_create_additions);
+#if WITH_OBJC
+            if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
+#else
             if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
+#endif
                 VALUE create_additions = rb_hash_aref(opts, tmp);
                 if (RTEST(create_additions)) {
                     json->create_id = rb_funcall(mJSON, i_create_id, 0);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090529/4b32f045/attachment-0001.html>


More information about the macruby-changes mailing list