You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2004/08/31 18:53:22 UTC

cvs commit: xml-xerces/c/src/xercesc/validators/schema ComplexTypeInfo.hpp

cargilld    2004/08/31 09:53:22

  Modified:    c/src/xercesc/validators/schema ComplexTypeInfo.hpp
  Log:
  Thread safety change for getTypeLocalName and getTypeUri.
  
  Revision  Changes    Path
  1.21      +27 -25    xml-xerces/c/src/xercesc/validators/schema/ComplexTypeInfo.hpp
  
  Index: ComplexTypeInfo.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/ComplexTypeInfo.hpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ComplexTypeInfo.hpp	22 Jul 2004 15:00:54 -0000	1.20
  +++ ComplexTypeInfo.hpp	31 Aug 2004 16:53:22 -0000	1.21
  @@ -161,6 +161,9 @@
       void setAttWildCard(SchemaAttDef* const toAdopt);
       void addAttDef(SchemaAttDef* const toAdd);
       void addElement(SchemaElementDecl* const toAdd);
  +    /**     
  +     * @deprecated; not thread-safe (will not work with shared grammars)
  +     */
       void setContentModel(XMLContentModel* const newModelToAdopt);
       void setLocator(XSDLocator* const aLocator);
   
  @@ -420,32 +423,11 @@
   
   inline const XMLCh* ComplexTypeInfo::getTypeLocalName() const
   {
  -    if(!fTypeLocalName) {
  -        int index = XMLString::indexOf(fTypeName, chComma);
  -        int length = XMLString::stringLen(fTypeName);
  -        XMLCh *tName = (XMLCh*) fMemoryManager->allocate
  -        (
  -            (length - index + 1) * sizeof(XMLCh)
  -        ); //new XMLCh[length - index + 1];
  -        XMLString::subString(tName, fTypeName, index + 1, length, fMemoryManager);
  -        ((ComplexTypeInfo *)this)->fTypeLocalName = tName;
  -    }
  -
       return fTypeLocalName;
   }
   
   inline const XMLCh* ComplexTypeInfo::getTypeUri() const
   {
  -    if(!fTypeUri) {
  -        int index = XMLString::indexOf(fTypeName, chComma);
  -        XMLCh *uri = (XMLCh*) fMemoryManager->allocate
  -        (
  -            (index + 1) * sizeof(XMLCh)
  -        ); //new XMLCh[index + 1];
  -        XMLString::subString(uri, fTypeName, 0, index, fMemoryManager);
  -        ((ComplexTypeInfo *)this)->fTypeUri = uri;
  -    }
  -
      return fTypeUri;
   }
   
  @@ -507,10 +489,30 @@
   
       fMemoryManager->deallocate(fTypeName);//delete [] fTypeName;
       fMemoryManager->deallocate(fTypeLocalName);//delete [] fTypeLocalName;
  -    fMemoryManager->deallocate(fTypeUri);//delete [] fTypeUri;
  -    fTypeLocalName = fTypeUri = 0;
  +    fMemoryManager->deallocate(fTypeUri);//delete [] fTypeUri;    
  +
  +    if (typeName)
  +    {
  +        fTypeName = XMLString::replicate(typeName, fMemoryManager);
   
  -    fTypeName = XMLString::replicate(typeName, fMemoryManager);
  +        int index = XMLString::indexOf(fTypeName, chComma);
  +        int length = XMLString::stringLen(fTypeName);
  +        fTypeLocalName = (XMLCh*) fMemoryManager->allocate
  +        (
  +            (length - index + 1) * sizeof(XMLCh)
  +        ); //new XMLCh[length - index + 1];
  +        XMLString::subString(fTypeLocalName, fTypeName, index + 1, length, fMemoryManager);
  +        
  +        fTypeUri = (XMLCh*) fMemoryManager->allocate
  +        (
  +            (index + 1) * sizeof(XMLCh)
  +        ); //new XMLCh[index + 1];
  +        XMLString::subString(fTypeUri, fTypeName, 0, index, fMemoryManager);        
  +    }
  +    else
  +    {
  +        fTypeName = fTypeLocalName = fTypeUri = 0;
  +    }
   }
   
   inline void
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org