(file) Return to CIMObjectPath.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/CIMObjectPath.cpp between version 1.65 and 1.66

version 1.65, 2007/10/31 07:55:01 version 1.66, 2007/10/31 07:57:45
Line 93 
Line 93 
     return result;     return result;
 } }
  
 static void _BubbleSort(Array<CIMKeyBinding>& x)  static int _compare(const void* p1, const void* p2)
 { {
     Uint32 n = x.size();      const CIMKeyBinding* kb1 = (const CIMKeyBinding*)p1;
       const CIMKeyBinding* kb2 = (const CIMKeyBinding*)p2;
   
       return String::compareNoCase(
           kb1->getName().getString(),
           kb2->getName().getString());
   }
   
   static void _Sort(Array<CIMKeyBinding>& x)
   {
       CIMKeyBinding* data = (CIMKeyBinding*)x.getData();
       Uint32 size = x.size();
  
     //     //
     //  If the key is a reference, the keys in the reference must also be     //  If the key is a reference, the keys in the reference must also be
     //  sorted     //  sorted
     //     //
     for (Uint32 k = 0; k < n ; k++)      for (Uint32 k = 0; k < size; k++)
         if (x[k].getType () == CIMKeyBinding::REFERENCE)  
         {         {
             CIMObjectPath tmp (x[k].getValue ());          CIMKeyBinding& kb = data[k];
   
           if (kb.getType() == CIMKeyBinding::REFERENCE)
           {
               CIMObjectPath tmp(kb.getValue());
             Array <CIMKeyBinding> keyBindings = tmp.getKeyBindings ();             Array <CIMKeyBinding> keyBindings = tmp.getKeyBindings ();
             _BubbleSort (keyBindings);              _Sort(keyBindings);
             tmp.setKeyBindings (keyBindings);             tmp.setKeyBindings (keyBindings);
             x[k].setValue (tmp.toString ());              kb.setValue(tmp.toString());
           }
         }         }
  
     if (n < 2)      if (size < 2)
         return;         return;
  
     for (Uint32 i = 0; i < n - 1; i++)      qsort((void*)data, size, sizeof(CIMKeyBinding), _compare);
     {  
         for (Uint32 j = 0; j < n - 1; j++)  
         {  
             if (String::compareNoCase(x[j].getName().getString(),  
                                       x[j+1].getName().getString()) > 0)  
             {  
                 CIMKeyBinding t = x[j];  
                 x[j] = x[j+1];  
                 x[j+1] = t;  
             }  
         }  
     }  
 } }
  
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Line 580 
Line 583 
     _rep->_nameSpace = nameSpace;     _rep->_nameSpace = nameSpace;
     _rep->_className = className;     _rep->_className = className;
     _rep->_keyBindings = keyBindings;     _rep->_keyBindings = keyBindings;
     _BubbleSort(_rep->_keyBindings);      _Sort(_rep->_keyBindings);
 } }
  
 Boolean _parseHostElement( Boolean _parseHostElement(
Line 839 
Line 842 
         }         }
     }     }
  
     _BubbleSort(keyBindings);      _Sort(keyBindings);
 } }
  
 void CIMObjectPath::set(const String& objectName) void CIMObjectPath::set(const String& objectName)
Line 958 
Line 961 
 { {
     _rep = _copyOnWriteCIMObjectPathRep(_rep);     _rep = _copyOnWriteCIMObjectPathRep(_rep);
     _rep->_keyBindings = keyBindings;     _rep->_keyBindings = keyBindings;
     _BubbleSort(_rep->_keyBindings);      _Sort(_rep->_keyBindings);
 } }
  
 String CIMObjectPath::toString() const String CIMObjectPath::toString() const


Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2