mmidy       00/02/18 09:48:34

  Modified:    src/org/apache/xalan/xpath/xml MutableAttrListImpl.java
  Log:
  Fix removeattribute
  
  Revision  Changes    Path
  1.3       +13 -6     
xml-xalan/src/org/apache/xalan/xpath/xml/MutableAttrListImpl.java
  
  Index: MutableAttrListImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/MutableAttrListImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MutableAttrListImpl.java  2000/02/18 16:48:37     1.2
  +++ MutableAttrListImpl.java  2000/02/18 17:48:34     1.3
  @@ -81,6 +81,7 @@
     {
       // removeAttribute (name); // I think this is correct, but I don't think 
I need it
       int offset = m_firstFree;
  +    
       // first see if the attribute was already in the list. Increment by 
SLOTS_PER_ATTR
    // because names would only be in those slots. 
       for(int i = 0; i < m_firstFree; i+=SLOTS_PER_ATTR)
       {
  @@ -88,7 +89,8 @@
         {
           offset = i;
           break;
      }  
  -    }
    // If the attribute was not in the list, see if we need a bigger list 
  +    }
  +    
    // If the attribute was not in the list, see if we need a bigger list 
       if (offset == m_firstFree)
       {      
      if((m_firstFree+SLOTS_PER_ATTR) >= m_mapSize)
         {
  @@ -127,15 +129,20 @@
       {
         if(m_map[i+OFFSET_NAME].equals(name))
         {
  -        if(i > m_firstFree)
  -          System.arraycopy(m_map, i+SLOTS_PER_ATTR, m_map, i-SLOTS_PER_ATTR, 
m_firstFree-i);
  +        m_firstFree-=SLOTS_PER_ATTR;
  +        if(i < m_firstFree)
  +        {
  +          System.arraycopy(m_map, i+SLOTS_PER_ATTR, m_map, i, m_firstFree-i);
  +          m_map[m_firstFree+OFFSET_NAME] = null;
  +          m_map[m_firstFree+OFFSET_TYPE] = null;
  +          m_map[m_firstFree+OFFSET_VALUE] = null;
  +        }
           else
           {
             m_map[i+OFFSET_NAME] = null;
             m_map[i+OFFSET_TYPE] = null;
             m_map[i+OFFSET_VALUE] = null;
  -        }
  -        m_firstFree-=SLOTS_PER_ATTR;
  +        }        
           return;
         }
       }
  @@ -279,7 +286,7 @@
      */
     public String getValue (String name)
     {
  -    for(int i = 0; i <= m_firstFree; i++)
    {
  +    for(int i = 0; i <= m_firstFree; i+=SLOTS_PER_ATTR)
    {
         if(m_map[i+OFFSET_NAME].equals(name))
         {
           return m_map[i+OFFSET_NAME];
  
  
  

Reply via email to