dbertoni    2003/05/14 08:45:33

  Modified:    c/src/PlatformSupport AttributeListImpl.cpp
  Log:
  Resize the vector before copying.
  
  Revision  Changes    Path
  1.25      +6 -1      xml-xalan/c/src/PlatformSupport/AttributeListImpl.cpp
  
  Index: AttributeListImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/AttributeListImpl.cpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AttributeListImpl.cpp     25 Nov 2002 18:11:01 -0000      1.24
  +++ AttributeListImpl.cpp     14 May 2003 15:45:33 -0000      1.25
  @@ -408,9 +408,12 @@
   
                const XMLCh* const      theNewValueEnd = 
AttributeVectorEntry::endArray(value) + 1;
   
  +             const XMLChVectorType::size_type        theNewSize =
  +                                             
XMLChVectorType::size_type(theNewValueEnd - value);
  +
                // If necessary, create the a new vector and swap them.  
Otherwise,
                // just copy the new data in.
  -             if ((*i)->m_Value.capacity() < 
XMLChVectorType::size_type(theNewValueEnd - value))
  +             if ((*i)->m_Value.capacity() < theNewSize)
                {
                        XMLChVectorType         theNewValue(value, 
theNewValueEnd);
   
  @@ -418,6 +421,8 @@
                }
                else
                {
  +                     (*i)->m_Value.resize(theNewSize);
  +
                        copy(value, theNewValueEnd, (*i)->m_Value.begin());
                }
        }
  
  
  

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

Reply via email to