neilg       2003/11/27 08:42:00

  Modified:    c/src/xercesc/internal XSObjectFactory.cpp
               c/src/xercesc/framework/psvi XSComplexTypeDefinition.cpp
                        XSMultiValueFacet.cpp
  Log:
  fixes for segfaults and infinite loops in schema component model implementation; 
thanks to David Cargill
  
  Revision  Changes    Path
  1.7       +23 -11    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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSObjectFactory.cpp       25 Nov 2003 17:50:15 -0000      1.6
  +++ XSObjectFactory.cpp       27 Nov 2003 16:42:00 -0000      1.7
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * 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
  + *
    * Revision 1.6  2003/11/25 17:50:15  knoaman
    * Fix AIX linking error
    *
  @@ -512,20 +515,16 @@
           if ((typeInfo->getContentType() == SchemaElementDecl::Simple) &&
               (typeInfo->getDatatypeValidator()))
               xsSimpleType = addOrFind(typeInfo->getDatatypeValidator(), xsModel);
  -
  +        
  +        unsigned int attCount;
           if (typeInfo->hasAttDefs())
           {
               SchemaAttDefList& attDefList = (SchemaAttDefList&) 
typeInfo->getAttDefList();
  -            unsigned int attCount = attDefList.getAttDefCount();
  -            xsAttList = new (fMemoryManager) RefVectorOf<XSAttributeUse>(attCount, 
false, fMemoryManager);
  -            
  -            for(unsigned int i=0; i<attCount; i++)
  -            {
  -                SchemaAttDef& attDef = (SchemaAttDef&) attDefList.getAttDef(i);
  -                XSAttributeDeclaration* xsAttDecl = addOrFind(&attDef, xsModel);
  -                XSAttributeUse* attUse = createXSAttributeUse(xsAttDecl, xsModel);
  -                xsAttList->addElement(attUse);
  -            }
  +            attCount = attDefList.getAttDefCount();
  +            xsAttList = new (fMemoryManager) RefVectorOf<XSAttributeUse>(attCount, 
false, fMemoryManager);            
  +            // create list now put fill it in after we put complextype into map
  +            // otherwise we may encounter an infinite loop: complextype needs to
  +            // addorfind attdef, which does an addorfind on the 
enclosingCTdefintion.
           }
   
           // compute fBase
  @@ -552,6 +551,19 @@
               , fMemoryManager
           );
           putObjectInMap(typeInfo, xsObj, xsModel);
  +       
  +        if (typeInfo->hasAttDefs())
  +        {
  +            // now create the xsattributedeclarations...
  +            SchemaAttDefList& attDefList = (SchemaAttDefList&) 
typeInfo->getAttDefList();
  +            for(unsigned int i=0; i<attCount; i++)
  +            {
  +                SchemaAttDef& attDef = (SchemaAttDef&) attDefList.getAttDef(i);
  +                XSAttributeDeclaration* xsAttDecl = addOrFind(&attDef, xsModel);
  +                XSAttributeUse* attUse = createXSAttributeUse(xsAttDecl, xsModel);
  +                xsAttList->addElement(attUse);
  +            }
  +        }
   
           // process local elements
           unsigned int elemCount = typeInfo->elementCount();
  
  
  
  1.8       +7 -0      
xml-xerces/c/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp
  
  Index: XSComplexTypeDefinition.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSComplexTypeDefinition.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XSComplexTypeDefinition.cpp       25 Nov 2003 18:08:31 -0000      1.7
  +++ XSComplexTypeDefinition.cpp       27 Nov 2003 16:42:00 -0000      1.8
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.8  2003/11/27 16:42:00  neilg
  + * fixes for segfaults and infinite loops in schema component model implementation; 
thanks to David Cargill
  + *
    * Revision 1.7  2003/11/25 18:08:31  knoaman
    * Misc. PSVI updates. Thanks to David Cargill.
    *
  @@ -88,6 +91,7 @@
   #include <xercesc/framework/psvi/XSAttributeUse.hpp>
   #include <xercesc/framework/psvi/XSModel.hpp>
   #include <xercesc/framework/psvi/XSAnnotation.hpp>
  +#include <xercesc/framework/psvi/XSParticle.hpp>
   #include <xercesc/validators/schema/ComplexTypeInfo.hpp>
   #include <xercesc/validators/schema/SchemaElementDecl.hpp>
   #include <xercesc/validators/schema/SchemaAttDefList.hpp>
  @@ -152,6 +156,9 @@
   
       if (fXSAnnotationList)
           delete fXSAnnotationList;
  +
  +    if (fParticle)
  +        delete fParticle;
   }
   
   // ---------------------------------------------------------------------------
  
  
  
  1.6       +4 -0      xml-xerces/c/src/xercesc/framework/psvi/XSMultiValueFacet.cpp
  
  Index: XSMultiValueFacet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSMultiValueFacet.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSMultiValueFacet.cpp     21 Nov 2003 17:34:04 -0000      1.5
  +++ XSMultiValueFacet.cpp     27 Nov 2003 16:42:00 -0000      1.6
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.6  2003/11/27 16:42:00  neilg
  + * fixes for segfaults and infinite loops in schema component model implementation; 
thanks to David Cargill
  + *
    * Revision 1.5  2003/11/21 17:34:04  knoaman
    * PSVI update
    *
  @@ -94,6 +97,7 @@
       , fFacetKind(facetKind)
       , fIsFixed(isFixed)
       , fLexicalValues(lexicalValues)
  +    , fXSAnnotationList(0)
   {
       if (headAnnot)
       {
  
  
  

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

Reply via email to