Revision
2822
Author
lsansonetti@apple.com
Date
2009-10-15 18:23:45 -0700 (Thu, 15 Oct 2009)

Log Message

for a given CF type signature, also register an equivalent without the '=' character to conform to BridgeSupport APIs returning this type by reference

Modified Paths

Diff

Modified: MacRuby/trunk/bridgesupport.cpp (2821 => 2822)


--- MacRuby/trunk/bridgesupport.cpp	2009-10-16 01:22:43 UTC (rev 2821)
+++ MacRuby/trunk/bridgesupport.cpp	2009-10-16 01:23:45 UTC (rev 2822)
@@ -1035,7 +1035,16 @@
 	    std::map<std::string, bs_element_cftype_t *>::iterator
 		iter = bs_cftypes.find(bs_cftype->type);
 	    if (iter == bs_cftypes.end()) {
-		bs_cftypes[bs_cftype->type] = bs_cftype;
+		std::string s(bs_cftype->type);
+		bs_cftypes[s] = bs_cftype;
+		if (s.compare(s.size() - 2, 2, "=}") == 0) {
+		    // For ^{__CFError=}, also registering ^{__CFError}.
+		    // This is because functions or methods returning CF types
+		    // by reference strangely omit the '=' character as part
+		    // of their BridgeSupport signature.
+		    s.replace(s.size() - 2, 2, "}");
+		    bs_cftypes[s] = bs_cftype;
+		}
 		do_not_free = true;
 	    }
 	    else {