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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Apr 12 17:32:39 CDT 2011


branch "master" has been updated
       via  dc89de88ece88403d83ae1b423d6de0b58aae948 (commit)
       via  c3d843d61f33cf7b654b3f237ccbb03ec4903928 (commit)
      from  a685262dc0e4f0bb407b0cd0207ff34e1da549b4 (commit)

Summary of changes:
 cpp/include/Slice/CPlusPlusUtil.h |    4 ++--
 cpp/src/Slice/CPlusPlusUtil.cpp   |   26 +++++++++++++-------------
 cpp/src/slice2cpp/Gen.cpp         |   20 +++++++++++---------
 3 files changed, 26 insertions(+), 24 deletions(-)


- Log -----------------------------------------------------------------
commit dc89de88ece88403d83ae1b423d6de0b58aae948
Merge: a685262 c3d843d
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Tue Apr 12 17:26:32 2011 -0500

    Merge branch 'slice2cpp-fix-shadow-violations'

diff --cc cpp/include/Slice/CPlusPlusUtil.h
index 0f3625d,40aa74e..63e4e20
--- a/cpp/include/Slice/CPlusPlusUtil.h
+++ b/cpp/include/Slice/CPlusPlusUtil.h
@@@ -44,12 -44,12 +44,12 @@@ SLICE_API std::string fixKwd(const std:
  
  SLICE_API void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool,
                                           const std::string& = "", bool = true, const StringList& = StringList(),
 -                                         int = 0);
 +                                         int = 0, bool = false);
                                               
  SLICE_API void writeMarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const TypePtr&, 
-                                 const StringList&, int = 0);
+                                 const StringList&, int = 0, const std::string& = "");
  SLICE_API void writeUnmarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const TypePtr&,
-                                   const StringList&, int = 0);
+                                   const StringList&, int = 0, const std::string& = "");
  
  SLICE_API void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const TypePtr&,
                                   const StringList&, int = 0);

commit c3d843d61f33cf7b654b3f237ccbb03ec4903928
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Tue Apr 12 17:15:00 2011 -0500

    Modify output of slice2cpp to avoid generating code with variables that
    shadow other in-scope variables/functions/etc.

diff --git a/cpp/include/Slice/CPlusPlusUtil.h b/cpp/include/Slice/CPlusPlusUtil.h
index c164049..40aa74e 100644
--- a/cpp/include/Slice/CPlusPlusUtil.h
+++ b/cpp/include/Slice/CPlusPlusUtil.h
@@ -47,9 +47,9 @@ SLICE_API void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypeP
                                          int = 0);
                                              
 SLICE_API void writeMarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const TypePtr&, 
-                                const StringList&, int = 0);
+                                const StringList&, int = 0, const std::string& = "");
 SLICE_API void writeUnmarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const TypePtr&,
-                                  const StringList&, int = 0);
+                                  const StringList&, int = 0, const std::string& = "");
 
 SLICE_API void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const TypePtr&,
                                  const StringList&, int = 0);
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 6baf742..ddaacdc 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -714,7 +714,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
                             << fixedParam << "; ++__i_" << fixedParam << ")";
                         out << sb;
                         writeMarshalUnmarshalCode(out, seq->type(), fixedParam + ".first[__i_" + fixedParam + "]",
-                                                  true);
+                                                  true, str);
                         out << eb;
                     }
                 }
@@ -749,7 +749,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
                     << fixedParam << ".first; ___" << fixedParam << " != " << fixedParam << ".second; ++___"
                     << fixedParam << ")";
                 out << sb;
-                writeMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", true, "", true, l, false);
+                writeMarshalUnmarshalCode(out, seq->type(), "(*___" + fixedParam + ")", true, str, true, l, false);
                 out << eb;
             }
             else if(!seqType.empty())
@@ -759,7 +759,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
                 out << nl << "for(__p_" << fixedParam << " = " << fixedParam << ".begin(); __p_" << fixedParam 
                     << " != " << fixedParam << ".end(); ++__p_" << fixedParam << ")";
                 out << sb;
-                writeMarshalUnmarshalCode(out, seq->type(), "(*__p_" + fixedParam + ")", true);
+                writeMarshalUnmarshalCode(out, seq->type(), "(*__p_" + fixedParam + ")", true, str);
                 out << eb;
             }
             else
@@ -830,7 +830,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
                         StringList l;
                         l.push_back("cpp:type:" + seqType);
                         out << nl << seqType << " ___" << fixedParam << ";";
-                        writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, "", true, l, false);
+                        writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, str, true, l, false);
                     }
                 }
                 else if(builtin->kind() == Builtin::KindByte)
@@ -894,11 +894,11 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
                 }
                 if(typeCtx & TypeContextAMIPrivateEnd)
                 {
-                    writeMarshalUnmarshalCode(out, seq, fixedParam, false, "", true, md, false);
+                    writeMarshalUnmarshalCode(out, seq, fixedParam, false, str, true, md, false);
                 }
                 else
                 {
-                    writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, "", true, md, false);
+                    writeMarshalUnmarshalCode(out, seq, "___" + fixedParam, false, str, true, md, false);
                     out << nl << fixedParam << ".first = ___" << fixedParam << ".begin();";
                     out << nl << fixedParam << ".second = ___" << fixedParam << ".end();";
                 }
