Changeset 943


Ignore:
Timestamp:
Feb 10, 2008, 7:39:00 PM (18 years ago)
Author:
Gregg Young
Message:

Rename some varibles to make code easier to follow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/seeall.c

    r907 r943  
    115115  ALLFILES *afhead;
    116116  ALLFILES **afindex;
    117   ULONG affiles;
     117  ULONG afheadcnt;
    118118  ULONG afalloc;
    119119  ULONG longest;
     
    123123  ULONG selected;
    124124  ULONGLONG ullSelectedBytes;
    125   ULONG afifiles;
     125  ULONG afindexcnt;
    126126  ULONG lastselected;
    127127  ULONG lastdirection;
     
    11851185       mask.attrFile != pAD->mask.attrFile ||
    11861186       mask.antiattr != pAD->mask.antiattr)) {
    1187     for (x = 0; x < pAD->afifiles; x++) {
    1188       y = (pAD->invertsort) ? (pAD->afifiles - 1) - x : x;
     1187    for (x = 0; x < pAD->afindexcnt; x++) {
     1188      y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
    11891189      ret = FALSE;
    11901190      if (mask.pszMasks[1]) {
     
    12971297  register ULONG x;
    12981298
    1299   if (ad->afhead && ad->affiles) {
    1300     for (x = 0; x < ad->affiles; x++) {
     1299  if (ad->afhead && ad->afheadcnt) {
     1300    for (x = 0; x < ad->afheadcnt; x++) {
    13011301      if (ad->afhead[x].fullname)
    13021302        free(ad->afhead[x].fullname);
     
    13091309  }
    13101310  DosPostEventSem(CompactSem);
    1311   ad->afalloc = ad->afifiles = ad->affiles = ad->longest = ad->longestw =
     1311  ad->afalloc = ad->afindexcnt = ad->afheadcnt = ad->longest = ad->longestw =
    13121312    ad->maxx = ad->horzscroll = 0;
    13131313}
     
    13251325
    13261326  if (ad->selected) {
    1327     for (x = 0; x < ad->afifiles; x++) {
    1328       y = (ad->invertsort) ? (ad->afifiles - 1) - x : x;
     1327    for (x = 0; x < ad->afindexcnt; x++) {
     1328      y = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x;
    13291329      if (ad->afindex[y]->flags & AF_SELECTED) {
    13301330        error = AddToList(ad->afindex[y]->fullname, &list,
     
    13501350  BOOL didone = FALSE;
    13511351
    1352   for (x = 0; x < pAD->afifiles; x++) {
    1353     y = (pAD->invertsort) ? (pAD->afifiles - 1) - x : x;
     1352  for (x = 0; x < pAD->afindexcnt; x++) {
     1353    y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
    13541354    if (list) {
    13551355      ret = FALSE;
     
    14171417    for (z = 0; list[z] && !ad->stopflag; z++) {
    14181418      ret = FALSE;
    1419       for (x = 0; x < ad->affiles; x++) {
     1419      for (x = 0; x < ad->afheadcnt; x++) {
    14201420        if (!stricmp(list[z], ad->afhead[x].fullname)) {
    14211421          ret = TRUE;
     
    14541454          DosFindClose(hdir);
    14551455          if (!(ffb.attrFile & FILE_DIRECTORY)) {
    1456             if (!ad->afalloc || ad->affiles > ad->afalloc - 1) {
     1456            if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) {
    14571457
    14581458              ALLFILES *temp, **templ;
     
    14801480              }
    14811481            }
    1482             ad->afhead[ad->affiles].fullname =
     1482            ad->afhead[ad->afheadcnt].fullname =
    14831483              xstrdup(list[z], pszSrcFile, __LINE__);
    1484             if (ad->afhead[ad->affiles].fullname) {
    1485               p = strrchr(ad->afhead[ad->affiles].fullname, '\\');
     1484            if (ad->afhead[ad->afheadcnt].fullname) {
     1485              p = strrchr(ad->afhead[ad->afheadcnt].fullname, '\\');
    14861486              if (!p)
    1487                 p = ad->afhead[ad->affiles].fullname;
     1487                p = ad->afhead[ad->afheadcnt].fullname;
    14881488              else
    14891489                p++;
    1490               ad->afhead[ad->affiles].filename = p;
    1491               ad->afhead[ad->affiles].cbFile = ffb.cbFile;
    1492               ad->afhead[ad->affiles].date = ffb.fdateLastWrite;
    1493               ad->afhead[ad->affiles].time = ffb.ftimeLastWrite;
    1494               ad->afhead[ad->affiles].attrFile = (USHORT) ffb.attrFile;
    1495               ad->afhead[ad->affiles].flags = 0;
    1496               if (ad->longest < strlen(ad->afhead[ad->affiles].filename))
    1497                 ad->longest = strlen(ad->afhead[ad->affiles].filename);
    1498               if (ad->longestw < strlen(ad->afhead[ad->affiles].fullname))
    1499                 ad->longestw = strlen(ad->afhead[ad->affiles].fullname);
    1500 
    1501               ad->affiles++;
     1490              ad->afhead[ad->afheadcnt].filename = p;
     1491              ad->afhead[ad->afheadcnt].cbFile = ffb.cbFile;
     1492              ad->afhead[ad->afheadcnt].date = ffb.fdateLastWrite;
     1493              ad->afhead[ad->afheadcnt].time = ffb.ftimeLastWrite;
     1494              ad->afhead[ad->afheadcnt].attrFile = (USHORT) ffb.attrFile;
     1495              ad->afhead[ad->afheadcnt].flags = 0;
     1496              if (ad->longest < strlen(ad->afhead[ad->afheadcnt].filename))
     1497                ad->longest = strlen(ad->afhead[ad->afheadcnt].filename);
     1498              if (ad->longestw < strlen(ad->afhead[ad->afheadcnt].fullname))
     1499                ad->longestw = strlen(ad->afhead[ad->afheadcnt].fullname);
     1500
     1501              ad->afheadcnt++;
    15021502            }
    15031503            else {
     
    16051605  pAD->selected = 0;
    16061606  pAD->ullSelectedBytes = 0;
    1607   for (x = 0, y = 0; x < pAD->affiles; x++) {
     1607  for (x = 0, y = 0; x < pAD->afheadcnt; x++) {
    16081608    if (!(pAD->afhead[x].flags & (AF_DELETED | AF_FILTERED))) {
    16091609      if (pAD->afhead[x].flags & AF_SELECTED) {
     
    16141614    }
    16151615  }                                     // for x
    1616   pAD->afifiles = y;
     1616  pAD->afindexcnt = y;
    16171617  PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
    1618   if (!pAD->stopflag && pAD->pfnCompare && pAD->afifiles) {
     1618  if (!pAD->stopflag && pAD->pfnCompare && pAD->afindexcnt) {
    16191619    WinSendMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID);
    1620     qsort(pAD->afindex, pAD->afifiles, sizeof(ALLFILES *), pAD->pfnCompare);
     1620    qsort(pAD->afindex, pAD->afindexcnt, sizeof(ALLFILES *), pAD->pfnCompare);
    16211621  }
    16221622}
     
    16411641        WinCancelShutdown(hmq2, TRUE);
    16421642        IncrThreadUsage();
    1643         if (ad->cursored <= ad->afifiles) {
    1644           for (x = 0; x < ad->affiles; x++)
     1643        if (ad->cursored <= ad->afindexcnt) {
     1644          for (x = 0; x < ad->afheadcnt; x++)
    16451645            ad->afhead[x].flags &= (~(AF_DUPE | AF_SELECTED));
    16461646          DosSleep(0);  //26 Aug 07 GKY 1
    1647           for (x = 0; x < ad->affiles && !ad->stopflag; x++) {
     1647          for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) {
    16481648            if (!(ad->afhead[x].flags & (AF_DUPE | AF_FILTERED))) {
    16491649              if (!(x % 50)) {
    16501650                sprintf(s,
    1651                         GetPString(IDS_DUPECHECKINGOFTEXT), x, ad->affiles);
     1651                        GetPString(IDS_DUPECHECKINGOFTEXT), x, ad->afheadcnt);
    16521652                WinSetWindowText(ad->hwndStatus, s);
    16531653              }
    1654               for (z = 0; z < ad->affiles && !ad->stopflag; z++) {
     1654              for (z = 0; z < ad->afheadcnt && !ad->stopflag; z++) {
    16551655                if (x != z &&
    16561656                    !(ad->afhead[z].flags & (AF_DUPE | AF_FILTERED)))
     
    17241724            }
    17251725          } // for
    1726           for (x = 0; x < ad->affiles && !ad->stopflag; x++) {
     1726          for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) {
    17271727            if (!(ad->afhead[x].flags & AF_DUPE))
    17281728              ad->afhead[x].flags |= AF_FILTERED;
     
    17531753  CHAR *p;
    17541754
    1755   if (ad->cursored <= ad->afifiles) {
     1755  if (ad->cursored <= ad->afindexcnt) {
    17561756    x = ad->cursored - 1;
    1757     x = (ad->invertsort) ? (ad->afifiles - 1) - x : x;
     1757    x = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x;
    17581758    p = strrchr(ad->afindex[x]->filename, '.');
    17591759    if (p) {
     
    17661766  if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
    17671767                FM3ModHandle, MSK_FRAME, MPFROMP(&ad->mask))) {
    1768     for (x = 0; x < ad->affiles; x++) {
     1768    for (x = 0; x < ad->afheadcnt; x++) {
    17691769      ret = FALSE;
    17701770      if (ad->mask.pszMasks[1]) {
     
    18361836{
    18371837  ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER);
    1838   ULONG oldaffiles = pAD->affiles;
     1838  ULONG oldafheadcnt = pAD->afheadcnt;
    18391839  register ULONG x, y;
    18401840
    1841   for (x = 0; x < pAD->affiles; x++) {
     1841  for (x = 0; x < pAD->afheadcnt; x++) {
    18421842    if (pAD->afhead[x].flags & AF_DELETED) {
    1843       for (y = x; y < pAD->affiles; y++) {
     1843      for (y = x; y < pAD->afheadcnt; y++) {
    18441844        if (~pAD->afhead[y].flags & AF_DELETED)
    18451845          break;
     
    18521852      }
    18531853      memmove(&(pAD->afhead[x]), &(pAD->afhead[y]),
    1854               (pAD->affiles - y) * sizeof(ALLFILES));
    1855       pAD->affiles -= (y - x);
     1854              (pAD->afheadcnt - y) * sizeof(ALLFILES));
     1855      pAD->afheadcnt -= (y - x);
    18561856    }
    18571857  }                                     // for x
    1858   if (pAD->affiles != oldaffiles) {
     1858  if (pAD->afheadcnt != oldafheadcnt) {
    18591859
    18601860    ALLFILES *tempa, **templ;
    18611861
    1862     if (!pAD->affiles)
     1862    if (!pAD->afheadcnt)
    18631863      FreeAllFilesList(hwnd);
    18641864    else {
    18651865      tempa =
    1866         xrealloc(pAD->afhead, pAD->affiles * sizeof(ALLFILES), pszSrcFile,
     1866        xrealloc(pAD->afhead, pAD->afheadcnt * sizeof(ALLFILES), pszSrcFile,
    18671867                 __LINE__);
    18681868      if (tempa) {
    18691869        pAD->afhead = tempa;
    1870         pAD->afalloc = pAD->affiles;
     1870        pAD->afalloc = pAD->afheadcnt;
    18711871      }
    18721872      templ =
    1873         xrealloc(pAD->afindex, pAD->affiles * sizeof(ALLFILES *), pszSrcFile,
     1873        xrealloc(pAD->afindex, pAD->afheadcnt * sizeof(ALLFILES *), pszSrcFile,
    18741874                 __LINE__);
    18751875      if (templ)
     
    18791879    }
    18801880  }
    1881   return pAD->affiles;
     1881  return pAD->afheadcnt;
    18821882}
    18831883
     
    19421942          *enddir = 0;
    19431943          strcpy(enddir, pffbFile->achName);
    1944           if (!ad->afalloc || ad->affiles > ad->afalloc - 1) {
     1944          if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) {
    19451945
    19461946            ALLFILES *temp;
     
    19591959            }
    19601960          }
    1961           ad->afhead[ad->affiles].fullname =
     1961          ad->afhead[ad->afheadcnt].fullname =
    19621962            xstrdup(filename, pszSrcFile, __LINE__);
    1963           if (!ad->afhead[ad->affiles].fullname) {
     1963          if (!ad->afhead[ad->afheadcnt].fullname) {
    19641964            ad->stopflag = 1;
    19651965            break;
    19661966          }
    19671967          else {
    1968             ad->afhead[ad->affiles].filename =
    1969               ad->afhead[ad->affiles].fullname + (enddir - filename);
    1970             ad->afhead[ad->affiles].cbFile = pffbFile->cbFile;
    1971             ad->afhead[ad->affiles].date = pffbFile->fdateLastWrite;
    1972             ad->afhead[ad->affiles].time = pffbFile->ftimeLastWrite;
    1973             ad->afhead[ad->affiles].attrFile = (USHORT) pffbFile->attrFile;
    1974             ad->afhead[ad->affiles].flags = 0;
    1975             ad->affiles++;
     1968            ad->afhead[ad->afheadcnt].filename =
     1969              ad->afhead[ad->afheadcnt].fullname + (enddir - filename);
     1970            ad->afhead[ad->afheadcnt].cbFile = pffbFile->cbFile;
     1971            ad->afhead[ad->afheadcnt].date = pffbFile->fdateLastWrite;
     1972            ad->afhead[ad->afheadcnt].time = pffbFile->ftimeLastWrite;
     1973            ad->afhead[ad->afheadcnt].attrFile = (USHORT) pffbFile->attrFile;
     1974            ad->afhead[ad->afheadcnt].flags = 0;
     1975            ad->afheadcnt++;
    19761976            if (ad->longest < pffbFile->cchName)
    19771977              ad->longest = pffbFile->cchName;
     
    20382038      }
    20392039    }
    2040     if (ad->afalloc != ad->affiles) {
     2040    if (ad->afalloc != ad->afheadcnt) {
    20412041
    20422042      ALLFILES *tempa, **templ;
    20432043
    20442044      tempa =
    2045         xrealloc(ad->afhead, sizeof(ALLFILES) * ad->affiles, pszSrcFile,
     2045        xrealloc(ad->afhead, sizeof(ALLFILES) * ad->afheadcnt, pszSrcFile,
    20462046                 __LINE__);
    20472047      if (tempa) {
    20482048        ad->afhead = tempa;
    2049         ad->afalloc = ad->affiles;
     2049        ad->afalloc = ad->afheadcnt;
    20502050      }
    20512051      templ =
    2052         xrealloc(ad->afindex, sizeof(ALLFILES *) * ad->affiles, pszSrcFile,
     2052        xrealloc(ad->afindex, sizeof(ALLFILES *) * ad->afheadcnt, pszSrcFile,
    20532053                 __LINE__);
    20542054      if (templ)
     
    22302230  ULONG len, y;
    22312231
    2232   y = (ad->invertsort) ? (ad->afifiles - 1) - whichfile : whichfile;
     2232  y = (ad->invertsort) ? (ad->afindexcnt - 1) - whichfile : whichfile;
    22332233  ptl.y = (Rectl->yTop -
    22342234           (ad->lMaxHeight * (((whichfile + 1) - topfile) + 1)));
    22352235  ptl.x = ad->horzscroll;
    2236   if (ptl.y < Rectl->yBottom || ptl.y > Rectl->yTop || y > ad->afifiles)
     2236  if (ptl.y < Rectl->yBottom || ptl.y > Rectl->yTop || y > ad->afindexcnt)
    22372237    return;
    22382238  GpiSetBackMix(hps, BM_OVERPAINT);
     
    26352635// fprintf(stderr,"Seeall: UM_SETUP3\n");
    26362636    if (pAD) {
    2637       pAD->multiplier = pAD->afifiles / 32767;
    2638       if (pAD->multiplier * 32767 != pAD->afifiles)
     2637      pAD->multiplier = pAD->afindexcnt / 32767;
     2638      if (pAD->multiplier * 32767 != pAD->afindexcnt)
    26392639        pAD->multiplier++;
    26402640      if (!pAD->multiplier)
     
    26522652          WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE,
    26532653                     MPFROM2SHORT((SHORT) numlines,
    2654                                   (SHORT) min(pAD->afifiles, 32767)),
    2655                      MPFROM2SHORT(1, pAD->afifiles + 1));
     2654                                  (SHORT) min(pAD->afindexcnt, 32767)),
     2655                     MPFROM2SHORT(1, pAD->afindexcnt + 1));
    26562656          WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR,
    26572657                     MPFROMSHORT((SHORT) abs(pAD->horzscroll)),
     
    26602660                     MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)),
    26612661                     MPFROM2SHORT(1,
    2662                                   (SHORT) (pAD->afifiles / pAD->multiplier) -
     2662                                  (SHORT) (pAD->afindexcnt / pAD->multiplier) -
    26632663                                  (numlines - 1)));
    2664           if (pAD->afifiles - pAD->topfile < numlines) {
    2665             pAD->topfile = ((pAD->afifiles - pAD->topfile) - numlines);
     2664          if (pAD->afindexcnt - pAD->topfile < numlines) {
     2665            pAD->topfile = ((pAD->afindexcnt - pAD->topfile) - numlines);
    26662666            WinInvalidateRect(hwnd, NULL, FALSE);
    26672667          }
     
    26872687        if (mp1) {
    26882688          strcpy(s, GetPString(IDS_SORTINGTEXT));
    2689           if (pAD->afifiles) {
    2690             commafmt(tm, sizeof(tm), pAD->afifiles);
     2689          if (pAD->afindexcnt) {
     2690            commafmt(tm, sizeof(tm), pAD->afindexcnt);
    26912691            strcat(s, tm);
    26922692          }
     
    26942694        else {
    26952695          strcpy(s, GetPString(IDS_WORKINGTEXT));
    2696           if (pAD->affiles) {
    2697             commafmt(tm, sizeof(tm), pAD->affiles);
     2696          if (pAD->afheadcnt) {
     2697            commafmt(tm, sizeof(tm), pAD->afheadcnt);
    26982698            strcat(s, tm);
    26992699          }
     
    27112711        if (mp1) {
    27122712          strcpy(s, GetPString(IDS_SORTINGTEXT));
    2713           if (pAD->afifiles) {
    2714             commafmt(tm, sizeof(tm), pAD->afifiles);
     2713          if (pAD->afindexcnt) {
     2714            commafmt(tm, sizeof(tm), pAD->afindexcnt);
    27152715            strcat(s, tm);
    27162716          }
     
    27202720          }
    27212721        }
    2722         else if (pAD->afifiles) {
    2723           y = (pAD->invertsort) ? (pAD->afifiles - 1) - (pAD->cursored - 1) :
     2722        else if (pAD->afindexcnt) {
     2723          y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - (pAD->cursored - 1) :
    27242724            pAD->cursored - 1;
    2725           commafmt(tm, sizeof(tm), pAD->afifiles);
     2725          commafmt(tm, sizeof(tm), pAD->afindexcnt);
    27262726          commafmt(ts, sizeof(ts), pAD->selected);
    27272727          CommaFmtULL(tb, sizeof(tb), pAD->ullSelectedBytes, ' ');
     
    27302730                  tm,
    27312731                  GetPString(IDS_FILETEXT),
    2732                   &"s"[pAD->afifiles == 1],
     2732                  &"s"[pAD->afindexcnt == 1],
    27332733                  (*pAD->mask.szMask ||
    27342734                   (pAD->mask.attrFile & (~FILE_DIRECTORY)) !=
     
    28312831            break;
    28322832          case VK_DOWN:
    2833             if (pAD->cursored < pAD->afifiles
     2833            if (pAD->cursored < pAD->afindexcnt
    28342834                && pAD->cursored < pAD->topfile + numlines) {
    28352835              if (shiftstate & KC_SHIFT)
     
    28602860            if ((shiftstate & KC_CTRL) ||
    28612861                pAD->cursored == (pAD->topfile - 1) + numlines) {
    2862               pAD->cursored = pAD->afifiles;
    2863               pAD->topfile = (pAD->afifiles + 1) - numlines;
    2864               if (pAD->topfile > pAD->afifiles)
     2862              pAD->cursored = pAD->afindexcnt;
     2863              pAD->topfile = (pAD->afindexcnt + 1) - numlines;
     2864              if (pAD->topfile > pAD->afindexcnt)
    28652865                pAD->topfile = 1;
    28662866              WinInvalidateRect(hwnd, NULL, FALSE);
     
    28682868            else {
    28692869              pAD->cursored = (pAD->topfile - 1) + numlines;
    2870               if (pAD->cursored > pAD->afifiles)
    2871                 pAD->cursored = pAD->afifiles;
     2870              if (pAD->cursored > pAD->afindexcnt)
     2871                pAD->cursored = pAD->afindexcnt;
    28722872              PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile,
    28732873                        &rcl);
     
    29382938            pAD->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
    29392939            pAD->szCommonName[len + 1] = 0;
    2940             for (x = pAD->cursored - (len > 0); x < pAD->afifiles; x++) {
    2941               y = (pAD->invertsort) ? (pAD->afifiles - 1) - x : x;
     2940            for (x = pAD->cursored - (len > 0); x < pAD->afindexcnt; x++) {
     2941              y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
    29422942              if (pAD->fullnames) {
    29432943                if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName,
     
    29572957            if (!found) {
    29582958              for (x = 0; x < pAD->cursored - (len > 0); x++) {
    2959                 y = (pAD->invertsort) ? (pAD->afifiles - 1) - x : x;
     2959                y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
    29602960                if (pAD->fullnames) {
    29612961                  if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName,
     
    29892989                    pAD->topfile = 1;
    29902990                  else if (pAD->cursored >
    2991                            (pAD->afifiles + 1) - (numlines / 2))
    2992                     pAD->topfile = (pAD->afifiles + 1) - numlines;
     2991                           (pAD->afindexcnt + 1) - (numlines / 2))
     2992                    pAD->topfile = (pAD->afindexcnt + 1) - numlines;
    29932993                  else
    29942994                    pAD->topfile = pAD->cursored - (numlines / 2);
     
    30763076          whichfile = numlines - 1;
    30773077        whichfile += (pAD->topfile - 1);
    3078         y = (pAD->invertsort) ? (pAD->afifiles - 1) - whichfile : whichfile;
    3079         if (y < pAD->afifiles && pAD->lastselected != whichfile) {
     3078        y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile;
     3079        if (y < pAD->afindexcnt && pAD->lastselected != whichfile) {
    30803080          if (pAD->lastselected != (ULONG) - 1) {
    30813081            inc = (pAD->lastselected < whichfile) ? 1 : -1;
    30823082            for (x = pAD->lastselected + inc;
    3083                  x != whichfile && x < pAD->afifiles;
     3083                 x != whichfile && x < pAD->afindexcnt;
    30843084                 (pAD->lastselected < whichfile) ? x++ : x--) {
    3085               y = (pAD->invertsort) ? (pAD->afifiles - 1) - x : x;
     3085              y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
    30863086              if (pAD->afindex[y]->flags & AF_SELECTED) {
    30873087                pAD->afindex[y]->flags &= ~AF_SELECTED;
     
    31553155      POINTS pts;
    31563156
    3157       if (pAD->afifiles) {
     3157      if (pAD->afindexcnt) {
    31583158        WinQueryWindowRect(hwnd, &Rectl);
    31593159        numlines = NumLines(&Rectl, pAD);
     
    31663166            whichfile = numlines - 1;
    31673167          whichfile += (pAD->topfile - 1);
    3168           if (whichfile + 1 > pAD->afifiles)
     3168          if (whichfile + 1 > pAD->afindexcnt)
    31693169            break;
    3170           y = (pAD->invertsort) ? (pAD->afifiles - 1) - whichfile : whichfile;
     3170          y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile;
    31713171          wascursored = pAD->cursored;
    31723172          pAD->cursored = whichfile + 1;
    31733173          if (pAD->cursored != wascursored)
    31743174            PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &Rectl);
    3175           if (y < pAD->afifiles) {
     3175          if (y < pAD->afindexcnt) {
    31763176            if (msg == WM_BUTTON1CLICK || fUnHilite) {
    31773177              if (pAD->afindex[y]->flags & AF_SELECTED) {
     
    32893289                          (rc == 0 && pAD->selected != 0));
    32903290        WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTALL,
    3291                           (rc == 0 && pAD->afifiles != 0));
     3291                          (rc == 0 && pAD->afindexcnt != 0));
    32923292        WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTMASK,
    3293                           (rc == 0 && pAD->afifiles != 0));
     3293                          (rc == 0 && pAD->afindexcnt != 0));
    32943294        WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTALL,
    3295                           (rc == 0 && pAD->afifiles != 0));
     3295                          (rc == 0 && pAD->afindexcnt != 0));
    32963296        WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTMASK,
    3297                           (rc == 0 && pAD->afifiles != 0));
     3297                          (rc == 0 && pAD->afindexcnt != 0));
    32983298        WinEnableMenuItem(pAD->hwndPopup, IDM_INVERT,
    3299                           (rc == 0 && pAD->afifiles != 0));
     3299                          (rc == 0 && pAD->afindexcnt != 0));
    33003300        WinEnableMenuItem(pAD->hwndPopup, IDM_FILTER,
    3301                           (rc == 0 && pAD->affiles != 0));
     3301                          (rc == 0 && pAD->afheadcnt != 0));
    33023302        if (!rc)
    33033303          DosReleaseMutexSem(pAD->hmtxScan);
     
    33173317      pAD->cursored = 1;
    33183318      pAD->multiplier = 1;
    3319       if (!pAD->afifiles) {
     3319      if (!pAD->afindexcnt) {
    33203320        DosBeep(250, 50);
    33213321        PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     
    33543354        WinQueryWindowRect(hwnd, &Rectl);
    33553355        numlines = NumLines(&Rectl, pAD);
    3356         if (pAD->afifiles && numlines) {
    3357           if (pAD->topfile > (pAD->afifiles + 1) - numlines)
    3358             pAD->topfile = (pAD->afifiles + 1) - numlines;
    3359           if (pAD->topfile > pAD->afifiles)
     3356        if (pAD->afindexcnt && numlines) {
     3357          if (pAD->topfile > (pAD->afindexcnt + 1) - numlines)
     3358            pAD->topfile = (pAD->afindexcnt + 1) - numlines;
     3359          if (pAD->topfile > pAD->afindexcnt)
    33603360            pAD->topfile = 1;
    33613361          if (!pAD->topfile)
     
    33653365          else if (pAD->cursored > (pAD->topfile + numlines) - 1)
    33663366            pAD->cursored = (pAD->topfile + numlines) - 1;
    3367           if (pAD->cursored > pAD->afifiles)
    3368             pAD->cursored = pAD->afifiles;
     3367          if (pAD->cursored > pAD->afindexcnt)
     3368            pAD->cursored = pAD->afindexcnt;
    33693369        }
    33703370        else
    33713371          pAD->topfile = pAD->cursored = 1;
    3372         if (numlines && pAD->afifiles) {
     3372        if (numlines && pAD->afindexcnt) {
    33733373          GpiSetBackMix(hpsp, BM_OVERPAINT);
    33743374          wascursored = TRUE;
    3375           for (x = pAD->topfile - 1; x < pAD->afifiles; x++) {
     3375          for (x = pAD->topfile - 1; x < pAD->afindexcnt; x++) {
    33763376            ptl.x = pAD->horzscroll;
    33773377            if (wascursored) {          /* reestablish normal colors */
     
    33843384            if (x == pAD->cursored - 1)
    33853385              wascursored = TRUE;
    3386             y = (pAD->invertsort) ? (pAD->afifiles - 1) - x : x;
     3386            y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x;
    33873387            ptl.y = (Rectl.yTop -
    33883388                     (pAD->lMaxHeight * (((x + 1) - pAD->topfile) + 1)));
     
    34723472                   MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)),
    34733473                   MPFROM2SHORT(1,
    3474                                 (SHORT) (pAD->afifiles / pAD->multiplier) -
     3474                                (SHORT) (pAD->afindexcnt / pAD->multiplier) -
    34753475                                (numlines - 1)));
    34763476      WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR,
     
    35423542      RECTL rcl;
    35433543
    3544       if (pAD->afifiles) {
     3544      if (pAD->afindexcnt) {
    35453545        WinQueryWindowRect(hwnd, &rcl);
    35463546        numlines = NumLines(&rcl, pAD);
     
    35513551            if (pAD->topfile > 1) {
    35523552              pAD->topfile -= numlines;
    3553               if (pAD->topfile > pAD->afifiles ||
    3554                   pAD->topfile > (pAD->afifiles + 1) - numlines)
     3553              if (pAD->topfile > pAD->afindexcnt ||
     3554                  pAD->topfile > (pAD->afindexcnt + 1) - numlines)
    35553555                pAD->topfile = 1;
    35563556              if (pAD->cursored > pAD->topfile + numlines)
    35573557                pAD->cursored = pAD->topfile + numlines;
    3558               if (pAD->cursored > pAD->afifiles)
    3559                 pAD->cursored = pAD->afifiles;
     3558              if (pAD->cursored > pAD->afindexcnt)
     3559                pAD->cursored = pAD->afindexcnt;
    35603560              WinInvalidateRect(hwnd, NULL, FALSE);
    35613561            }
    35623562            break;
    35633563          case SB_PAGEDOWN:
    3564             if (pAD->topfile <= pAD->afifiles - numlines) {
     3564            if (pAD->topfile <= pAD->afindexcnt - numlines) {
    35653565              pAD->topfile += numlines;
    3566               if (pAD->topfile > (pAD->afifiles + 1) - numlines)
    3567                 pAD->topfile = (pAD->afifiles + 1) - numlines;
     3566              if (pAD->topfile > (pAD->afindexcnt + 1) - numlines)
     3567                pAD->topfile = (pAD->afindexcnt + 1) - numlines;
    35683568              if (pAD->cursored < pAD->topfile)
    35693569                pAD->cursored = pAD->topfile;
    35703570              if (pAD->cursored > (pAD->topfile + numlines) - 1)
    35713571                pAD->cursored = (pAD->topfile + numlines) - 1;
    3572               if (pAD->cursored > pAD->afifiles)
    3573                 pAD->cursored = pAD->afifiles;
     3572              if (pAD->cursored > pAD->afindexcnt)
     3573                pAD->cursored = pAD->afindexcnt;
    35743574              WinInvalidateRect(hwnd, NULL, FALSE);
    35753575            }
    35763576            break;
    35773577          case SB_LINEDOWN:
    3578             if (pAD->topfile <= pAD->afifiles - numlines) {
     3578            if (pAD->topfile <= pAD->afindexcnt - numlines) {
    35793579
    35803580              RECTL Rectl, iRectl;
     
    35853585              else if (pAD->cursored > (pAD->topfile + numlines) - 1)
    35863586                pAD->cursored = (pAD->topfile + numlines) - 1;
    3587               if (pAD->cursored > pAD->afifiles)
    3588                 pAD->cursored = pAD->afifiles;
     3587              if (pAD->cursored > pAD->afindexcnt)
     3588                pAD->cursored = pAD->afindexcnt;
    35893589              WinQueryWindowRect(hwnd, &Rectl);
    35903590              WinScrollWindow(hwnd, 0, pAD->lMaxHeight,
     
    36103610                         MPFROMSHORT((SHORT) (pAD->topfile /
    36113611                                              pAD->multiplier)),
    3612                          MPFROM2SHORT(1, (SHORT) (pAD->afifiles /
     3612                         MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt /
    36133613                                                  pAD->multiplier) -
    36143614                                      (numlines - 1)));
     
    36253625              else if (pAD->cursored > (pAD->topfile + numlines) - 1)
    36263626                pAD->cursored = (pAD->topfile + numlines) - 1;
    3627               if (pAD->cursored > pAD->afifiles)
    3628                 pAD->cursored = pAD->afifiles;
     3627              if (pAD->cursored > pAD->afindexcnt)
     3628                pAD->cursored = pAD->afindexcnt;
    36293629              WinQueryWindowRect(hwnd, &Rectl);
    36303630              WinScrollWindow(hwnd, 0, -pAD->lMaxHeight,
     
    36543654                         MPFROMSHORT((SHORT) (pAD->topfile /
    36553655                                              pAD->multiplier)),
    3656                          MPFROM2SHORT(1, (SHORT) (pAD->afifiles /
     3656                         MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt /
    36573657                                                  pAD->multiplier) -
    36583658                                      (numlines - 1)));
     
    36613661          case SB_SLIDERTRACK:
    36623662            if ((SHORT1FROMMP(mp2) >= 1) ||
    3663                 (SHORT1FROMMP(mp2)) <= pAD->afifiles) {
     3663                (SHORT1FROMMP(mp2)) <= pAD->afindexcnt) {
    36643664              pAD->topfile = (ULONG) SHORT1FROMMP(mp2) * pAD->multiplier;
    3665               if (pAD->topfile > (pAD->afifiles + 1) - numlines)
    3666                 pAD->topfile = (pAD->afifiles + 1) - numlines;
     3665              if (pAD->topfile > (pAD->afindexcnt + 1) - numlines)
     3666                pAD->topfile = (pAD->afindexcnt + 1) - numlines;
    36673667              if (!pAD->topfile)
    36683668                pAD->topfile = 1;
     
    36713671              else if (pAD->cursored > pAD->topfile + numlines)
    36723672                pAD->cursored = pAD->topfile + numlines;
    3673               if (pAD->cursored > pAD->afifiles)
    3674                 pAD->cursored = pAD->afifiles;
     3673              if (pAD->cursored > pAD->afindexcnt)
     3674                pAD->cursored = pAD->afindexcnt;
    36753675              WinInvalidateRect(hwnd, NULL, FALSE);
    36763676            }
     
    37463746          rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN);
    37473747          WinEnableMenuItem((HWND) mp2, IDM_SELECTALL, (rc == 0 &&
    3748                                                         pAD->afifiles != 0 &&
    3749                                                         (pAD->afifiles !=
     3748                                                        pAD->afindexcnt != 0 &&
     3749                                                        (pAD->afindexcnt !=
    37503750                                                         pAD->selected ||
    37513751                                                         !pAD->selected)));
    37523752          WinEnableMenuItem((HWND) mp2, IDM_SELECTMASK, (rc == 0 &&
    3753                                                          pAD->afifiles != 0 &&
    3754                                                          (pAD->afifiles !=
     3753                                                         pAD->afindexcnt != 0 &&
     3754                                                         (pAD->afindexcnt !=
    37553755                                                          pAD->selected ||
    37563756                                                          !pAD->selected)));
    37573757          WinEnableMenuItem((HWND) mp2, IDM_DESELECTALL, (rc == 0 &&
    3758                                                           pAD->afifiles != 0
     3758                                                          pAD->afindexcnt != 0
    37593759                                                          && pAD->selected));
    37603760          WinEnableMenuItem((HWND) mp2, IDM_DESELECTMASK,
    3761                             (rc == 0 && pAD->afifiles != 0) && pAD->selected);
     3761                            (rc == 0 && pAD->afindexcnt != 0) && pAD->selected);
    37623762          WinEnableMenuItem((HWND) mp2, IDM_INVERT,
    3763                             (rc == 0 && pAD->afifiles != 0));
     3763                            (rc == 0 && pAD->afindexcnt != 0));
    37643764          if (!rc)
    37653765            DosReleaseMutexSem(pAD->hmtxScan);
     
    38033803          WinEnableMenuItem((HWND) mp2, IDM_RESCAN, (rc == 0));
    38043804          WinEnableMenuItem((HWND) mp2, IDM_FILTER, (rc == 0 &&
    3805                                                      pAD->affiles != 0));
     3805                                                     pAD->afheadcnt != 0));
    38063806          if (!rc)
    38073807            DosReleaseMutexSem(pAD->hmtxScan);
Note: See TracChangeset for help on using the changeset viewer.