Ignore:
Timestamp:
Feb 9, 2002, 6:48:12 PM (24 years ago)
Author:
umoeller
Message:

V0.9.18, plus a bunch of fixes already.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/wphandle.c

    r129 r140  
    260260/*
    261261 *@@ wphRebuildNodeHashTable:
     262 *      builds all the complex cache trees in the
     263 *      given handles buffer.
     264 *
     265 *      If (fQuitOnErrors == TRUE), we'll fail as
     266 *      soon as an invalid handle is found. Otherwise
     267 *      we will try to continue if the error is not fatal.
    262268 *
    263269 *      Returns:
     
    269275 *      --  ERROR_WPH_CORRUPT_HANDLES_DATA
    270276 *
     277 *      --  ERROR_WPH_DRIV_TREEINSERT_FAILED: duplicate DRIV node
     278 *          (non-fatal)
     279 *
    271280 *@@added V0.9.16 (2001-10-02) [umoeller]
    272  */
    273 
    274 APIRET wphRebuildNodeHashTable(HHANDLES hHandles)
     281 *@@changted V0.9.17 (2002-02-05) [umoeller]: added fQuitOnErrors
     282 */
     283
     284APIRET wphRebuildNodeHashTable(HHANDLES hHandles,
     285                               BOOL fQuitOnErrors)
    275286{
    276287    APIRET arc = NO_ERROR;
     
    322333                                   (TREE*)pLastDriveTreeNode,
    323334                                   treeCompareStrings))
    324                         arc = ERROR_WPH_DRIV_TREEINSERT_FAILED;
     335                        if (fQuitOnErrors)
     336                            arc = ERROR_WPH_DRIV_TREEINSERT_FAILED;
    325337                }
    326338
     
    355367                        PNODETREENODE pParent;
    356368                        if (!(pParent = pHandlesBuf->NodeHashTable[pNode->usParentHandle]))
     369                        {
    357370                            // this parent handle is invalid:
    358                             arc = ERROR_WPH_INVALID_PARENT_HANDLE;
     371                            if (fQuitOnErrors)
     372                                arc = ERROR_WPH_INVALID_PARENT_HANDLE;
     373                        }
    359374                        else
    360375                        {
     
    372387                        }
    373388                        else
    374                             arc = ERROR_WPH_NODE_BEFORE_DRIV;
    375 
    376                     if (!arc)
     389                            if (fQuitOnErrors)
     390                                arc = ERROR_WPH_NODE_BEFORE_DRIV;
     391
     392                    if (ppTree && pcChildren)
    377393                        if (!treeInsert(ppTree,
    378394                                        pcChildren,
    379395                                        (TREE*)pNew,
    380396                                        treeCompareStrings))
     397                        {
    381398                            // store PNODE in hash table
    382399                            pHandlesBuf->NodeHashTable[pNode->usHandle] = pNew;
     400                            // do not free
     401                            pNew = NULL;
     402                        }
    383403                        else
    384404                            ;
     
    387407                            // arc = ERROR_WPH_NODE_TREEINSERT_FAILED;
    388408
    389                     if (arc)
     409                    if (pNew)
    390410                        free(pNew);
    391411
     
    641661        // rebuild cache
    642662        if (!pHandlesBuf->fCacheValid)
    643             arc = wphRebuildNodeHashTable(hHandles);
     663            arc = wphRebuildNodeHashTable(hHandles,
     664                                          TRUE);        // fail on errors
    644665
    645666        if (!arc)
     
    922943        {
    923944            if (!pHandlesBuf->fCacheValid)
    924                 arc = wphRebuildNodeHashTable(hHandles);
     945                arc = wphRebuildNodeHashTable(hHandles,
     946                                              TRUE);        // fail on errors
    925947
    926948            if (!arc)
Note: See TracChangeset for help on using the changeset viewer.