Changeset 110


Ignore:
Timestamp:
Oct 15, 2001, 11:17:25 PM (24 years ago)
Author:
umoeller
Message:

Misc updates.

Location:
trunk/src/helpers
Files:
5 edited

Legend:

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

    r108 r110  
    22552255
    22562256    // get the PATH value
    2257     PSZ pszPath;
     2257    PCSZ pcszPathValue;
    22582258    if (!(arc = DosScanEnv((PSZ)pcszPath,
    2259                            &pszPath)))
     2259#if __cplusplus
     2260                           &pcszPathValue)))
     2261#else
     2262                           (PSZ*)&pcszPathValue)))
     2263#endif
    22602264    {
    22612265        // run thru the path components
    22622266        PSZ pszPathCopy;
    2263         if (pszPathCopy = strdup(pszPath))
     2267        if (pszPathCopy = strdup(pcszPathValue))
    22642268        {
    22652269            PSZ pszToken = strtok(pszPathCopy, ";");
    2266             while (pszToken)        // V0.9.12 (2001-05-03) [umoeller]
     2270            while (pszToken)
    22672271            {
    22682272                CHAR szFileMask[2*CCHMAXPATH];
  • trunk/src/helpers/eah.c

    r108 r110  
    203203    FILEFINDBUF4   ffb4;
    204204
    205     arc = DosQueryPathInfo((PSZ)pcszPath,
    206                            FIL_QUERYEASIZE,
    207                            &ffb4,
    208                            sizeof(FILEFINDBUF4));
    209 
    210     if (arc == NO_ERROR)
    211     {
    212         // CHAR szFile[CCHMAXPATH];
    213         // PBYTE pbBuffer = malloc(ffb4.cbList);
     205    if (!(arc = DosQueryPathInfo((PSZ)pcszPath,
     206                                 FIL_QUERYEASIZE,
     207                                 &ffb4,
     208                                 sizeof(FILEFINDBUF4))))
     209    {
    214210        BYTE abBuf[2000];
    215211        LONG lCount = 0;
     
    218214        lCount = -1;
    219215
    220         arc = DosEnumAttribute(ENUMEA_REFTYPE_PATH,
    221                                (PSZ)pcszPath,
    222                                1,
    223                                abBuf,
    224                                sizeof(abBuf),
    225                                (PULONG)&lCount,
    226                                ENUMEA_LEVEL_NO_VALUE);
     216        if (!(arc = DosEnumAttribute(ENUMEA_REFTYPE_PATH,
     217                                     (PSZ)pcszPath,
     218                                     1,
     219                                     abBuf,
     220                                     sizeof(abBuf),
     221                                     (PULONG)&lCount,
     222                                     ENUMEA_LEVEL_NO_VALUE)))
     223        {
    227224            // ulCount now contains the EA count
    228225
    229         pdena2 = (PDENA2)abBuf;
    230 
    231         if (lCount > 0)
    232         {
    233             ulTotalEASize = pdena2->cbName + 8;
    234 
    235             while (lCount > 0)
     226            pdena2 = (PDENA2)abBuf;
     227
     228            if (lCount > 0)
    236229            {
    237                 ulTotalEASize += (pdena2->cbValue + sizeof(DENA2));
    238                 lCount--;
    239                 pdena2 = (PDENA2) (((PBYTE) pdena2) +
    240                               pdena2->oNextEntryOffset);
    241 
     230                ulTotalEASize = pdena2->cbName + 8;
     231
     232                while (lCount > 0)
     233                {
     234                    ulTotalEASize += (pdena2->cbValue + sizeof(DENA2));
     235                    lCount--;
     236                    pdena2 = (PDENA2) (((PBYTE) pdena2) +
     237                                  pdena2->oNextEntryOffset);
     238
     239                }
    242240            }
    243241        }
  • trunk/src/helpers/shapewin.c

    r51 r110  
    13741374                // load resource bitmap
    13751375                psb->hbm = GpiLoadBitmap(psb->hps,
    1376                                              hmodResource,
    1377                                              idResource,
    1378                                              0, 0);
     1376                                         hmodResource,
     1377                                         idResource,
     1378                                         0, 0);
    13791379            if (psb->hbm)
    13801380            {
  • trunk/src/helpers/wphandle.c

    r108 r110  
    9999
    100100APIRET wphQueryActiveHandles(HINI hiniSystem,
    101                              PSZ *ppszActiveHandles)
     101                             PSZ *ppszActiveHandles)        // out: active handles string (new buffer)
    102102{
    103103    PSZ pszActiveHandles;
     
    231231                // store PNODE in hash table
    232232                pHandlesBuf->NodeHashTable[pNode->usHandle] = pNode;
    233                 pCur += sizeof (NODE) + pNode->usNameSize;
     233                pCur += sizeof(NODE) + pNode->usNameSize;
    234234            }
    235235            else
     
    341341                        ULONG   cbTotalOld = cbTotal;
    342342                        cbTotal += cbBlockThis;
    343                         if (!(pbData = realloc(pbData, cbTotal)))
     343                        if (!(pbData = (BYTE*)realloc(pbData, cbTotal)))
    344344                                // on first call, pbData is NULL and this
    345345                                // behaves like malloc()
     
    417417    return (arc);
    418418}
    419 
    420 /*
    421  *@@ wphReadAllBlocks:
    422  *      this reads all the BLOCK's in the active handles
    423  *      section in OS2SYS.INI into one common buffer, for
    424  *      which sufficient memory is allocated.
    425  *
    426  *      Each of these blocks is a maximum of 64 KB, hell
    427  *      knows why, maybe the INIs can't handle more. This
    428  *      func combines all the BLOCK's into one buffer anyways,
    429  *      which can then be searched.
    430  *
    431  *      Use wphQueryActiveHandles to pass the active handles
    432  *      section to this function.
    433  *
    434  *      This gets called by the one-shot function
    435  *      wphQueryHandleFromPath.
    436  */
    437 
    438 /* BOOL wphReadAllBlocks(HINI hiniSystem,       // in: can be HINI_USER or HINI_SYSTEM
    439                       PSZ pszActiveHandles,  // in: active handles section
    440                       PBYTE* ppBlock,        // in/out: pointer to buffer, which
    441                                              //    will point to the allocated
    442                                              //    memory afterwards
    443                       PULONG pulSize)        // out: size of the allocated buffer
    444 {
    445     PBYTE   pbAllBlocks,
    446             pszBlockName,
    447             p;
    448     ULONG   ulBlockSize;
    449     ULONG   ulTotalSize;
    450     BYTE    rgfBlock[100];
    451     BYTE    szAppName[10];
    452     USHORT  usBlockNo;
    453 
    454     pbAllBlocks = wphEnumProfileKeys(hiniSystem, pszActiveHandles, &ulBlockSize);
    455     if (!pbAllBlocks)
    456        return FALSE;
    457 
    458     // query size of all individual blocks and calculate total
    459     memset(rgfBlock, 0, sizeof rgfBlock);
    460     ulTotalSize = 0L;
    461     pszBlockName = pbAllBlocks;
    462     while (*pszBlockName)
    463     {
    464         if (!memicmp(pszBlockName, "BLOCK", 5))
    465         {
    466            usBlockNo = atoi(pszBlockName + 5);
    467            if (usBlockNo < 100)
    468            {
    469                rgfBlock[usBlockNo] = TRUE;
    470 
    471                if (!PrfQueryProfileSize(hiniSystem,
    472                                         pszActiveHandles,
    473                                         pszBlockName,
    474                                         &ulBlockSize))
    475                {
    476                    free(pbAllBlocks);
    477                    return FALSE;
    478                }
    479                ulTotalSize += ulBlockSize;
    480            }
    481         }
    482         pszBlockName += strlen(pszBlockName) + 1;
    483     }
    484 
    485     // *pulSize now contains the total size of all blocks
    486     *ppBlock = (PBYTE)malloc(ulTotalSize);
    487     if (!(*ppBlock))
    488     {
    489          free(pbAllBlocks);
    490          return FALSE;
    491     }
    492 
    493     // now get all blocks into the memory we allocated
    494     p = *ppBlock;
    495     (*pulSize) = 0;
    496     for (usBlockNo = 1; usBlockNo < 100; usBlockNo++)
    497     {
    498         if (!rgfBlock[usBlockNo])
    499             break;
    500 
    501         sprintf(szAppName, "BLOCK%u", (UINT)usBlockNo);
    502         ulBlockSize = ulTotalSize;
    503         if (!PrfQueryProfileData(hiniSystem,
    504                                  pszActiveHandles,
    505                                  szAppName,
    506                                  p,
    507                                  &ulBlockSize))
    508         {
    509             free(pbAllBlocks);
    510             free(*ppBlock);
    511             return FALSE;
    512         }
    513         p += ulBlockSize;
    514         (*pulSize) += ulBlockSize;
    515         ulTotalSize -= ulBlockSize;
    516     }
    517 
    518     free(pbAllBlocks);
    519     return TRUE;
    520 } */
    521419
    522420/* ******************************************************************
     
    688586{
    689587    APIRET      arc = NO_ERROR;
    690     PVOID       pvData;
     588
     589    PSZ         pszActiveHandles = NULL;
     590    PHANDLESBUF pHandlesBuf = NULL;
    691591
    692592    TRY_LOUD(excpt1)
    693593    {
    694594        // not found there: check the handles then
    695         PSZ pszActiveHandles;
     595
    696596        if (arc = wphQueryActiveHandles(hiniSystem, &pszActiveHandles))
    697597            _Pmpf((__FUNCTION__ ": wphQueryActiveHandles returned %d", arc));
    698598        else
    699599        {
    700             PHANDLESBUF pHandlesBuf;
    701600            if (arc = wphLoadHandles(hiniUser,
    702601                                     hiniSystem,
     
    719618                else
    720619                    arc = ERROR_FILE_NOT_FOUND;
    721 
    722                 wphFreeHandles(&pHandlesBuf);
    723             }
    724 
    725             free(pszActiveHandles);
     620            }
    726621        }
    727622    }
     
    730625        arc = ERROR_WPH_CRASHED;
    731626    } END_CATCH();
     627
     628    if (pszActiveHandles)
     629        free(pszActiveHandles);
     630    if (pHandlesBuf)
     631        wphFreeHandles(&pHandlesBuf);
    732632
    733633    return (arc);
  • trunk/src/helpers/xstring.c

    r108 r110  
    396396       )
    397397    {
    398         pxstr->psz = realloc(pxstr->psz,
    399                              pxstr->ulLength + 1);
     398        pxstr->psz = (PSZ)realloc(pxstr->psz,
     399                                  pxstr->ulLength + 1);
    400400        pxstr->cbAllocated = pxstr->ulLength + 1;
    401401    }
Note: See TracChangeset for help on using the changeset viewer.