Changeset 140 for trunk/src/helpers


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

V0.9.18, plus a bunch of fixes already.

Location:
trunk/src/helpers
Files:
5 edited

Legend:

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

    r133 r140  
    12501250                ProgDetails.pszParameters = strParamsPatched.psz;
    12511251
    1252                 _Pmpf((__FUNCTION__ ": progt.progc: %d", ProgDetails.progt.progc));
     1252                /* _Pmpf((__FUNCTION__ ": progt.progc: %d", ProgDetails.progt.progc));
    12531253                _Pmpf(("    progt.fbVisible: 0x%lX", ProgDetails.progt.fbVisible));
    12541254                _Pmpf(("    progt.pszTitle: \"%s\"", (ProgDetails.pszTitle) ? ProgDetails.pszTitle : "NULL"));
     
    12571257                _Pmpf(("    startup: \"%s\"", (ProgDetails.pszStartupDir) ? ProgDetails.pszStartupDir : "NULL"));
    12581258                _Pmpf(("    pszIcon: \"%s\"", (ProgDetails.pszIcon) ? ProgDetails.pszIcon : "NULL"));
    1259                 /* _Pmpf(("    environment: "));
     1259                _Pmpf(("    environment: "));
    12601260                {
    12611261                    PSZ pszThis = ProgDetails.pszEnvironment;
     
    12681268                   */
    12691269
    1270                 _Pmpf(("    swpInitial.fl = 0x%lX, x = %d, y = %d, cx = %d, cy = %d:",
     1270                /* _Pmpf(("    swpInitial.fl = 0x%lX, x = %d, y = %d, cx = %d, cy = %d:",
    12711271                            ProgDetails.swpInitial.fl,
    12721272                            ProgDetails.swpInitial.x,
     
    12791279                            ProgDetails.swpInitial.ulReserved1,
    12801280                            ProgDetails.swpInitial.ulReserved2));
     1281                   */
    12811282
    12821283                if (pszFailingName)
     
    13081309                    {
    13091310                        // cannot start app:
    1310                         _Pmpf((__FUNCTION__ ": WinStartApp failed"));
     1311                        // _Pmpf((__FUNCTION__ ": WinStartApp failed"));
    13111312                        arc = ERROR_FILE_NOT_FOUND;
    13121313                        // unfortunately WinStartApp doesn't
     
    14051406    } // end if (ProgDetails.pszExecutable)
    14061407
    1407     _Pmpf((__FUNCTION__ ": returning %d", arc));
     1408    // _Pmpf((__FUNCTION__ ": returning %d", arc));
    14081409
    14091410    return (arc);
  • trunk/src/helpers/exeh.c

    r132 r140  
    24902490    if (ulObjPageTblIndexThis - 1 >= pExec->pLXHeader->ulPageCount)
    24912491    {
    2492         _Pmpf(("ulObjPageTblIndexThis %d is too large", ulObjPageTblIndexThis));
     2492        // _Pmpf(("ulObjPageTblIndexThis %d is too large", ulObjPageTblIndexThis));
    24932493        return ERROR_INVALID_SEGMENT_NUMBER;     // 180
    24942494    }
     
    25352535        ulOffset +=   ulExeOffset;
    25362536
    2537         _Pmpf(("  reading pgtbl %d, ofs %d, type %s",
     2537        /* _Pmpf(("  reading pgtbl %d, ofs %d, type %s",
    25382538                ulObjPageTblIndex,
    25392539                ulOffset,
    25402540                (ulFlags == 0x0001) ? "ITERDATA"
    25412541                : (ulFlags == 0x0005) ? "ITERDATA2"
    2542                 : "uncompressed"));
     2542                : "uncompressed")); */
    25432543
    25442544        if (ulSize > ulPageSize)
     
    25512551                                    0)))
    25522552        {
    2553             _Pmpf(("   %d bytes read", ulSize));
     2553            // _Pmpf(("   %d bytes read", ulSize));
    25542554
    25552555            // terminate buffer for decompress
     
    26442644    *ppbResData = 0;
    26452645
    2646     _Pmpf((__FUNCTION__ " %s: ulType = %d, idResource %d",
     2646    /* _Pmpf((__FUNCTION__ " %s: ulType = %d, idResource %d",
    26472647            pExec->pFile->pszFilename,
    2648             ulType, idResource));
     2648            ulType, idResource)); */
    26492649
    26502650    if (!(pLXHeader = pExec->pLXHeader))
     
    26932693                if (pRsEntry->obj - 1 >= pLXHeader->ulObjCount)
    26942694                {
    2695                     _Pmpf(("pRsEntry->obj %d is too large", pRsEntry->obj));
     2695                    // _Pmpf(("pRsEntry->obj %d is too large", pRsEntry->obj));
    26962696                    arc = ERROR_INVALID_SEGMENT_NUMBER;     // 180
    26972697                }
     
    27562756                                ulPageThis;
    27572757
    2758                         _Pmpf(("  found RT_POINTER %d, size %d, resofs %d",
     2758                        /* _Pmpf(("  found RT_POINTER %d, size %d, resofs %d",
    27592759                                pRsEntry->name,
    27602760                                pRsEntry->cb,
    27612761                                pRsEntry->offset));
    27622762                        _Pmpf(("  ulFirstPage %d, ulResOffsetInFirstPage %d, cPages %d",
    2763                                 ulFirstPage, ulResOffsetInFirstPage, cPages));
     2763                                ulFirstPage, ulResOffsetInFirstPage, cPages)); */
    27642764
    27652765                        ulPageThis = ulObjPageTblIndex + ulFirstPage;
     
    28262826    }
    28272827
    2828     _Pmpf((__FUNCTION__ ": returning %d", arc));
     2828    // _Pmpf((__FUNCTION__ ": returning %d", arc));
    28292829
    28302830    return (arc);
     
    30113011        ulNewHeaderOfs = pExec->pDosExeHeader->ulNewHeaderOfs;
    30123012
    3013     _Pmpf((__FUNCTION__ ": entering, checking %d resources", pNEHeader->usResSegmCount));
     3013    // _Pmpf((__FUNCTION__ ": entering, checking %d resources", pNEHeader->usResSegmCount));
    30143014
    30153015    if (!(cResources = pNEHeader->usResSegmCount))
     
    30803080            arc = ERROR_NO_DATA;
    30813081    }
    3082     else
    3083         _Pmpf(("exehLoadOS2NEMaps returned %d"));
     3082    // else
     3083        // _Pmpf(("exehLoadOS2NEMaps returned %d"));
    30843084
    30853085    return (arc);
  • trunk/src/helpers/gpih.c

    r135 r140  
    15261526        bih2.cPlanes = (cPlanes) ? cPlanes : alData[0];
    15271527        bih2.cBitCount = (cBitCount) ? cBitCount : alData[1];
    1528             _Pmpf((__FUNCTION__ ": cPlanes %d, cBitCount %d",
    1529                         bih2.cPlanes, bih2.cBitCount));
     1528            // _Pmpf((__FUNCTION__ ": cPlanes %d, cBitCount %d",
     1529               //          bih2.cPlanes, bih2.cBitCount));
    15301530        bih2.ulCompression = BCA_UNCOMP;
    15311531        bih2.cbImage = (    (   (bih2.cx
  • trunk/src/helpers/stringh.c

    r132 r140  
    8181                      PCSZ pcszSource,
    8282                      PULONG pulLength,        // out: length of new string (ptr can be NULL)
    83                       const char *pcszSourceFile,
     83                      PCSZ pcszSourceFile,
    8484                      unsigned long ulLine,
    85                       const char *pcszFunction)
     85                      PCSZ pcszFunction)
    8686{
    8787    ULONG ulLength = 0;
     
    169169 */
    170170
    171 PSZ strhcpy(PSZ string1, const char *string2)
     171PSZ strhcpy(PSZ string1, PCSZ string2)
    172172{
    173173    if (string2)
     
    187187 */
    188188
    189 PSZ strhdupDebug(const char *pcszSource,
     189PSZ strhdupDebug(PCSZ pcszSource,
    190190                 unsigned long *pulLength,
    191                  const char *pcszSourceFile,
     191                 PCSZ pcszSourceFile,
    192192                 unsigned long ulLine,
    193                  const char *pcszFunction)
     193                 PCSZ pcszFunction)
    194194{
    195195    PSZ     pszReturn = NULL;
     
    225225 */
    226226
    227 PSZ strhdup(const char *pcszSource,
     227PSZ strhdup(PCSZ pcszSource,
    228228            unsigned long *pulLength)       // out: length of string excl. null terminator (ptr can be NULL)
    229229{
     
    259259 */
    260260
    261 int strhcmp(const char *p1, const char *p2)
     261int strhcmp(PCSZ p1, PCSZ p2)
    262262{
    263263    if (p1 && p2)
     
    286286 */
    287287
    288 int strhicmp(const char *p1, const char *p2)
     288int strhicmp(PCSZ p1, PCSZ p2)
    289289{
    290290    if (p1 && p2)
     
    312312 */
    313313
    314 PSZ strhistr(const char *string1, const char *string2)
     314PSZ strhistr(PCSZ string1, PCSZ string2)
    315315{
    316316    PSZ prc = NULL;
     
    352352
    353353ULONG strhncpy0(PSZ pszTarget,
    354                 const char *pszSource,
     354                PCSZ pszSource,
    355355                ULONG cbSource)
    356356{
     
    378378 */
    379379
    380 ULONG strhCount(const char *pszSearch,
     380ULONG strhCount(PCSZ pszSearch,
    381381                CHAR c)
    382382{
     
    424424 */
    425425
    426 PSZ strhSubstrDebug(const char *pBegin,      // in: first char
    427                     const char *pEnd,        // in: last char (not included)
    428                     const char *pcszSourceFile,
     426PSZ strhSubstrDebug(PCSZ pBegin,      // in: first char
     427                    PCSZ pEnd,        // in: last char (not included)
     428                    PCSZ pcszSourceFile,
    429429                    unsigned long ulLine,
    430                     const char *pcszFunction)
     430                    PCSZ pcszFunction)
    431431{
    432432    PSZ pszSubstr = NULL;
     
    469469 */
    470470
    471 PSZ strhSubstr(const char *pBegin,      // in: first char
    472                const char *pEnd)        // in: last char (not included)
     471PSZ strhSubstr(PCSZ pBegin,      // in: first char
     472               PCSZ pEnd)        // in: last char (not included)
    473473{
    474474    PSZ pszSubstr = NULL;
     
    671671 */
    672672
    673 PSZ strhins(const char *pcszBuffer,
     673PSZ strhins(PCSZ pcszBuffer,
    674674            ULONG ulInsertOfs,
    675             const char *pcszInsert)
     675            PCSZ pcszInsert)
    676676{
    677677    PSZ     pszNew = NULL;
     
    723723                      PULONG pulOfs,               // in: where to begin search (0 = start);
    724724                                                   // out: ofs of first char after replacement string
    725                       const char *pcszSearch,      // in: search string; cannot be NULL
    726                       const char *pcszReplace)     // in: replacement string; cannot be NULL
     725                      PCSZ pcszSearch,      // in: search string; cannot be NULL
     726                      PCSZ pcszReplace)     // in: replacement string; cannot be NULL
    727727{
    728728    ULONG   ulrc = 0;
     
    797797BOOL strhGetWord(PSZ *ppszStart,        // in: start of search,
    798798                                        // out: start of word (if TRUE is returned)
    799                  const char *pLimit,    // in: ptr to last char after *ppszStart to be
     799                 PCSZ pLimit,    // in: ptr to last char after *ppszStart to be
    800800                                        // searched; if the word does not end before
    801801                                        // or with this char, FALSE is returned
    802                  const char *pcszBeginChars, // stringh.h defines STRH_BEGIN_CHARS
    803                  const char *pcszEndChars, // stringh.h defines STRH_END_CHARS
     802                 PCSZ pcszBeginChars, // stringh.h defines STRH_BEGIN_CHARS
     803                 PCSZ pcszEndChars, // stringh.h defines STRH_END_CHARS
    804804                 PSZ *ppszEnd)          // out: first char _after_ word
    805805                                        // (if TRUE is returned)
    806806{
    807807    // characters after which a word can be started
    808     // const char *pcszBeginChars = "\x0d\x0a ";
    809     // const char *pcszEndChars = "\x0d\x0a /-";
     808    // PCSZ pcszBeginChars = "\x0d\x0a ";
     809    // PCSZ pcszEndChars = "\x0d\x0a /-";
    810810
    811811    PSZ pStart = *ppszStart;
     
    855855 */
    856856
    857 BOOL strhIsWord(const char *pcszBuf,
    858                 const char *p,                 // in: start of word
     857BOOL strhIsWord(PCSZ pcszBuf,
     858                PCSZ p,                 // in: start of word
    859859                ULONG cbSearch,                // in: length of word
    860                 const char *pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
    861                 const char *pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
     860                PCSZ pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
     861                PCSZ pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
    862862{
    863863    BOOL    fEndOK = FALSE;
     
    915915 */
    916916
    917 PSZ strhFindWord(const char *pszBuf,
    918                  const char *pszSearch,
    919                  const char *pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
    920                  const char *pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
     917PSZ strhFindWord(PCSZ pszBuf,
     918                 PCSZ pszSearch,
     919                 PCSZ pcszBeginChars,    // suggestion: "\x0d\x0a ()/\\-,."
     920                 PCSZ pcszEndChars)      // suggestion: "\x0d\x0a ()/\\-,.:;"
    921921{
    922922    PSZ     pszReturn = 0;
     
    926926    if ((cbBuf) && (cbSearch))
    927927    {
    928         const char *p = pszBuf;
     928        PCSZ p = pszBuf;
    929929
    930930        do  // while p
     
    966966 */
    967967
    968 PSZ strhFindEOL(const char *pcszSearchIn,        // in: where to search
     968PSZ strhFindEOL(PCSZ pcszSearchIn,        // in: where to search
    969969                PULONG pulOffset)       // out: offset (ptr can be NULL)
    970970{
    971     const char *p = pcszSearchIn,
    972                *prc = 0;
     971    PCSZ    p = pcszSearchIn,
     972            prc = 0;
    973973    while (TRUE)
    974974    {
  • 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.