Ignore:
Timestamp:
Oct 12, 2001, 7:51:09 PM (24 years ago)
Author:
phaller
Message:

performance improvement on ILSimpleGetText used for comparison

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/pidl.c

    r7014 r7031  
    486486        while (pidltemp1->mkid.cb && pidltemp2->mkid.cb)
    487487        {
    488             _ILSimpleGetText(pidltemp1, szData1, MAX_PATH);
    489             _ILSimpleGetText(pidltemp2, szData2, MAX_PATH);
    490 
    491             if (strcasecmp ( szData1, szData2 )!=0 )
     488//          _ILSimpleGetText(pidltemp1, szData1, MAX_PATH);
     489//          _ILSimpleGetText(pidltemp2, szData2, MAX_PATH);
     490//
     491//          if (strcasecmp ( szData1, szData2 )!=0 )
     492            if (_ILSimpleCompareText(pidltemp1, pidltemp2) != 0)
    492493              return FALSE;
    493494
     
    525526        while (pParent->mkid.cb && pChild->mkid.cb)
    526527        {
    527           _ILSimpleGetText(pParent, szData1, MAX_PATH);
    528           _ILSimpleGetText(pChild, szData2, MAX_PATH);
    529 
    530           if (strcasecmp ( szData1, szData2 )!=0 )
    531             return FALSE;
     528//        _ILSimpleGetText(pParent, szData1, MAX_PATH);
     529//        _ILSimpleGetText(pChild, szData2, MAX_PATH);
     530//
     531//        if (strcasecmp ( szData1, szData2 )!=0 )
     532          if ( _ILSimpleCompareText(pParent, pChild) != 0)
     533            return FALSE;
    532534
    533535          pParent = ODIN_ILGetNext(pParent);
     
    585587          while (pidltemp1->mkid.cb && pidltemp2->mkid.cb)
    586588          {
    587             _ILSimpleGetText(pidltemp1, szData1, MAX_PATH);
    588             _ILSimpleGetText(pidltemp2, szData2, MAX_PATH);
    589 
    590             if (strcasecmp(szData1,szData2))
     589//          _ILSimpleGetText(pidltemp1, szData1, MAX_PATH);
     590//          _ILSimpleGetText(pidltemp2, szData2, MAX_PATH);
     591//
     592//          if (strcasecmp(szData1,szData2))
     593            if ( _ILSimpleCompareText( pidltemp1, pidltemp2 ) )
    591594              break;
    592595
     
    16101613}
    16111614
     1615
     1616 /**************************************************************************
     1617 *  _ILSimpleCompareText
     1618 *
     1619 * gets the text for the first item in the pidl (eg. simple pidl)
     1620 * and compares it with the text for the second pidl
     1621 *
     1622 * returns the length of the string
     1623 */
     1624int _ILSimpleCompareText (LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
     1625{
     1626  LPSTR lpText1;
     1627  LPSTR lpText2;
     1628 
     1629  char szTemp1[MAX_PATH];
     1630  char szTemp2[MAX_PATH];
     1631  GUID const *  riid;
     1632 
     1633
     1634  if (!pidl1 && !pidl2)
     1635    return 0;
     1636 
     1637  if (!pidl1 && pidl2)
     1638    return -1;
     1639 
     1640  if (pidl1 && !pidl2)
     1641    return 1;
     1642 
     1643 
     1644  // -------------
     1645  // examine pidl1
     1646  // -------------
     1647  if (_ILIsDesktop(pidl1))
     1648  {
     1649    HCR_GetClassName(&CLSID_ShellDesktop, szTemp1, MAX_PATH);
     1650    lpText1 = szTemp1;
     1651  }
     1652  else
     1653    if ( lpText1 = _ILGetTextPointer(pidl1) )
     1654    {
     1655      // OK, nice to have a valid pointer :)
     1656    }
     1657    else
     1658      if ( riid = _ILGetGUIDPointer(pidl1) )
     1659      {
     1660      /* special folder */
     1661        HCR_GetClassName(riid, szTemp1, MAX_PATH);
     1662        lpText1 = szTemp1;
     1663      }
     1664      else
     1665        lpText1 = "undetermined";
     1666 
     1667  // -------------
     1668  // examine pidl2
     1669  // -------------
     1670  if (_ILIsDesktop(pidl2))
     1671  {
     1672    HCR_GetClassName(&CLSID_ShellDesktop, szTemp2, MAX_PATH);
     1673    lpText2 = szTemp2;
     1674  }
     1675  else
     1676    if ( lpText2 = _ILGetTextPointer(pidl2) )
     1677    {
     1678      // OK, nice to have a valid pointer :)
     1679    }
     1680    else
     1681      if ( riid = _ILGetGUIDPointer(pidl2) )
     1682      {
     1683      /* special folder */
     1684        HCR_GetClassName(riid, szTemp2, MAX_PATH);
     1685        lpText2 = szTemp2;
     1686      }
     1687      else
     1688        lpText2 = "undetermined";
     1689 
     1690 
     1691  // now finally compare the texts
     1692  return strcasecmp(lpText1, lpText2);
     1693}
     1694
     1695
    16121696/**************************************************************************
    16131697 *
Note: See TracChangeset for help on using the changeset viewer.