neilg       2003/12/01 12:41:26

  Modified:    c/src/xercesc/internal XSObjectFactory.cpp
               c/src/xercesc/framework/psvi XSElementDeclaration.hpp
  Log:
  fix for infinite loop between XSComplexTypeDefinitions and XSElementDeclarations; 
from David Cargill
  
  Revision  Changes    Path
  1.8       +12 -3     xml-xerces/c/src/xercesc/internal/XSObjectFactory.cpp
  
  Index: XSObjectFactory.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XSObjectFactory.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XSObjectFactory.cpp       27 Nov 2003 16:42:00 -0000      1.7
  +++ XSObjectFactory.cpp       1 Dec 2003 20:41:25 -0000       1.8
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.8  2003/12/01 20:41:25  neilg
  + * fix for infinite loop between XSComplexTypeDefinitions and 
XSElementDeclarations; from David Cargill
  + *
    * Revision 1.7  2003/11/27 16:42:00  neilg
    * fixes for segfaults and infinite loops in schema component model implementation; 
thanks to David Cargill
    *
  @@ -434,9 +437,9 @@
           if (elemDecl->getSubstitutionGroupElem())
               xsSubElem = addOrFind(elemDecl->getSubstitutionGroupElem(), xsModel);
   
  -        if (elemDecl->getComplexTypeInfo())
  -            xsType = addOrFind(elemDecl->getComplexTypeInfo(), xsModel);
  -        else if (elemDecl->getDatatypeValidator())
  +        // defer checking for complextypeinfo until later as it could
  +        // eventually need this elemement
  +        if (elemDecl->getDatatypeValidator())
               xsType = addOrFind(elemDecl->getDatatypeValidator(), xsModel);
   
           unsigned int count = elemDecl->getIdentityConstraintCount();
  @@ -491,6 +494,12 @@
               , fMemoryManager
           );
           putObjectInMap(elemDecl, xsObj, xsModel);
  +
  +        if (!xsType && elemDecl->getComplexTypeInfo())
  +        {
  +            xsType = addOrFind(elemDecl->getComplexTypeInfo(), xsModel);
  +            xsObj->setTypeDefinition(xsType);
  +        }
       }
   
       return xsObj;
  
  
  
  1.7       +9 -0      xml-xerces/c/src/xercesc/framework/psvi/XSElementDeclaration.hpp
  
  Index: XSElementDeclaration.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSElementDeclaration.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSElementDeclaration.hpp  23 Nov 2003 16:20:16 -0000      1.6
  +++ XSElementDeclaration.hpp  1 Dec 2003 20:41:25 -0000       1.7
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.7  2003/12/01 20:41:25  neilg
  + * fix for infinite loop between XSComplexTypeDefinitions and 
XSElementDeclarations; from David Cargill
  + *
    * Revision 1.6  2003/11/23 16:20:16  knoaman
    * PSVI: pass scope and enclosing type during construction.
    *
  @@ -285,6 +288,8 @@
         */
       void setId(unsigned int id);
   
  +    void setTypeDefinition(XSTypeDefinition* typeDefinition);
  +
       //@}
   private:
   
  @@ -356,6 +361,10 @@
       return fEnclosingTypeDefinition;
   }
   
  +inline void XSElementDeclaration::setTypeDefinition(XSTypeDefinition* 
typeDefinition)
  +{
  +    fTypeDefinition = typeDefinition;
  +}
   
   XERCES_CPP_NAMESPACE_END
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to