Changeset 738


Ignore:
Timestamp:
Jul 24, 2007, 3:22:59 AM (13 years ago)
Author:
Steven Levine
Message:

Sync with current naming standards

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dirsize.c

    r731 r738  
    2424  18 Feb 07 GKY Add new drive type icons
    2525  22 Mar 07 GKY Use QWL_USER
     26  23 Jul 07 SHL Sync with naming standards
    2627
    2728***********************************************************************/
     
    4950  CHAR *pchStopFlag;
    5051  DIRCNRDATA *pDCD;
    51 }
    52 DIRSIZE;
     52} DIRSIZE;
    5353
    5454typedef struct
     
    5959  BOOL working;
    6060  HPOINTER hptr;
    61 }
    62 tState;
     61} tState;
    6362
    6463static PSZ pszSrcFile = __FILE__;
     
    9594  ULONGLONG ull;
    9695  HDIR hdir;
    97   FILEFINDBUF4 *pFFB;
     96  FILEFINDBUF4 *pffb;
    9897  APIRET rc;
    9998  RECORDINSERT ri;
    100   PCNRITEM pCI;
     99  PCNRITEM pci;
    101100
    102101  // fixme to report errors
    103102  *pullTotalBytes = 0;                  // In case we fail
    104103
    105   pFFB = xmalloc(sizeof(FILEFINDBUF4), pszSrcFile, __LINE__);
    106   if (!pFFB)
     104  pffb = xmalloc(sizeof(FILEFINDBUF4), pszSrcFile, __LINE__);
     105  if (!pffb)
    107106    return FALSE;
    108107  strcpy(maskstr, pszFileName);
     
    115114  hdir = HDIR_CREATE;
    116115  nm = 1L;
    117   memset(pFFB, 0, sizeof(FILEFINDBUF4));
     116  memset(pffb, 0, sizeof(FILEFINDBUF4));
    118117  DosError(FERR_DISABLEHARDERR);
    119118  //printf("FIND1\n");
     
    121120                    FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
    122121                    FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY,
    123                     pFFB, sizeof(FILEFINDBUF4), &nm, FIL_QUERYEASIZE);
     122                    pffb, sizeof(FILEFINDBUF4), &nm, FIL_QUERYEASIZE);
    124123
    125124  if (!rc)
     
    131130   * requesting EASIZE.  sheesh.
    132131   */
    133   if ((!rc && (pFFB->attrFile & FILE_DIRECTORY)) || strlen(pszFileName) < 4) {
     132  if ((!rc && (pffb->attrFile & FILE_DIRECTORY)) || strlen(pszFileName) < 4) {
    134133    if (*pchStopFlag) {
    135       free(pFFB);
     134      free(pffb);
    136135      return FALSE;
    137136    }
    138     pCI = WinSendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(EXTRA_RECORD_BYTES2),
     137    pci = WinSendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(EXTRA_RECORD_BYTES2),
    139138                     MPFROMLONG(1L));
    140     if (!pCI) {
    141       free(pFFB);
     139    if (!pci) {
     140      free(pffb);
    142141      return FALSE;
    143142    }
    144143    if (!rc) {
    145       ullCurDirBytes = pFFB->cbFile;
    146       ullCurDirBytes += CBLIST_TO_EASIZE(pFFB->cbList);
     144      ullCurDirBytes = pffb->cbFile;
     145      ullCurDirBytes += CBLIST_TO_EASIZE(pffb->cbList);
    147146    }
    148147    else
    149148      DosError(FERR_DISABLEHARDERR);
    150149    // fixme to not double free when pointers match
    151     pCI->pszLongname = pCI->pszFileName;
    152     pCI->rc.hptrIcon = hptrDir;
    153     *pCI->szDispAttr = 0;
    154     pCI->attrFile = 0;
    155     pCI->pszSubject = xstrdup(NullStr, pszSrcFile, __LINE__);
     150    pci->pszLongname = pci->pszFileName;
     151    pci->rc.hptrIcon = hptrDir;
     152    *pci->szDispAttr = 0;
     153    pci->attrFile = 0;
     154    pci->pszSubject = xstrdup(NullStr, pszSrcFile, __LINE__);
    156155  }
    157156  else {
    158     free(pFFB);
     157    free(pffb);
    159158    Dos_Error(MB_ENTER,
    160159              rc,
     
    166165
    167166  if (strlen(pszFileName) < 4 || top)
    168    pCI->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__);
     167   pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__);
    169168  else {
    170169    p = strrchr(pszFileName, '\\');
     
    174173      p++;
    175174    sp = (strchr(pszFileName, ' ') != NULL) ? "\"" : NullStr;
    176     pp = pCI->pszFileName;
     175    pp = pci->pszFileName;
    177176    if (*sp) {
    178177      *pp = *sp;
     
    184183      strcat(pp, sp);
    185184  }
    186   pCI->rc.pszIcon = pCI->pszLongname;
    187   pCI->rc.flRecordAttr |= CRA_RECORDREADONLY;
     185  pci->rc.pszIcon = pci->pszLongname;
     186  pci->rc.flRecordAttr |= CRA_RECORDREADONLY;
    188187  if (fForceUpper)
    189     strupr(pCI->pszFileName);
     188    strupr(pci->pszFileName);
    190189  else if (fForceLower)
    191     strlwr(pCI->pszFileName);
     190    strlwr(pci->pszFileName);
    192191  // fixme to work - code is hiding file name from container but... 23 Jul 07 SHL
    193   pCI->pszFileName = pCI->pszFileName + strlen(pCI->pszFileName);
     192  pci->pszFileName = pci->pszFileName + strlen(pci->pszFileName);
    194193  memset(&ri, 0, sizeof(RECORDINSERT));
    195194  ri.cb = sizeof(RECORDINSERT);
     
    199198  ri.cRecordsInsert = 1L;
    200199  ri.fInvalidateRecord = TRUE;
    201   if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pCI), MPFROMP(&ri))) {
    202     free(pFFB);
     200  if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
     201    free(pffb);
    203202    return FALSE;
    204203  }
     
    208207                    FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
    209208                    FILE_SYSTEM | FILE_HIDDEN | FILE_DIRECTORY,
    210                     pFFB, sizeof(FILEFINDBUF4), &nm, FIL_QUERYEASIZE);
     209                    pffb, sizeof(FILEFINDBUF4), &nm, FIL_QUERYEASIZE);
    211210  if (!rc) {
    212     register PBYTE fb = (PBYTE) pFFB;
     211    register PBYTE fb = (PBYTE) pffb;
    213212    FILEFINDBUF4 *pffbFile;
    214213    ULONG x;
     
    230229
    231230          if (!(pffbFile->attrFile & FILE_DIRECTORY))
    232             pCI->attrFile++;            // Bump file count
     231            pci->attrFile++;            // Bump file count
    233232          if (*pchStopFlag)
    234233            break;
     
    237236            strcpy(pEndMask, pffbFile->achName);        // Append dirname to base dirname
    238237            if (!*pchStopFlag) {
    239               ProcessDir(hwndCnr, maskstr, pCI, pchStopFlag, FALSE, &ull);
     238              ProcessDir(hwndCnr, maskstr, pci, pchStopFlag, FALSE, &ull);
    240239              ullSubDirBytes += ull;
    241240            }
     
    250249      DosSleep(0L);
    251250      nm = 1L;                          /* FilesToGet */
    252       rc = DosFindNext(hdir, pFFB, sizeof(FILEFINDBUF4), &nm);
     251      rc = DosFindNext(hdir, pffb, sizeof(FILEFINDBUF4), &nm);
    253252    }                                   // while more found
    254253    DosFindClose(hdir);
     
    256255  }
    257256
    258   free(pFFB);
    259 
    260   pCI->cbFile = ullCurDirBytes;
    261   pCI->easize = ullSubDirBytes;         // hack cough
    262   WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pCI),
     257  free(pffb);
     258
     259  pci->cbFile = ullCurDirBytes;
     260  pci->easize = ullSubDirBytes;         // hack cough
     261  WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pci),
    263262             MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    264263
     
    271270                           BOOL isroot)
    272271{
    273   PCNRITEM pCI = pciParent;
     272  PCNRITEM pci = pciParent;
    274273  SHORT attrib = CMA_FIRSTCHILD;
    275274
    276   if (pCI) {
     275  if (pci) {
    277276
    278277    float fltPct = 0.0;
     
    284283    // cbFile = currect directory usage in bytes
    285284    // easize = subdirectory usage in bytes
    286     CommaFmtULL(szCurDir, sizeof(szCurDir), pCI->cbFile, 'K');
     285    CommaFmtULL(szCurDir, sizeof(szCurDir), pci->cbFile, 'K');
    287286    *szBar = 0;
    288287
     
    295294
    296295        memset(&fsa, 0, sizeof(fsa));
    297         rc = DosQueryFSInfo(toupper(*pCI->pszFileName) - '@', FSIL_ALLOC, &fsa,
     296        rc = DosQueryFSInfo(toupper(*pci->pszFileName) - '@', FSIL_ALLOC, &fsa,
    298297                            sizeof(FSALLOCATE));
    299298        if (!rc) {
     
    302301        }
    303302        // Need unique buffer 23 Jul 07 SHL
    304         pCI->pszLongname = xmalloc(2, pszSrcFile, __LINE__);
    305         pCI->pszLongname[0] = 0;                // Make null string
    306         pCI->pszLongname[1] = 1;                // Flag root - hack cough
     303        pci->pszLongname = xmalloc(2, pszSrcFile, __LINE__);
     304        pci->pszLongname[0] = 0;                // Make null string
     305        pci->pszLongname[1] = 1;                // Flag root - hack cough
    307306      }
    308307      else
    309         fltPct = (((float)pCI->cbFile + pCI->easize) * 100.0) / ullTotalBytes;
     308        fltPct = (((float)pci->cbFile + pci->easize) * 100.0) / ullTotalBytes;
    310309
    311310      cBar = (UINT) fltPct / 2;
     
    321320    }
    322321
    323     pCI->flags = (ULONG) fltPct;
    324     CommaFmtULL(szSubDir, sizeof(szSubDir), pCI->easize, 'K');
    325     CommaFmtULL(szAllDir, sizeof(szAllDir), pCI->cbFile + pCI->easize, 'K');
    326     pCI->pszFileName = xrealloc(pCI->pszFileName, strlen(pCI->pszFileName) + 100,
     322    pci->flags = (ULONG) fltPct;
     323    CommaFmtULL(szSubDir, sizeof(szSubDir), pci->easize, 'K');
     324    CommaFmtULL(szAllDir, sizeof(szAllDir), pci->cbFile + pci->easize, 'K');
     325    pci->pszFileName = xrealloc(pci->pszFileName, strlen(pci->pszFileName) + 100,
    327326                                pszSrcFile,
    328327                                __LINE__);      // 23 Jul 07 SHL
    329     sprintf(pCI->pszFileName + strlen(pCI->pszFileName),
     328    sprintf(pci->pszFileName + strlen(pci->pszFileName),
    330329            "  %s + %s = %s (%.02lf%%%s)\r%s",
    331330            szCurDir,
     
    334333            fltPct, isroot ? GetPString(IDS_OFDRIVETEXT) : NullStr, szBar);
    335334    WinSendMsg(hwndCnr,
    336                CM_INVALIDATERECORD, MPFROMP(&pCI), MPFROM2SHORT(1, 0));
     335               CM_INVALIDATERECORD, MPFROMP(&pci), MPFROM2SHORT(1, 0));
    337336    isroot = FALSE;
    338337  }
    339338  else
    340339    attrib = CMA_FIRST;
    341   pCI = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pCI),
     340  pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
    342341                              MPFROM2SHORT(attrib, CMA_ITEMORDER));
    343   while (pCI && (INT) pCI != -1) {
     342  while (pci && (INT) pci != -1) {
    344343    if (*pchStopFlag)
    345344      break;
    346     FillInRecSizes(hwndCnr, pCI, ullTotalBytes, pchStopFlag, isroot);
     345    FillInRecSizes(hwndCnr, pci, ullTotalBytes, pchStopFlag, isroot);
    347346    isroot = FALSE;
    348     pCI = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pCI),
     347    pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
    349348                                MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    350349  }
     
    355354{
    356355  PCNRITEM pci;
    357   register CHAR *p;
     356  CHAR *p;
    358357
    359358  if (!pciParent) {
Note: See TracChangeset for help on using the changeset viewer.