knoaman     2004/01/13 12:47:42

  Modified:    c/src/xercesc/dom/impl DOMWriterImpl.cpp DOMNodeImpl.cpp
                        DOMImplementationImpl.cpp DOMElementImpl.cpp
               c/src/xercesc/parsers AbstractDOMParser.cpp
  Log:
  Remove unnecessary local static data
  
  Revision  Changes    Path
  1.49      +9 -20     xml-xerces/c/src/xercesc/dom/impl/DOMWriterImpl.cpp
  
  Index: DOMWriterImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMWriterImpl.cpp,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- DOMWriterImpl.cpp 13 Jan 2004 16:34:20 -0000      1.48
  +++ DOMWriterImpl.cpp 13 Jan 2004 20:47:42 -0000      1.49
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.49  2004/01/13 20:47:42  knoaman
  + * Remove unnecessary local static data
  + *
    * Revision 1.48  2004/01/13 16:34:20  cargilld
    * Misc memory management changes.
    *
  @@ -441,20 +444,6 @@
   static const XMLByte  BOM_ucs4be[]  = {(XMLByte)0x00, (XMLByte)0x00, (XMLByte)0xFE, 
(XMLByte)0xFF, (XMLByte) 0};
   static const XMLByte  BOM_ucs4le[]  = {(XMLByte)0xFF, (XMLByte)0xFE, (XMLByte)0x00, 
(XMLByte)0x00, (XMLByte) 0};
   
  -static const XMLCh s_xmlnsURI[] = // "http://www.w3.org/2000/xmlns/";
  -    {  chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, 
chForwardSlash,
  -       chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod,
  -       chLatin_o, chLatin_r, chLatin_g, chForwardSlash,
  -       chDigit_2, chDigit_0, chDigit_0, chDigit_0, chForwardSlash,
  -       chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chForwardSlash, 
chNull};
  -static const XMLCh s_xmlns[] = {chLatin_x, chLatin_m, chLatin_l, chLatin_n, 
chLatin_s, chNull};
  -static const XMLCh s_xmlURI[] =    // "http://www.w3.org/XML/1998/namespace";
  -    { chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, 
chForwardSlash,
  -      chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod,
  -      chLatin_o, chLatin_r, chLatin_g, chForwardSlash, chLatin_X, chLatin_M, 
chLatin_L, chForwardSlash,
  -      chDigit_1, chDigit_9, chDigit_9, chDigit_8, chForwardSlash,
  -      chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, 
chLatin_c, chLatin_e,
  -      chNull};
   
   //
   // Notification of the error though error handler
  @@ -1016,7 +1005,7 @@
                       {
                           
namespaceMap->put((void*)prefix,(XMLCh*)nodeToWrite->getNamespaceURI());
                           *fFormatter  << XMLFormatter::NoEscapes
  -                                     << chSpace << s_xmlns;
  +                                     << chSpace << XMLUni::fgXMLNSString;
                           if(!XMLString::equals(prefix,XMLUni::fgZeroLenString))
                               *fFormatter  << chColon << prefix;
                           *fFormatter  << chEqual << chDoubleQuote
  @@ -1064,16 +1053,16 @@
                       const XMLCh* ns = attribute->getNamespaceURI();
                       if (ns != 0 )
                       {
  -                        if(XMLString::equals(ns, s_xmlnsURI)) 
  +                        if(XMLString::equals(ns, XMLUni::fgXMLNSURIName)) 
                           {
                                        const XMLCh* nsPrefix = 
attribute->getLocalName();
  -                            if(XMLString::equals(attribute->getNodeName(),s_xmlns))
  +                            
if(XMLString::equals(attribute->getNodeName(),XMLUni::fgXMLNSString))
                                                                nsPrefix = 
XMLUni::fgZeroLenString;
                                                        
if(namespaceMap->containsKey((void*)nsPrefix))
                                                                continue;
                               
namespaceMap->put((void*)attribute->getLocalName(),(XMLCh*)attribute->getNodeValue());
                           }
  -                        else if(!XMLString::equals(ns, s_xmlURI)) 
  +                        else if(!XMLString::equals(ns, XMLUni::fgXMLURIName)) 
                           {
                               // check if the namespace for the current node is 
already defined
                               const XMLCh* prefix = attribute->getPrefix();
  @@ -1094,7 +1083,7 @@
                                   {
                                       
namespaceMap->put((void*)prefix,(XMLCh*)attribute->getNamespaceURI());
                                       *fFormatter  << XMLFormatter::NoEscapes
  -                                                 << chSpace << s_xmlns << chColon 
<< prefix
  +                                                 << chSpace << 
XMLUni::fgXMLNSString << chColon << prefix
                                                    << chEqual << chDoubleQuote
                                                    << XMLFormatter::AttrEscapes
                                                    << attribute->getNamespaceURI()
  
  
  
  1.28      +19 -54    xml-xerces/c/src/xercesc/dom/impl/DOMNodeImpl.cpp
  
  Index: DOMNodeImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMNodeImpl.cpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- DOMNodeImpl.cpp   12 Jan 2004 21:30:56 -0000      1.27
  +++ DOMNodeImpl.cpp   13 Jan 2004 20:47:42 -0000      1.28
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -365,27 +365,10 @@
   
   
   
  -static const XMLCh s_xml[] = {chLatin_x, chLatin_m, chLatin_l, chNull};
  -static const XMLCh s_xmlURI[] =    // "http://www.w3.org/XML/1998/namespace";
  -    { chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, 
chForwardSlash,
  -      chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod,
  -      chLatin_o, chLatin_r, chLatin_g, chForwardSlash, chLatin_X, chLatin_M, 
chLatin_L, chForwardSlash,
  -      chDigit_1, chDigit_9, chDigit_9, chDigit_8, chForwardSlash,
  -      chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, 
chLatin_c, chLatin_e,
  -      chNull};
  -static const XMLCh s_xmlns[] = {chLatin_x, chLatin_m, chLatin_l, chLatin_n, 
chLatin_s, chNull};
  -static const XMLCh s_xmlnsURI[] = // "http://www.w3.org/2000/xmlns/";
  -    {  chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, 
chForwardSlash,
  -       chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod,
  -       chLatin_o, chLatin_r, chLatin_g, chForwardSlash,
  -       chDigit_2, chDigit_0, chDigit_0, chDigit_0, chForwardSlash,
  -       chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chForwardSlash, 
chNull};
  -
  -
  -const XMLCh *DOMNodeImpl::getXmlString()      {return s_xml;};
  -const XMLCh *DOMNodeImpl::getXmlURIString()   {return s_xmlURI;};
  -const XMLCh *DOMNodeImpl::getXmlnsString()    {return s_xmlns;};
  -const XMLCh *DOMNodeImpl::getXmlnsURIString() {return s_xmlnsURI;};
  +const XMLCh *DOMNodeImpl::getXmlString()      {return XMLUni::fgXMLString;};
  +const XMLCh *DOMNodeImpl::getXmlURIString()   {return XMLUni::fgXMLURIName;};
  +const XMLCh *DOMNodeImpl::getXmlnsString()    {return XMLUni::fgXMLNSString;};
  +const XMLCh *DOMNodeImpl::getXmlnsURIString() {return XMLUni::fgXMLNSURIName;};
   
   //Return a URI mapped from the given prefix and namespaceURI as below
   //    prefix   namespaceURI    output
  @@ -399,34 +382,16 @@
   const XMLCh* DOMNodeImpl::mapPrefix(const XMLCh *prefix,
                                        const XMLCh *namespaceURI, short nType)
   {
  -
  -    static const XMLCh s_xml[] = {chLatin_x, chLatin_m, chLatin_l, chNull};
  -    static const XMLCh s_xmlURI[] =    // "http://www.w3.org/XML/1998/namespace";
  -    { chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, 
chForwardSlash,
  -      chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod,
  -      chLatin_o, chLatin_r, chLatin_g, chForwardSlash, chLatin_X, chLatin_M, 
chLatin_L, chForwardSlash,
  -      chDigit_1, chDigit_9, chDigit_9, chDigit_8, chForwardSlash,
  -      chLatin_n, chLatin_a, chLatin_m, chLatin_e, chLatin_s, chLatin_p, chLatin_a, 
chLatin_c, chLatin_e,
  -      chNull};
  -    static const XMLCh s_xmlns[] = {chLatin_x, chLatin_m, chLatin_l, chLatin_n, 
chLatin_s, chNull};
  -    static const XMLCh s_xmlnsURI[] = // "http://www.w3.org/2000/xmlns/";
  -    {  chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash, 
chForwardSlash,
  -       chLatin_w, chLatin_w, chLatin_w, chPeriod, chLatin_w, chDigit_3, chPeriod,
  -       chLatin_o, chLatin_r, chLatin_g, chForwardSlash,
  -       chDigit_2, chDigit_0, chDigit_0, chDigit_0, chForwardSlash,
  -       chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chForwardSlash, 
chNull};
  -
  -
       if (prefix == 0)
           return namespaceURI;
   
  -    if (XMLString::equals(prefix, s_xml))  {
  -        if (XMLString::equals(namespaceURI, s_xmlURI))
  -            return s_xmlURI;
  +    if (XMLString::equals(prefix, XMLUni::fgXMLString))  {
  +        if (XMLString::equals(namespaceURI, XMLUni::fgXMLURIName))
  +            return XMLUni::fgXMLURIName;
           throw DOMException(DOMException::NAMESPACE_ERR, 0);
  -    } else if (nType == DOMNode::ATTRIBUTE_NODE && XMLString::equals(prefix, 
s_xmlns)) {
  -        if (XMLString::equals(namespaceURI, s_xmlnsURI))
  -            return s_xmlnsURI;
  +    } else if (nType == DOMNode::ATTRIBUTE_NODE && XMLString::equals(prefix, 
XMLUni::fgXMLNSString)) {
  +        if (XMLString::equals(namespaceURI, XMLUni::fgXMLNSURIName))
  +            return XMLUni::fgXMLNSURIName;
           throw DOMException(DOMException::NAMESPACE_ERR, 0);
       } else if (namespaceURI == 0 || *namespaceURI == 0) {
           throw DOMException(DOMException::NAMESPACE_ERR, 0);
  @@ -594,10 +559,10 @@
   
                   ns = attr->getNamespaceURI();
   
  -                if (ns != 0 && XMLString::equals(ns, s_xmlnsURI)) {
  +                if (ns != 0 && XMLString::equals(ns, XMLUni::fgXMLNSURIName)) {
                       // DOM Level 2 nodes
  -                    if ((useDefault && XMLString::equals(attr->getNodeName(), 
s_xmlns)) ||
  -                        (attrPrefix != 0 && XMLString::equals(attrPrefix, s_xmlns)) 
&&
  +                    if ((useDefault && XMLString::equals(attr->getNodeName(), 
XMLUni::fgXMLNSString)) ||
  +                        (attrPrefix != 0 && XMLString::equals(attrPrefix, 
XMLUni::fgXMLNSString)) &&
                           XMLString::equals(value, namespaceURI)) {
                           const XMLCh* localname= attr->getLocalName();
                           const XMLCh* foundNamespace = 
el->lookupNamespaceURI(localname);
  @@ -644,14 +609,14 @@
                       const XMLCh *value = attr->getNodeValue();
                       ns = attr->getNamespaceURI();
   
  -                    if (ns != 0 && XMLString::equals(ns, s_xmlnsURI)) {
  +                    if (ns != 0 && XMLString::equals(ns, XMLUni::fgXMLNSURIName)) {
                           // at this point we are dealing with DOM Level 2 nodes only
                           if (specifiedPrefix == 0 &&
  -                            XMLString::equals(attr->getNodeName(), s_xmlns)) {
  +                            XMLString::equals(attr->getNodeName(), 
XMLUni::fgXMLNSString)) {
                               // default namespace
                               return value;
                           } else if (attrPrefix != 0 &&
  -                                   XMLString::equals(attrPrefix, s_xmlns) &&
  +                                   XMLString::equals(attrPrefix, 
XMLUni::fgXMLNSString) &&
                                      XMLString::equals(attr->getLocalName(), 
specifiedPrefix)) {
                               // non default namespace
                               return value;
  @@ -1083,7 +1048,7 @@
   
           if (thisNode->hasAttributes()) {
               DOMElement *elem = (DOMElement *)thisNode;
  -            DOMNode *attr = elem->getAttributeNodeNS(s_xmlnsURI, s_xmlns);
  +            DOMNode *attr = elem->getAttributeNodeNS(XMLUni::fgXMLNSURIName, 
XMLUni::fgXMLNSString);
               if (attr != 0) {
                   const XMLCh *value = attr->getNodeValue();
                   return XMLString::equals(namespaceURI, value);
  
  
  
  1.21      +4 -7      xml-xerces/c/src/xercesc/dom/impl/DOMImplementationImpl.cpp
  
  Index: DOMImplementationImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMImplementationImpl.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DOMImplementationImpl.cpp 9 Jan 2004 22:41:58 -0000       1.20
  +++ DOMImplementationImpl.cpp 13 Jan 2004 20:47:42 -0000      1.21
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -84,9 +84,6 @@
   //                     (Static constructors can not be safely used because
   //                      of order of initialization dependencies.)
   // ------------------------------------------------------------
  -static const XMLCh  gXML[] =      // Points to "XML"
  -        {chLatin_X, chLatin_M, chLatin_L, chNull};
  -
   static const XMLCh  g1_0[] =     // Points to "1.0"
           {chDigit_1, chPeriod, chDigit_0, chNull};
   static const XMLCh  g2_0[] =      // Points to "2.0"
  @@ -99,7 +96,7 @@
   static const XMLCh  gCore[] =     // Points to "Core"
           {chLatin_C, chLatin_o, chLatin_r, chLatin_e, chNull};
   static const XMLCh  gRange[] =     // Points to "Range"
  -        {chLatin_R, chLatin_a, chLatin_n, chLatin_g, chLatin_e, 0};
  +        {chLatin_R, chLatin_a, chLatin_n, chLatin_g, chLatin_e, chNull};
   static const XMLCh  gLS[] =     // Points to "LS"
           {chLatin_L, chLatin_S, chNull};
   
  @@ -212,7 +209,7 @@
       bool version3_0 = XMLString::equals(version, g3_0);
   
       // Currently, we support only XML Level 1 version 1.0
  -    if (XMLString::compareIString(feature, gXML) == 0
  +    if (XMLString::compareIString(feature, XMLUni::fgXMLString) == 0
           && (anyVersion || version1_0 || version2_0))
           return true;
   
  
  
  
  1.22      +6 -11     xml-xerces/c/src/xercesc/dom/impl/DOMElementImpl.cpp
  
  Index: DOMElementImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMElementImpl.cpp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DOMElementImpl.cpp        1 Oct 2003 16:32:37 -0000       1.21
  +++ DOMElementImpl.cpp        13 Jan 2004 20:47:42 -0000      1.22
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -168,16 +168,11 @@
   
   const XMLCh * DOMElementImpl::getAttribute(const XMLCh *nam) const
   {
  -    static const XMLCh emptyString[]  = {0};
  -    DOMNode * attr=0;
  +    DOMNode * attr = fAttributes->getNamedItem(nam);
  +    if (attr)
  +        return attr->getNodeValue();
   
  -    attr=fAttributes->getNamedItem(nam);
  -
  -    const XMLCh *retString = emptyString;
  -    if (attr != 0)
  -        retString = attr->getNodeValue();
  -
  -    return retString;
  +    return XMLUni::fgZeroLenString;
   };
   
   
  
  
  
  1.60      +4 -7      xml-xerces/c/src/xercesc/parsers/AbstractDOMParser.cpp
  
  Index: AbstractDOMParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/parsers/AbstractDOMParser.cpp,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- AbstractDOMParser.cpp     17 Dec 2003 00:18:35 -0000      1.59
  +++ AbstractDOMParser.cpp     13 Jan 2004 20:47:42 -0000      1.60
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002,2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2002,2004 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -827,9 +827,6 @@
   {
       DOMElement     *elem;
       DOMElementImpl *elemImpl;
  -    static const XMLCh XMLNS[] = {
  -    chLatin_x, chLatin_m, chLatin_l, chLatin_n, chLatin_s, chNull
  -    };
   
       static const XMLCh XSI[] = {
       chLatin_x, chLatin_s, chLatin_i, chNull
  @@ -873,7 +870,7 @@
               unsigned int attrURIId = oneAttrib -> getURIId();
               namespaceURI = 0;
               bool foundXMLNS = false;
  -            if (XMLString::equals(oneAttrib -> getName(), XMLNS)) {   //for 
xmlns=...
  +            if (XMLString::equals(oneAttrib -> getName(), XMLUni::fgXMLNSString)) { 
  //for xmlns=...
                   attrURIId = fScanner->getXMLNSNamespaceId();
                   foundXMLNS = true;
               }
  @@ -967,7 +964,7 @@
                       unsigned int uriId = fScanner->resolveQName(qualifiedName, 
prefixBuf, ElemStack::Mode_Attribute, colonPos);
   
                       const XMLCh* namespaceURI = 0;
  -                    if (XMLString::equals(qualifiedName, XMLNS))    //for xmlns=...
  +                    if (XMLString::equals(qualifiedName, XMLUni::fgXMLNSString))    
//for xmlns=...
                           uriId = fScanner->getXMLNSNamespaceId();
                       if (uriId != fScanner->getEmptyNamespaceId()) {  //TagName has 
a prefix
                           namespaceURI = fScanner->getURIText(uriId);
  
  
  

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

Reply via email to