@@ -916,7 +916,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
                 out << nl << "for(__p_" << fixedParam << " = " << fixedParam << ".begin(); __p_" << fixedParam 
                    << " != " << fixedParam << ".end(); ++__p_" << fixedParam << ")";
                 out << sb;
-                writeMarshalUnmarshalCode(out, seq->type(), "(*__p_" + fixedParam + ")", false);
+                writeMarshalUnmarshalCode(out, seq->type(), "(*__p_" + fixedParam + ")", false, str);
                 out << eb;
             }
             else
@@ -994,31 +994,31 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
 
 void
 Slice::writeMarshalCode(Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData,
-                        int typeCtx)
+                        int typeCtx, const string& str)
 {
     for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p)
     {
-        writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), true, "", true, (*p)->getMetaData(),
+        writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), true, str, true, (*p)->getMetaData(),
                                   typeCtx);
     }
     if(ret)
     {
-        writeMarshalUnmarshalCode(out, ret, "__ret", true, "", true, metaData, false);
+        writeMarshalUnmarshalCode(out, ret, "__ret", true, str, true, metaData, false);
     }
 }
 
 void
 Slice::writeUnmarshalCode(Output& out, const ParamDeclList& params, const TypePtr& ret, const StringList& metaData,
-                          int typeCtx)
+                          int typeCtx, const string& str)
 {
     for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p)
     {
-        writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), false, "", true, (*p)->getMetaData(),
+        writeMarshalUnmarshalCode(out, (*p)->type(), fixKwd((*p)->name()), false, str, true, (*p)->getMetaData(),
                                   typeCtx);
     }
     if(ret)
     {
-        writeMarshalUnmarshalCode(out, ret, "__ret", false, "", true, metaData, typeCtx);
+        writeMarshalUnmarshalCode(out, ret, "__ret", false, str, true, metaData, typeCtx);
     }
 }
 
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 9442aea..04d0a41 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -3394,6 +3394,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
 
     vector<string> params;
     vector<string> paramsDecl;
+    vector<string> innerParamsDecl;
     vector<string> args;
     vector<string> argMembers;
 
@@ -3423,6 +3424,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
 
         params.push_back(typeString);
         paramsDecl.push_back(typeString + ' ' + paramName);
+        innerParamsDecl.push_back(typeString + ' ' + "inner_" + paramName);
         args.push_back(paramName);
         argMembers.push_back("_m_" + paramName);
     }
@@ -3470,7 +3472,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
             string resultRef = outputTypeToString(ret, p->getMetaData(), _useWstring);
             C << resultRef + " __result";
         }
-        C << paramsDecl << "const ::Ice::Current& __current" << epar << " : ";
+        C << innerParamsDecl << "const ::Ice::Current& __current" << epar << " : ";
         C.inc();
         C << nl << "::IceInternal::Direct(__current)";
 
@@ -3483,7 +3485,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
         {
             if(args[i] != "__current")
             {
-                C << "," << nl << argMembers[i] + "(" + args[i] + ")";
+                C << "," << nl << argMembers[i] + "(" + "inner_" + args[i] + ")";
             }
         }
         C.dec();
@@ -3496,8 +3498,8 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
         C << nl << nl << "virtual ::Ice::DispatchStatus";
         C << nl << "run(::Ice::Object* object)";
         C << sb;
-        C << nl << thisPointer << " servant = dynamic_cast< " << thisPointer << ">(object);";
-        C << nl << "if(!servant)";
+        C << nl << thisPointer << " serv = dynamic_cast< " << thisPointer << ">(object);";
+        C << nl << "if(!serv)";
         C << sb;
         C << nl << "throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);";
         C << eb;
@@ -3514,7 +3516,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
         {
             C << "_result = ";
         }
-        C << "servant->" << name << spar << argMembers << epar << ';';
+        C << "serv->" << name << spar << argMembers << epar << ';';
         C << nl << "return ::Ice::DispatchOK;";
 
         if(!throws.empty())
@@ -6560,15 +6562,15 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
     {
         C << nl << "try";
         C << sb;
-        C << nl << "::IceInternal::BasicStream* __os = this->__os();";
-        writeMarshalCode(C, outParams, 0, StringList(), true);
+        C << nl << "::IceInternal::BasicStream* __outstream = this->__os();";
+        writeMarshalCode(C, outParams, 0, StringList(), true, "__outstream");
         if(ret)
         {
-            writeMarshalUnmarshalCode(C, ret, "__ret", true, "", true, p->getMetaData(), true);
+            writeMarshalUnmarshalCode(C, ret, "__ret", true, "__outstream", true, p->getMetaData(), true);
         }
         if(p->returnsClasses())
         {
-            C << nl << "__os->writePendingObjects();";
+            C << nl << "__outstream->writePendingObjects();";
         }
         C << eb;
         C << nl << "catch(const ::Ice::Exception& __ex)";

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


-- 
asterisk-scf/release/ice.git



More information about the asterisk-scf-commits mailing list