[asterisk-scf-commits] asterisk-scf/release/ice.git branch "visitor-generators" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jan 3 17:27:33 UTC 2011


branch "visitor-generators" has been updated
       via  9e2d376b16a493f6e92f05157705ccd89dde4527 (commit)
      from  8b166aa5de356c343b4a9d8c5666441c620a91df (commit)

Summary of changes:
 cpp/src/slice2cpp/Gen.cpp |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)


- Log -----------------------------------------------------------------
commit 9e2d376b16a493f6e92f05157705ccd89dde4527
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Mon Jan 3 11:26:25 2011 -0600

    When generating a 'visit' function body that must use dynamicCast,
    check the result to ensure the cast was successful before attempting
    to invoke the visitor's operation.
    
    https://code.asterisk.org/code/cru/CR-ASTSCF-36#c442

diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 770fe87..1bf47a3 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -582,7 +582,13 @@ Slice::Gen::CPPVisitorPatternVisitor::generateVisitFunctionBody(const string& pa
         // IceUtil::Handle-derived shared pointer. Since that is the case, we can use
         // the dynamicCast() operation defined by IceUtil::Handle to convert the pointer
         // into a derived visitor class pointer.
-        ostr << derivedVisitor->scoped() << "Ptr::dynamicCast(" << paramName << ")";
+        ostr << derivedVisitor->scoped() << "Ptr v = " << derivedVisitor->scoped() << "Ptr::dynamicCast(" << paramName << ");";
+        body.push_back(ostr.str());
+        ostr.str("");
+        ostr << "if (!v) return;";
+        body.push_back(ostr.str());
+        ostr.str("");
+        ostr << "v";
     }
     else
     {

-----------------------------------------------------------------------


-- 
asterisk-scf/release/ice.git



More information about the asterisk-scf-commits mailing list