Changeset 1683 for trunk/dll/comp.c


Ignore:
Timestamp:
Mar 7, 2013, 3:23:34 AM (12 years ago)
Author:
Steven Levine
Message:

ActionCnrThread: need to strdup pszFmtFileSize to avoid aliased pointers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/comp.c

    r1682 r1683  
    77
    88  Copyright (c) 1993-02 M. Kimes
    9   Copyright (c) 2003, 2012 Steven H. Levine
     9  Copyright (c) 2003, 2013 Steven H. Levine
    1010
    1111  16 Oct 02 MK Baseline
     
    8686  06 Jan 13 GKY Added optional confirmation dialogs for delete move and copy to compare dir Ticket 277
    8787  06 Jan 13 GKY Added EA compare option to compare dir Ticket 80
     88  06 Mar 13 SHL ActionCnrThread: need to strdup pszFmtFileSize to avoid aliased pointers
    8889
    8990***********************************************************************/
     
    242243      fp = xfopen(sf->filename, modew, pszSrcFile, __LINE__, FALSE);
    243244      if (fp) {
    244         fprintf(fp, "\"%s\"\n", sf->dirname);
    245         //DbgMsg(pszSrcFile, __LINE__, "recurse %i", sf->recurse);
     245        fprintf(fp, "\"%s\"\n", sf->dirname);
     246        //DbgMsg(pszSrcFile, __LINE__, "recurse %i", sf->recurse);
    246247        SnapShot(sf->dirname, fp, sf->recurse);
    247248        fclose(fp);
     
    479480  strcpy(mv.target, NewName);
    480481  rc = WinDlgBox(HWND_DESKTOP,
    481                  hwnd,
    482                  RenameProc,
    483                  FM3ModHandle, REN_FRAME, (PVOID) & mv);
     482                 hwnd,
     483                 RenameProc,
     484                 FM3ModHandle, REN_FRAME, (PVOID) & mv);
    484485  if (!rc)
    485486    return 1;
     
    568569                       MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    569570      pciD = WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPVOID,
    570                         MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
     571                        MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    571572      fConfirmAction =  WinQueryButtonCheckstate(cmp->hwnd, COMP_CONFIRMACTION);
    572573      InitITimer(&itdSleep, 500);       // Sleep every 500 mSec
     
    589590          // Source name not blank
    590591          switch (cmp->action) {
    591           case IDM_DELETE:
    592 
    593             if (fConfirmAction && !dontask) {
    594               ULONG   i;
    595               CHAR s[CCHMAXPATH + 20];
    596               MB2INFO *pmbInfo;     
    597               MB2D mb2dBut[NUM_BUT] =   //fixme to use GetPString
    598               {
    599                 { "Yes",                     1, 0},
    600                 { "Yes don't ask again",     2, 1},
    601                 { "No",                      3, 2},
    602                 { "Cancel delete operation", 4, 3}
    603               };
    604               ULONG   ulInfoSize = (sizeof(MB2INFO) + (sizeof(MB2D) * (NUM_BUT-1)));
    605               pmbInfo = malloc (ulInfoSize);
    606               if (pmbInfo) {
    607                 pmbInfo->cb         = ulInfoSize;       
    608                 pmbInfo->hIcon      = 0;
    609                 pmbInfo->cButtons   = NUM_BUT;           
    610                 pmbInfo->flStyle    = MB_MOVEABLE;
    611                 pmbInfo->hwndNotify = NULLHANDLE;
    612                 for (i = 0; i < NUM_BUT; i++) {
    613                   memcpy( pmbInfo->mb2d+i , mb2dBut+i , sizeof(MB2D));
    614                 } //fixme to use GetPString
    615                 sprintf(s, "Do you wish to delete %s", pciS->pszFileName);
    616                 rc = WinMessageBox2(HWND_DESKTOP, cmp->hwnd,
    617                                     s, "Confirm Delete", 1234,
    618                                     pmbInfo);
    619                 free(pmbInfo);
    620                 if (rc == 2 || rc == 3) {
    621                   if (rc == 3)
    622                     enddelete = TRUE;
    623                   break;
    624                 }
    625                 else if (rc == 1)
    626                   dontask = TRUE;
    627               }
    628             }
     592          case IDM_DELETE:
     593
     594            if (fConfirmAction && !dontask) {
     595              ULONG   i;
     596              CHAR s[CCHMAXPATH + 20];
     597              MB2INFO *pmbInfo;
     598              MB2D mb2dBut[NUM_BUT] =   //fixme to use GetPString
     599              {
     600                { "Yes",                     1, 0},
     601                { "Yes don't ask again",     2, 1},
     602                { "No",                      3, 2},
     603                { "Cancel delete operation", 4, 3}
     604              };
     605              ULONG   ulInfoSize = (sizeof(MB2INFO) + (sizeof(MB2D) * (NUM_BUT-1)));
     606              pmbInfo = malloc (ulInfoSize);
     607              if (pmbInfo) {
     608                pmbInfo->cb         = ulInfoSize;
     609                pmbInfo->hIcon      = 0;
     610                pmbInfo->cButtons   = NUM_BUT;
     611                pmbInfo->flStyle    = MB_MOVEABLE;
     612                pmbInfo->hwndNotify = NULLHANDLE;
     613                for (i = 0; i < NUM_BUT; i++) {
     614                  memcpy( pmbInfo->mb2d+i , mb2dBut+i , sizeof(MB2D));
     615                } //fixme to use GetPString
     616                sprintf(s, "Do you wish to delete %s", pciS->pszFileName);
     617                rc = WinMessageBox2(HWND_DESKTOP, cmp->hwnd,
     618                                    s, "Confirm Delete", 1234,
     619                                    pmbInfo);
     620                free(pmbInfo);
     621                if (rc == 2 || rc == 3) {
     622                  if (rc == 3)
     623                    enddelete = TRUE;
     624                  break;
     625                }
     626                else if (rc == 1)
     627                  dontask = TRUE;
     628              }
     629            }
    629630            if (!unlinkf(pciS->pszFileName)) {
    630631              WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
     
    685686                  MassMkdir(hwndMain, szDirName);
    686687              }
    687               if (fConfirmAction && pciS->flags & CNRITEM_EXISTS && !dontask) {
    688                 rc = ConfirmAction(cmp->hwnd, pciS->pszFileName, szNewName);
    689                 if (rc == 1)
    690                   break;
    691                 else if (rc == 2)
    692                   dontask = TRUE;
    693               }
     688              if (fConfirmAction && pciS->flags & CNRITEM_EXISTS && !dontask) {
     689                rc = ConfirmAction(cmp->hwnd, pciS->pszFileName, szNewName);
     690                if (rc == 1)
     691                  break;
     692                else if (rc == 2)
     693                  dontask = TRUE;
     694              }
    694695              rc = docopyf(MOVE, pciS->pszFileName, szNewName);
    695696              if (fResetVerify) {
     
    730731                pciD->crdate = pciS->crdate;
    731732                pciD->crtime = pciS->crtime;
    732                 pciD->pszFmtFileSize = pciS->pszFmtFileSize;
     733                // 2013-03-06 SHL
     734                if (pciS->pszFmtFileSize == NullStr)
     735                  pciD->pszFmtFileSize = pciS->pszFmtFileSize;
     736                else
     737                  pciD->pszFmtFileSize = strdup(pciS->pszFmtFileSize);
    733738                pciD->cbFile = pciS->cbFile;
    734739                pciD->easize = pciS->easize;
     
    793798                if (IsFile(szDirName) == -1)
    794799                  MassMkdir(hwndMain, szDirName);
    795               }
    796               if (fConfirmAction && pciS->flags & CNRITEM_EXISTS && !dontask) {
    797                 rc = ConfirmAction(cmp->hwnd, pciS->pszFileName, szNewName);
    798                 if (rc == 1)
    799                   break;
    800                 else if (rc == 2)
    801                   dontask = TRUE;
    802               }
    803               rc = docopyf(COPY, pciS->pszFileName, szNewName);
     800              }
     801              if (fConfirmAction && pciS->flags & CNRITEM_EXISTS && !dontask) {
     802                rc = ConfirmAction(cmp->hwnd, pciS->pszFileName, szNewName);
     803                if (rc == 1)
     804                  break;
     805                else if (rc == 2)
     806                  dontask = TRUE;
     807              }
     808              rc = docopyf(COPY, pciS->pszFileName, szNewName);
    804809              if (fResetVerify) {
    805810                DosSetVerify(fVerify);
     
    849854                pciD->latime = pciS->latime;
    850855                pciD->crdate = pciS->crdate;
    851                 pciD->crtime = pciS->crtime;
    852                 pciD->pszFmtFileSize = pciS->pszFmtFileSize;
     856                pciD->crtime = pciS->crtime;
     857                // 2013-03-06 SHL
     858                if (pciS->pszFmtFileSize == NullStr)
     859                  pciD->pszFmtFileSize = pciS->pszFmtFileSize;
     860                else
     861                  pciD->pszFmtFileSize = strdup(pciS->pszFmtFileSize);
    853862                pciD->cbFile = pciS->cbFile;
    854863                pciD->easize = pciS->easize;
     
    874883
    875884        } // if have name
    876         if (enddelete)
    877           break;
     885        if (enddelete)
     886          break;
    878887        pciS = pciNextS;
    879888        pciD = pciNextD;
     
    11321141                  ~pciS->flags & CNRITEM_LARGER &&
    11331142                  ~pciS->flags & CNRITEM_NEWER &&
    1134                   ~pciS->flags & CNRITEM_OLDER &&
    1135                   ~pciS->flags & CNRITEM_EASDIFFER;
     1143                  ~pciS->flags & CNRITEM_OLDER &&
     1144                  ~pciS->flags & CNRITEM_EASDIFFER;
    11361145        CompSelectSetSelects(pciS, pciDa[x], matched, matched, wantAnd);
    11371146      }
     
    11481157                  ~pciS->flags & CNRITEM_SMALLER &&
    11491158                  ~pciS->flags & CNRITEM_LARGER &&
    1150                   ~pciS->flags & CNRITEM_EASDIFFER;
     1159                  ~pciS->flags & CNRITEM_EASDIFFER;
    11511160        CompSelectSetSelects(pciS, pciDa[x], matched, matched, wantAnd);
    11521161      }
     
    13231332      if (~pciS->rc.flRecordAttr & CRA_FILTERED) {
    13241333        pciD = pciDa[x];
    1325         CompSelectSetSelects(pciS,
    1326                              pciD,
    1327                              pciS->flags & CNRITEM_EASDIFFER,
    1328                              pciD->flags & CNRITEM_EASDIFFER,
    1329                              wantAnd);
     1334        CompSelectSetSelects(pciS,
     1335                             pciD,
     1336                             pciS->flags & CNRITEM_EASDIFFER,
     1337                             pciD->flags & CNRITEM_EASDIFFER,
     1338                             wantAnd);
    13301339      }
    13311340      SleepIfNeeded(&itdSleep, 0);
     
    16831692          strupr(cmp->rightdir);
    16841693        FillDirList(cmp->rightdir, lenr, cmp->includesubdirs,
    1685                     &filesr, &cmp->cmp->totalright, &numallocr);
     1694                    &filesr, &cmp->cmp->totalright, &numallocr);
    16861695      }
    16871696      else {
     
    16901699        FILEFINDBUF4L fb4;
    16911700        CHAR str[CCHMAXPATH * 2], *p;
    1692         CHAR *moder = "r";
     1701        CHAR *moder = "r";
    16931702
    16941703        memset(&fb4, 0, sizeof(fb4));
    16951704        fp = xfopen(cmp->rightlist, moder, pszSrcFile, __LINE__, FALSE);
    1696         if (fp) {
     1705        if (fp) {
    16971706          while (!feof(fp)) {
    16981707            // First get name of directory
     
    17241733
    17251734          memset(&cnri, 0, sizeof(cnri));
    1726           cnri.cb = sizeof(cnri);
    1727           WinSetDlgItemText(cmp->hwnd, COMP_LISTLOADED, "List File Loaded");
     1735          cnri.cb = sizeof(cnri);
     1736          WinSetDlgItemText(cmp->hwnd, COMP_LISTLOADED, "List File Loaded");
    17281737          cnri.pszCnrTitle = cmp->rightdir;
    17291738          if (!WinSendMsg(hwndRight, CM_SETCNRINFO,
    17301739                     MPFROMP(&cnri), MPFROMLONG(CMA_CNRTITLE))) {
    1731             Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_SETCNRINFO");
    1732             WinSetDlgItemText(cmp->hwnd, COMP_LISTLOADED, "");
     1740            Win_Error(hwndRight, cmp->hwnd, pszSrcFile, __LINE__, "CM_SETCNRINFO");
     1741            WinSetDlgItemText(cmp->hwnd, COMP_LISTLOADED, "");
    17331742          }
    17341743
     
    17361745            lenr = strlen(cmp->rightdir);
    17371746            if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
    1738               lenr++;
    1739             //DbgMsg(pszSrcFile, __LINE__, "end of file %i", feof(fp));
    1740             while (!feof(fp)) {
     1747              lenr++;
     1748            //DbgMsg(pszSrcFile, __LINE__, "end of file %i", feof(fp));
     1749            while (!feof(fp)) {
    17411750              if (!xfgets_bstripcr
    1742                   (str, sizeof(str), fp, pszSrcFile, __LINE__)) {
    1743                 break;
    1744               }
     1751                  (str, sizeof(str), fp, pszSrcFile, __LINE__)) {
     1752                break;
     1753              }
    17451754              p = str;
    17461755              if (*p == '\"') {
     
    17481757                if (*p && *p != '\"') {
    17491758                  p = strchr(p, '\"');
    1750                   if (p) {
     1759                  if (p) {
    17511760                    *p = 0;
    17521761                    p++;
    1753                     if (*p == ',') {
     1762                    if (*p == ',') {
    17541763                      p++;
    17551764                      if (!cmp->includesubdirs && atol(p) > lenr)
    17561765                        continue;
    17571766                      p = strchr(p, ',');
    1758                       if (p) {
     1767                      if (p) {
    17591768                        p++;
    17601769                        fb4.cbFile = atoll(p);
    17611770                        p = strchr(p, ',');
    1762                         if (p) {
    1763                           p++;
    1764                           if (ulDateFmt == 2 || ulDateFmt == 3)
    1765                             fb4.fdateLastWrite.year = atol(p) - 1980;
    1766                           else if (ulDateFmt == 1)
    1767                             fb4.fdateLastWrite.day = atol(p);
    1768                           else
    1769                             fb4.fdateLastWrite.month = atol(p);
     1771                        if (p) {
     1772                          p++;
     1773                          if (ulDateFmt == 2 || ulDateFmt == 3)
     1774                            fb4.fdateLastWrite.year = atol(p) - 1980;
     1775                          else if (ulDateFmt == 1)
     1776                            fb4.fdateLastWrite.day = atol(p);
     1777                          else
     1778                            fb4.fdateLastWrite.month = atol(p);
    17701779                          p = strchr(p, DateSeparator[0]);
    1771                           if (p) {
    1772                             p++;
    1773                             if (ulDateFmt == 2 || ulDateFmt == 3)
    1774                               fb4.fdateLastWrite.month = atol(p);
    1775                             else
    1776                               fb4.fdateLastWrite.day = atol(p);
     1780                          if (p) {
     1781                            p++;
     1782                            if (ulDateFmt == 2 || ulDateFmt == 3)
     1783                              fb4.fdateLastWrite.month = atol(p);
     1784                            else
     1785                              fb4.fdateLastWrite.day = atol(p);
    17771786                            p = strchr(p, DateSeparator[0]);
    1778                             if (p) {
    1779                               p++;
    1780                               if (ulDateFmt == 2)
    1781                                 fb4.fdateLastWrite.day = atol(p);
    1782                               else if (ulDateFmt == 3)
    1783                                 fb4.fdateLastWrite.month = atol(p);
    1784                               else
    1785                                 fb4.fdateLastWrite.year = atol(p) - 1980;
     1787                            if (p) {
     1788                              p++;
     1789                              if (ulDateFmt == 2)
     1790                                fb4.fdateLastWrite.day = atol(p);
     1791                              else if (ulDateFmt == 3)
     1792                                fb4.fdateLastWrite.month = atol(p);
     1793                              else
     1794                                fb4.fdateLastWrite.year = atol(p) - 1980;
    17861795                              p = strchr(p, ',');
    1787                               if (p) {
     1796                              if (p) {
    17881797                                p++;
    17891798                                fb4.ftimeLastWrite.hours = atol(p);
    1790                                 p = strchr(p, TimeSeparator[0]);
    1791                                 if (p) {
     1799                                p = strchr(p, TimeSeparator[0]);
     1800                                if (p) {
    17921801                                  p++;
    17931802                                  fb4.ftimeLastWrite.minutes = atol(p);
    17941803                                  p = strchr(p, TimeSeparator[0]);
    1795                                   if (p) {
     1804                                  if (p) {
    17961805                                    p++;
    17971806                                    fb4.ftimeLastWrite.twosecs = atol(p);
    17981807                                    p = strchr(p, ',');
    1799                                     if (p) {
     1808                                    if (p) {
    18001809                                      p++;
    18011810                                      fb4.attrFile = atol(p);
    18021811                                      p = strchr(p, ',');
    1803                                       if (p) {
     1812                                      if (p) {
    18041813                                        p++;
    18051814                                        fb4.cbList = atol(p) * 2;
     
    18071816                                          strupr(str + 1);
    18081817                                        else if (fForceLower)
    1809                                           strlwr(str + 1);
     1818                                          strlwr(str + 1);
    18101819                                        if (AddToFileList((str + 1) + lenr,
    18111820                                                          &fb4,
     
    18291838            } // while
    18301839          } // if have rightdir
    1831           fclose(fp);
    1832         }
     1840          fclose(fp);
     1841        }
    18331842      } // if snapshot file
    18341843
    18351844      if (filesr)
    1836         qsort(filesr, cmp->cmp->totalright, sizeof(CHAR *), CompNames);
     1845        qsort(filesr, cmp->cmp->totalright, sizeof(CHAR *), CompNames);
    18371846
    18381847      // We now have two lists of files, both sorted.
     
    20482057              strcpy(pch, GetPString(IDS_SMALLERTEXT));
    20492058              pch += 7;
    2050             }
    2051             if (pcil->easize != pcir->easize) {
    2052               pcil->flags |= CNRITEM_EASDIFFER;
    2053               pcir->flags |= CNRITEM_EASDIFFER;
    2054               if (pch != szBuf) {
     2059            }
     2060            if (pcil->easize != pcir->easize) {
     2061              pcil->flags |= CNRITEM_EASDIFFER;
     2062              pcir->flags |= CNRITEM_EASDIFFER;
     2063              if (pch != szBuf) {
    20552064                strcpy(pch, ", ");
    20562065                pch += 2;
    20572066              }
    20582067              strcpy(pch, GetPString(IDS_EASDIFFERTEXT));
    2059               pch += 10;
    2060             }
     2068              pch += 10;
     2069            }
    20612070            ret = TestCDates(&pcir->date, &pcir->time,
    20622071                             &pcil->date, &pcil->time);
     
    23692378      SetCnrCols(GetHwndRight(hwnd), TRUE);
    23702379      if (cmp->listfile) {
    2371         CHAR fullname[CCHMAXPATH];
     2380        CHAR fullname[CCHMAXPATH];
    23722381
    23732382        strcpy(fullname, PCSZ_STARDOTPMD);
    23742383        if (insert_filename(HWND_DESKTOP, fullname, TRUE, FALSE) &&
    23752384            *fullname && !strchr(fullname, '*') && !strchr(fullname, '?'))
    2376           strcpy(cmp->rightlist, fullname);
     2385          strcpy(cmp->rightlist, fullname);
    23772386      }
    23782387      WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     
    23802389      PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID);
    23812390      {
    2382         USHORT ids[] = {COMP_FRAME, COMP_LEFTDIR, COMP_RIGHTDIR, COMP_COLLECT,
    2383                         COMP_VIEW, COMP_NOTE, COMP_TOTALLEFT, COMP_SELLEFT, COMP_TOTALRIGHT,
    2384                         COMP_SELRIGHT, COMP_CNRMENU, COMP_DIRMENU, COMP_MENU,
    2385                         COMP_INCLUDESUBDIRS, COMP_SETDIRS, COMP_COPYLEFT, COMP_MOVELEFT,
    2386                         COMP_DELETELEFT, COMP_COPYRIGHT, COMP_MOVERIGHT, COMP_DELETERIGHT,
    2387                         COMP_TOTALLEFTHDR, COMP_SELLEFTHDR, COMP_TOTALRIGHTHDR,
    2388                         COMP_SELRIGHTHDR, COMP_FILTER, COMP_HIDENOTSELECTED, 0};
     2391        USHORT ids[] = {COMP_FRAME, COMP_LEFTDIR, COMP_RIGHTDIR, COMP_COLLECT,
     2392                        COMP_VIEW, COMP_NOTE, COMP_TOTALLEFT, COMP_SELLEFT, COMP_TOTALRIGHT,
     2393                        COMP_SELRIGHT, COMP_CNRMENU, COMP_DIRMENU, COMP_MENU,
     2394                        COMP_INCLUDESUBDIRS, COMP_SETDIRS, COMP_COPYLEFT, COMP_MOVELEFT,
     2395                        COMP_DELETELEFT, COMP_COPYRIGHT, COMP_MOVERIGHT, COMP_DELETERIGHT,
     2396                        COMP_TOTALLEFTHDR, COMP_SELLEFTHDR, COMP_TOTALRIGHTHDR,
     2397                        COMP_SELRIGHTHDR, COMP_FILTER, COMP_HIDENOTSELECTED, 0};
    23892398        UINT x;
    2390         CHAR s[24];
     2399        CHAR s[24];
    23912400
    23922401        for (x = 0; ids[x]; x++) {
    2393           sprintf(s, "CompDir%i", ids[x]);
    2394           RestorePresParams(WinWindowFromID(hwnd, ids[x]), s);
     2402          sprintf(s, "CompDir%i", ids[x]);
     2403          RestorePresParams(WinWindowFromID(hwnd, ids[x]), s);
    23952404        }
    23962405      }
     
    28402849      CNRINFO cnri;
    28412850      if (cmp->includesubdirs)
    2842         WinCheckButton(hwnd, COMP_INCLUDESUBDIRS, TRUE);
     2851        WinCheckButton(hwnd, COMP_INCLUDESUBDIRS, TRUE);
    28432852      cmp->includesubdirs = WinQueryButtonCheckstate(hwnd,
    2844                                                      COMP_INCLUDESUBDIRS);
     2853                                                     COMP_INCLUDESUBDIRS);
    28452854      memset(&cnri, 0, sizeof(CNRINFO));
    28462855      cnri.cb = sizeof(CNRINFO);
     
    28502859                          CA_DETAILSVIEWTITLES | CA_OWNERDRAW;
    28512860      WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
    2852                         MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR));
     2861                        MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR));
    28532862      WinSetDlgItemText(hwnd, COMP_LISTLOADED, "");
    28542863      cnri.pszCnrTitle = cmp->rightdir;
     
    28812890          WinSetDlgItemText(hwnd, COMP_NOTE,
    28822891                            (CHAR *) GetPString(IDS_COMPHOLDREADDISKTEXT));
    2883           SetButtonEnables(cmp, FALSE);
    2884           cmp->includesubdirs = FALSE;
     2892          SetButtonEnables(cmp, FALSE);
     2893          cmp->includesubdirs = FALSE;
    28852894          cmp->selleft = 0;
    28862895          cmp->selright = 0;
     
    31933202              strcpy(sf->dirname, cmp->leftdir);
    31943203            else
    3195               strcpy(sf->dirname, cmp->rightdir);
    3196             sf->recurse = WinQueryButtonCheckstate(hwnd, COMP_INCLUDESUBDIRS);
    3197             //DbgMsg(pszSrcFile, __LINE__, "recurse %i %i", sf->recurse, cmp->includesubdirs);
     3204              strcpy(sf->dirname, cmp->rightdir);
     3205            sf->recurse = WinQueryButtonCheckstate(hwnd, COMP_INCLUDESUBDIRS);
     3206            //DbgMsg(pszSrcFile, __LINE__, "recurse %i %i", sf->recurse, cmp->includesubdirs);
    31983207            if (xbeginthread(StartSnapThread,
    31993208                             65536,
     
    32163225        wa.size = sizeof(wa);
    32173226        strcpy(wa.szCurrentPath1, cmp->leftdir);
    3218         strcpy(wa.szCurrentPath2, cmp->rightdir);
    3219         wa.includesubdirs = WinQueryButtonCheckstate(hwnd,
    3220                                                      COMP_INCLUDESUBDIRS);
     3227        strcpy(wa.szCurrentPath2, cmp->rightdir);
     3228        wa.includesubdirs = WinQueryButtonCheckstate(hwnd,
     3229                                                     COMP_INCLUDESUBDIRS);
    32213230        if (WinDlgBox(HWND_DESKTOP,
    32223231                      hwnd,
     
    32283237            !IsFile(wa.szCurrentPath2)) {
    32293238          strcpy(cmp->leftdir, wa.szCurrentPath1);
    3230           strcpy(cmp->rightdir, wa.szCurrentPath2);
    3231           cmp->includesubdirs = wa.includesubdirs;
    3232           if (!cmp->includesubdirs)
    3233             WinCheckButton(hwnd, COMP_INCLUDESUBDIRS, FALSE);
    3234           cmp->listfile = wa.listfile;
    3235           if (cmp->listfile) {
    3236             CHAR fullname[CCHMAXPATH];
    3237    
    3238             strcpy(fullname, PCSZ_STARDOTPMD);
    3239             if (insert_filename(HWND_DESKTOP, fullname, TRUE, FALSE) &&
    3240                 *fullname && !strchr(fullname, '*') && !strchr(fullname, '?'))
    3241               strcpy(cmp->rightlist, fullname);
    3242           }
    3243           else
    3244             *cmp->rightlist = 0;
     3239          strcpy(cmp->rightdir, wa.szCurrentPath2);
     3240          cmp->includesubdirs = wa.includesubdirs;
     3241          if (!cmp->includesubdirs)
     3242            WinCheckButton(hwnd, COMP_INCLUDESUBDIRS, FALSE);
     3243          cmp->listfile = wa.listfile;
     3244          if (cmp->listfile) {
     3245            CHAR fullname[CCHMAXPATH];
     3246
     3247            strcpy(fullname, PCSZ_STARDOTPMD);
     3248            if (insert_filename(HWND_DESKTOP, fullname, TRUE, FALSE) &&
     3249                *fullname && !strchr(fullname, '*') && !strchr(fullname, '?'))
     3250              strcpy(cmp->rightlist, fullname);
     3251          }
     3252          else
     3253            *cmp->rightlist = 0;
    32453254          PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    32463255          PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     
    33053314        SWP swp;
    33063315        ULONG size = sizeof(SWP);
    3307         USHORT ids[] = {COMP_FRAME, COMP_LEFTDIR, COMP_RIGHTDIR, COMP_COLLECT,
    3308                         COMP_VIEW, COMP_NOTE, COMP_TOTALLEFT, COMP_SELLEFT, COMP_TOTALRIGHT,
    3309                         COMP_SELRIGHT, COMP_CNRMENU, COMP_DIRMENU, COMP_MENU,
    3310                         COMP_INCLUDESUBDIRS, COMP_SETDIRS, COMP_COPYLEFT, COMP_MOVELEFT,
    3311                         COMP_DELETELEFT, COMP_COPYRIGHT, COMP_MOVERIGHT, COMP_DELETERIGHT,
    3312                         COMP_TOTALLEFTHDR, COMP_SELLEFTHDR, COMP_TOTALRIGHTHDR,
    3313                         COMP_SELRIGHTHDR, COMP_FILTER, COMP_HIDENOTSELECTED, 0};
    3314         UINT x;
    3315         CHAR s[24];
     3316        USHORT ids[] = {COMP_FRAME, COMP_LEFTDIR, COMP_RIGHTDIR, COMP_COLLECT,
     3317                        COMP_VIEW, COMP_NOTE, COMP_TOTALLEFT, COMP_SELLEFT, COMP_TOTALRIGHT,
     3318                        COMP_SELRIGHT, COMP_CNRMENU, COMP_DIRMENU, COMP_MENU,
     3319                        COMP_INCLUDESUBDIRS, COMP_SETDIRS, COMP_COPYLEFT, COMP_MOVELEFT,
     3320                        COMP_DELETELEFT, COMP_COPYRIGHT, COMP_MOVERIGHT, COMP_DELETERIGHT,
     3321                        COMP_TOTALLEFTHDR, COMP_SELLEFTHDR, COMP_TOTALRIGHTHDR,
     3322                        COMP_SELRIGHTHDR, COMP_FILTER, COMP_HIDENOTSELECTED, 0};
     3323        UINT x;
     3324        CHAR s[24];
    33163325        WinQueryWindowPos(hwnd, &swp);
    33173326        PrfWriteProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp,
    3318                             size);
     3327                            size);
    33193328        for (x = 0; ids[x]; x++) {
    3320           sprintf(s, "CompDir%i", ids[x]);
    3321           SavePresParams(WinWindowFromID(hwnd, ids[x]), s);
    3322         }
     3329          sprintf(s, "CompDir%i", ids[x]);
     3330          SavePresParams(WinWindowFromID(hwnd, ids[x]), s);
     3331        }
    33233332      }
    33243333      WinDismissDlg(hwnd, 0);
     
    33683377    case IDM_SELECTSAME:                // Name and size
    33693378    case IDM_INVERT:
    3370    
     3379
    33713380
    33723381      cmp = INSTDATA(hwnd);
Note: See TracChangeset for help on using the changeset viewer.