Changeset 897 for trunk/dll


Ignore:
Timestamp:
Dec 31, 2007, 12:34:00 AM (18 years ago)
Author:
Gregg Young
Message:

Use CommaFmtULL for additional file, EA etc sizes display; Modify/Create TestFDates & TestCDates for comparing/sorting files or CNRITEMS by date/time.

Location:
trunk/dll
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r888 r897  
    4848  26 Aug 07 GKY DosSleep(1) in loops changed to (0)
    4949  22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
     50  30 Dec 07 GKY Use TestCDates for sort by date
    5051
    5152***********************************************************************/
     
    269270
    270271    case SORT_LWDATE:
    271       ret = (pai1->date.year < pai2->date.year) ? 1 :
     272      ret = TestCDates(&pai1->date, &pai1->time,
     273                       &pai2->date, &pai2->time);
     274        /*(pai1->date.year < pai2->date.year) ? 1 :
    272275        (pai1->date.year > pai2->date.year) ? -1 :
    273276        (pai1->date.month < pai2->date.month) ? 1 :
     
    280283        (pai1->time.minutes > pai2->time.minutes) ? -1 :
    281284        (pai1->time.seconds < pai2->time.seconds) ? 1 :
    282         (pai1->time.seconds > pai2->time.seconds) ? -1 : 0;
     285        (pai1->time.seconds > pai2->time.seconds) ? -1 : 0;*/
    283286      break;
    284287
  • trunk/dll/autoview.c

    r872 r897  
    2222  27 Sep 07 SHL Correct ULONGLONG size formatting
    2323  22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
     24  30 Dec 07 GKY Use CommaFmtULL
    2425
    2526***********************************************************************/
     
    420421
    421422            static FILEFINDBUF4L ffb[130];
    422             CHAR fullname[CCHMAXPATH + 4];
     423            CHAR fullname[CCHMAXPATH + 4], szCmmaFmtFileSize[81];
    423424            HDIR hdir = HDIR_CREATE;
    424425            ULONG x, nm, ml, mc, bufflen;
     
    472473                          (pffbFile->achName[1] == '.' &&
    473474                           !pffbFile->achName[2]))))) {
    474                     // 27 Sep 07 SHL fixme to use CommaFmtULL
     475                    CommaFmtULL(szCmmaFmtFileSize,
     476                                sizeof(szCmmaFmtFileSize),
     477                                pffbFile->cbFile + CBLIST_TO_EASIZE(pffbFile->cbList),
     478                                ' ');
    475479                    sprintf(p,
    476                             "%s%-*.*s  %-8llu  [%s%s%s%s]  %04lu/%02lu/%02lu "
     480                            "%s%-*.*s  %-8s  [%s%s%s%s]  %04lu/%02lu/%02lu "
    477481                              "%02lu:%02lu:%02lu\r",
    478482                            pffbFile->attrFile & FILE_DIRECTORY ? "\\" : " ",
    479483                            ml,
    480484                            ml,
    481                             pffbFile->achName,
    482                             pffbFile->cbFile +
    483                               CBLIST_TO_EASIZE(pffbFile->cbList),
     485                            pffbFile->achName,
     486                            szCmmaFmtFileSize,
    484487                            pffbFile->attrFile & FILE_READONLY ? "R" : "-",
    485488                            pffbFile->attrFile & FILE_ARCHIVED ? "A" : "-",
  • trunk/dll/comp.c

    r888 r897  
    3939  26 Aug 07 GKY DosSleep(1) in loops changed to (0)
    4040  27 Sep 07 SHL Correct ULONGLONG size formatting
     41  30 Dec 07 GKY Use TestCDates for compare by file date/time
    4142
    4243***********************************************************************/
     
    931932      INT numallocl = 0;
    932933      INT numallocr = 0;
     934      INT ret = 0;
    933935      UINT lenl;                        // Directory prefix length
    934936      UINT lenr;
     
    12891291              strcpy(pch, GetPString(IDS_SMALLERTEXT));
    12901292              pch += 7;
    1291             }
    1292             if ((pcil->date.year > pcir->date.year) ? TRUE :
     1293            }
     1294            ret = TestCDates(&pcir->date, &pcir->time,
     1295                             &pcil->date, &pcil->time);
     1296            if (ret == 1)
     1297              /*((pcil->date.year > pcir->date.year) ? TRUE :
    12931298                (pcil->date.year < pcir->date.year) ? FALSE :
    12941299                (pcil->date.month > pcir->date.month) ? TRUE :
     
    13011306                (pcil->time.minutes < pcir->time.minutes) ? FALSE :
    13021307                (pcil->time.seconds > pcir->time.seconds) ? TRUE :
    1303                 (pcil->time.seconds < pcir->time.seconds) ? FALSE : FALSE) {
     1308                (pcil->time.seconds < pcir->time.seconds) ? FALSE : FALSE)*/ {
    13041309              pcil->flags |= CNRITEM_NEWER;
    13051310              pcir->flags |= CNRITEM_OLDER;
     
    13111316              pch += 5;
    13121317            }
    1313             else if ((pcil->date.year < pcir->date.year) ? TRUE :
     1318            else if (ret == -1)
     1319              /*((pcil->date.year < pcir->date.year) ? TRUE :
    13141320                     (pcil->date.year > pcir->date.year) ? FALSE :
    13151321                     (pcil->date.month < pcir->date.month) ? TRUE :
     
    13231329                     (pcil->time.seconds < pcir->time.seconds) ? TRUE :
    13241330                     (pcil->time.seconds > pcir->time.seconds) ? FALSE :
    1325                      FALSE) {
     1331                     FALSE)*/ {
    13261332              pcil->flags |= CNRITEM_OLDER;
    13271333              pcir->flags |= CNRITEM_NEWER;
  • trunk/dll/fm3dll.str

    r892 r897  
    843843Dropping here can change the icon of the object.
    844844FM/2: Drive flags (drive %c:)
    845 %llub + %lub EAs = %llub (%luk) total
     845%s + %s EAs = %s (%s) total
    846846PATH DPATH LIBPATH HELP BOOKSHELF LIB INCLUDE LOCPATH SMINCLUDE LPATH CODELPATH
    847847%%Environment%%
  • trunk/dll/info.c

    r850 r897  
    2323  25 Aug 07 SHL IconProc: do not use freed memory - random bad things happen
    2424  27 Sep 07 SHL Correct ULONGLONG size formatting
     25  30 Dec 07 GKY Use CommaFmtULL
    2526
    2627***********************************************************************/
     
    624625    if (pfs && *pfs->szFileName) {
    625626      CHAR s[97];
     627      CHAR szCmmaFmtFileSize[81], szCmmaFmtEASize[81];
     628      CHAR szCmmaFmtFileEASize[81], szCmmaFmtFileEASizeK[81];
    626629      FILEFINDBUF4L fs;
    627630      HDIR hdir = HDIR_CREATE;
     
    693696          WinSetDlgItemText(hwnd, FLE_LASTACCESS, s);
    694697        }
    695         // 27 Sep 07 SHL fixme to use CommaFmtULL
    696         // 27 Sep 07 SHL fixme to not format numbers in IDS_SIZEINCLEASTEXT
     698        CommaFmtULL(szCmmaFmtFileSize,
     699                    sizeof(szCmmaFmtFileSize), fs.cbFile, ' ');
     700        CommaFmtULL(szCmmaFmtEASize,
     701                    sizeof(szCmmaFmtEASize), CBLIST_TO_EASIZE(fs.cbList), ' ');
     702        CommaFmtULL(szCmmaFmtFileEASize,
     703                    sizeof(szCmmaFmtFileEASize),
     704                    fs.cbFile + CBLIST_TO_EASIZE(fs.cbList),
     705                    ' ');
     706        CommaFmtULL(szCmmaFmtFileEASizeK,
     707                    sizeof(szCmmaFmtFileEASizeK),
     708                    fs.cbFile + CBLIST_TO_EASIZE(fs.cbList),
     709                    'K');
    697710        sprintf(s,
    698711                GetPString(IDS_SIZEINCLEASTEXT),
    699                 fs.cbFile,
    700                 CBLIST_TO_EASIZE(fs.cbList),
    701                 fs.cbFile + CBLIST_TO_EASIZE(fs.cbList),
    702                 (ULONG)((fs.cbFile + CBLIST_TO_EASIZE(fs.cbList)) / 1024));
     712                szCmmaFmtFileSize,
     713                szCmmaFmtEASize,
     714                szCmmaFmtFileEASize,
     715                szCmmaFmtFileEASizeK);
    703716        WinSetDlgItemText(hwnd, FLE_SIZES, s);
    704         // 27 Sep 07 SHL fixme to use CommaFmtULL
    705         sprintf(s, "%llub", fs.cbFileAlloc - fs.cbFile);
     717        CommaFmtULL(szCmmaFmtFileSize,
     718                    sizeof(szCmmaFmtFileSize), fs.cbFileAlloc - fs.cbFile, ' ');
     719        sprintf(s, "%s", szCmmaFmtFileSize);
    706720        WinSetDlgItemText(hwnd, FLE_SLACK, s);
    707721        WinCheckButton(hwnd,
  • trunk/dll/rename.c

    r846 r897  
    1212  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1313  27 Sep 07 SHL Correct ULONGLONG size formatting
     14  30 Dec 07 GKY Use TestFDates for comparing dates
    1415
    1516***********************************************************************/
     
    7576
    7677        FILESTATUS3L fs1, fs2;
    77         CHAR s[CCHMAXPATH * 2], *p, chkname[CCHMAXPATH];
     78        CHAR s[CCHMAXPATH * 2], *p, chkname[CCHMAXPATH], szCmmaFmtFileSize[81];
    7879        INT sourceexists = 0, targetexists = 0,
    7980            sourcenewer = 0, sourcesmaller = 0;
     
    9091          WinSetDlgItemText(hwnd, REN_SOURCE, mv->source);
    9192        if (!DosQueryPathInfo(mv->source, FIL_STANDARDL, &fs1, sizeof(fs1))) {
    92           // 27 Sep 07 SHL fixme to use CommaFmtULL
     93          CommaFmtULL(szCmmaFmtFileSize,
     94                      sizeof(szCmmaFmtFileSize), fs1.cbFile, ' ');
    9395          sprintf(s,
    94                   " %s%llu %ss %04u/%02u/%02u %02u:%02u:%02u",
     96                  " %s%s %ss %04u/%02u/%02u %02u:%02u:%02u",
    9597                  fs1.attrFile & FILE_DIRECTORY ?
    9698                    GetPString(IDS_DIRBRKTTEXT) : NullStr,
    97                   fs1.cbFile,
     99                  szCmmaFmtFileSize,
    98100                  GetPString(IDS_BYTETEXT),
    99101                  fs1.fdateLastWrite.year + 1980,
     
    117119        }
    118120        if (!DosQueryPathInfo(chkname, FIL_STANDARDL, &fs2, sizeof(fs2))) {
    119           // 27 Sep 07 SHL fixme to use CommaFmtULL
     121          CommaFmtULL(szCmmaFmtFileSize,
     122                      sizeof(szCmmaFmtFileSize), fs2.cbFile, ' ');
    120123          sprintf(s,
    121                   " %s%llu %ss %04u/%02u/%02u %02u:%02u:%02u",
     124                  " %s%s %ss %04u/%02u/%02u %02u:%02u:%02u",
    122125                  fs2.attrFile & FILE_DIRECTORY ?
    123126                    GetPString(IDS_DIRBRKTTEXT) : NullStr,
    124                   fs2.cbFile,
     127                  szCmmaFmtFileSize,
    125128                  GetPString(IDS_BYTETEXT),
    126129                  fs2.fdateLastWrite.year + 1980,
     
    169172
    170173        if (targetexists == 1 && sourceexists == 1) {
    171           sourcenewer =
    172             (fs1.fdateLastWrite.year < fs2.fdateLastWrite.year) ? 1 :
    173               (fs1.fdateLastWrite.year > fs2.fdateLastWrite.year) ? -1 :
    174                (fs1.fdateLastWrite.month < fs2.fdateLastWrite.month) ? 1 :
    175                  (fs1.fdateLastWrite.month > fs2.fdateLastWrite.month) ? -1 :
    176                    (fs1.fdateLastWrite.day < fs2.fdateLastWrite.day) ? 1 :
    177                      (fs1.fdateLastWrite.day > fs2.fdateLastWrite.day) ? -1 :
    178                        (fs1.ftimeLastWrite.hours < fs2. ftimeLastWrite. hours) ? 1 :
    179                          (fs1.ftimeLastWrite.hours > fs2.ftimeLastWrite.hours) ? -1 :
    180                            (fs1.ftimeLastWrite.minutes < fs2.ftimeLastWrite.minutes) ? 1 :
    181                              (fs1.ftimeLastWrite.minutes > fs2.ftimeLastWrite.minutes) ? -1 :
    182                                (fs1.ftimeLastWrite.twosecs < fs2.ftimeLastWrite.twosecs) ? 1 :
    183                                  (fs1.ftimeLastWrite.twosecs > fs2.ftimeLastWrite.twosecs) ? -1 : 0;
     174          sourcenewer = TestFDates(NULL, NULL,
     175                                   &fs1.fdateLastWrite, &fs1.ftimeLastWrite,
     176                                   &fs2.fdateLastWrite, &fs2.ftimeLastWrite);
    184177          sourcesmaller = (fs1.cbFile < fs2.cbFile) ? -1 :
    185                           (fs1.cbFile > fs2.cbFile) ? 1 :
    186                           0;
     178                          (fs1.cbFile > fs2.cbFile) ? 1 : 0;
    187179          sprintf(&s[strlen(s)], GetPString(IDS_SOURCEISTEXT),
    188180                  (sourcenewer == -1) ? GetPString(IDS_NEWERTEXT) :
  • trunk/dll/saveclip.c

    r871 r897  
    2020  27 Sep 07 SHL Correct ULONGLONG size formatting
    2121  16 Nov 07 SHL Ensure fixup buffer sufficiently large
     22  30 Dec 07 GKY Use CommaFmtULL
    2223
    2324***********************************************************************/
     
    356357        PCNRITEM pci;
    357358        FILE *fp;
    358         CHAR *p, *pp, temp;
     359        CHAR *p, *pp, temp;
     360        CHAR szCmmaFmtFileSize[81];
    359361        INT attribute = CRA_CURSORED;
    360362        SHORT sSelect;
     
    453455                      break;
    454456                    case 'Z':
    455                       // 27 Sep 07 SHL fixme to use CommaFmtULL?
    456                       fprintf(fp, "%-13llu", pci->cbFile);
     457                      CommaFmtULL(szCmmaFmtFileSize,
     458                      sizeof(szCmmaFmtFileSize), pci->cbFile, ' ');
     459                      fprintf(fp, "%-13s", szCmmaFmtFileSize);
    457460                      break;
    458461                    case 'z':
    459                       // 27 Sep 07 SHL fixme to use CommaFmtULL?
    460                       fprintf(fp, "%llu", pci->cbFile);
     462                      CommaFmtULL(szCmmaFmtFileSize,
     463                      sizeof(szCmmaFmtFileSize), pci->cbFile, ' ');
     464                      fprintf(fp, "%s", szCmmaFmtFileSize);
    461465                      break;
    462466                    case 'E':
     
    848852                  PGEA2 pgea;
    849853                  PFEA2 pfea;
    850                   CHAR *value;
     854                  CHAR *value;
     855
    851856
    852857                  pgealist =
     
    887892                  if (*p == '%') {
    888893                    p++;
    889                     switch (*p) {
     894                    switch (*p) {
     895                      CHAR szCmmaFmtFileSize[81];
    890896                    case 's':
    891897                      fputs(subject, fp);
     
    895901                      break;
    896902                    case 'Z':
    897                       // 27 Sep 07 SHL fixme to use CommaFmtULL?
    898                       fprintf(fp, "%-13llu", ffb4.cbFile);
     903                      CommaFmtULL(szCmmaFmtFileSize,
     904                      sizeof(szCmmaFmtFileSize), ffb4.cbFile, ' ');
     905                      fprintf(fp, "%-13s", szCmmaFmtFileSize);
    899906                      break;
    900907                    case 'z':
    901                       // 27 Sep 07 SHL fixme to use CommaFmtULL?
    902                       fprintf(fp, "%llu", ffb4.cbFile);
     908                      CommaFmtULL(szCmmaFmtFileSize,
     909                      sizeof(szCmmaFmtFileSize), ffb4.cbFile, ' ');
     910                      fprintf(fp, "%s", szCmmaFmtFileSize);
    903911                      break;
    904912                    case 'E':
  • trunk/dll/seeall.c

    r888 r897  
    3131  26 Aug 07 GKY DosSleep(1) in loops changed to (0)
    3232  27 Sep 07 SHL Correct ULONGLONG size formatting
     33  30 Dec 07 GKY Use CommaFmtULL
     34  30 Dec 07 GKY Use TestFDates for comparing by date
    3335
    3436***********************************************************************/
     
    15721574  int ret;
    15731575
    1574   ret = (d1->date.year > d2->date.year) ? 1 :
     1576  ret = TestFDates(NULL, NULL,
     1577                  &d2->date, &d2->time,
     1578                  &d1->date, &d1->time);
     1579    /*(d1->date.year > d2->date.year) ? 1 :
    15751580    (d1->date.year < d2->date.year) ? -1 :
    15761581    (d1->date.month > d2->date.month) ? 1 :
     
    15831588    (d1->time.minutes < d2->time.minutes) ? -1 :
    15841589    (d1->time.twosecs > d2->time.twosecs) ? 1 :
    1585     (d1->time.twosecs < d2->time.twosecs) ? -1 : 0;
     1590    (d1->time.twosecs < d2->time.twosecs) ? -1 : 0;*/
    15861591
    15871592  if (!ret)
     
    22282233  ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER);
    22292234  POINTL ptl;
    2230   CHAR szBuff[CCHMAXPATH + 80];
     2235  CHAR szBuff[CCHMAXPATH + 80], szCmmaFmtFileSize[81];
    22312236  ULONG len, y;
    22322237
     
    22622267                    standardcolors[Colors[COLORS_NORMALBACK]]);
    22632268  }
    2264   // 27 Sep 07 SHL fixme to use CommaFmtULL
     2269  CommaFmtULL(szCmmaFmtFileSize,
     2270              sizeof(szCmmaFmtFileSize), ad->afindex[y]->cbFile, ' ');
    22652271  len = sprintf(szBuff,
    2266                 "%c%-*.*s  %-12llu  %c%c%c%c%c  %04u/%02u/%02u %02u:%02u:%02u ",
     2272                "%c%-*.*s  %-12s  %c%c%c%c%c  %04u/%02u/%02u %02u:%02u:%02u ",
    22672273                whichfile == ad->cursored - 1 ? '>' : ' ',
    22682274                ad->fullnames ? ad->longestw : ad->longest,
     
    22702276                ad->fullnames ? ad->afindex[y]->fullname :
    22712277                ad->afindex[y]->filename,
    2272                 ad->afindex[y]->cbFile,
     2278                szCmmaFmtFileSize,
    22732279                "-A"[((ad->afindex[y]->attrFile & FILE_ARCHIVED) != 0)],
    22742280                "-R"[((ad->afindex[y]->attrFile & FILE_READONLY) != 0)],
     
    33453351      register ULONG x;
    33463352      ULONG y, len, numlines;
    3347       CHAR szBuff[CCHMAXPATH + 80];
     3353      CHAR szBuff[CCHMAXPATH + 80], szCmmaFmtFileSize[81];
    33483354      BOOL inverted, hidsys, reado, wascursored;
    33493355
     
    34323438                              standardcolors[Colors
    34333439                                             [COLORS_CURSOREDNORMALBACK]]);
    3434             // 27 Sep 07 SHL fixme to use CommaFmtULL
     3440            CommaFmtULL(szCmmaFmtFileSize,
     3441                        sizeof(szCmmaFmtFileSize), pAD->afindex[y]->cbFile, ' ');
    34353442            len =
    34363443              sprintf(szBuff,
    3437                       "%c%-*.*s  %-12llu  %c%c%c%c%c  %04u/%02u/%02u %02u:%02u:%02u ",
     3444                      "%c%-*.*s  %-12s  %c%c%c%c%c  %04u/%02u/%02u %02u:%02u:%02u ",
    34383445                      wascursored ? '>' : ' ',
    34393446                      pAD->fullnames ? pAD->longestw : pAD->longest,
    34403447                      pAD->fullnames ? pAD->longestw : pAD->longest,
    34413448                      (pAD->fullnames) ? pAD->afindex[y]->fullname : pAD->
    3442                       afindex[y]->filename, pAD->afindex[y]->cbFile,
     3449                      afindex[y]->filename, szCmmaFmtFileSize,
    34433450                      "-A"[((pAD->afindex[y]->attrFile & FILE_ARCHIVED) !=
    34443451                            0)],
  • trunk/dll/select.c

    r847 r897  
    585585  BOOL slow = FALSE;
    586586  UINT x, numD, numS;
     587  INT ret = 0;
    587588
    588589  if (!hwndCnrS || !hwndCnrD) {
     
    701702        pciDa[x]->flags |= CNRITEM_LARGER;
    702703      }
    703       if ((pciSa[x]->date.year > pciDa[x]->date.year) ? TRUE :
     704      ret = TestCDates(&pciDa[x]->date, &pciDa[x]->time,
     705                       &pciSa[x]->date, &pciSa[x]->time);
     706      if (ret == 1)
     707        /*((pciSa[x]->date.year > pciDa[x]->date.year) ? TRUE :
    704708          (pciSa[x]->date.year < pciDa[x]->date.year) ? FALSE :
    705709          (pciSa[x]->date.month > pciDa[x]->date.month) ? TRUE :
     
    712716          (pciSa[x]->time.minutes < pciDa[x]->time.minutes) ? FALSE :
    713717          (pciSa[x]->time.seconds > pciDa[x]->time.seconds) ? TRUE :
    714           (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? FALSE : FALSE) {
     718          (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? FALSE : FALSE)*/ {
    715719        pciSa[x]->flags |= CNRITEM_NEWER;
    716720        pciDa[x]->flags |= CNRITEM_OLDER;
    717721      }
    718       else if ((pciSa[x]->date.year < pciDa[x]->date.year) ? TRUE :
     722      else if (ret == -1)
     723        /*((pciSa[x]->date.year < pciDa[x]->date.year) ? TRUE :
    719724               (pciSa[x]->date.year > pciDa[x]->date.year) ? FALSE :
    720725               (pciSa[x]->date.month < pciDa[x]->date.month) ? TRUE :
     
    728733               (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? TRUE :
    729734               (pciSa[x]->time.seconds > pciDa[x]->time.seconds) ? FALSE :
    730                FALSE) {
     735               FALSE)*/ {
    731736        pciSa[x]->flags |= CNRITEM_OLDER;
    732737        pciDa[x]->flags |= CNRITEM_NEWER;
     
    11871192  HENUM henum;
    11881193  HWND hwnd;
    1189   register INT numwindows = 0, w, x, z, cmp;
     1194  INT numwindows = 0, w, x, z, cmp = 0;
    11901195  struct Cnr *Cnrs = NULL;
    11911196  struct SS *bsres;
     
    12771282                bsres->pci->cbFile + bsres->pci->easize)
    12781283              Cnrs[z].ss[x].largest = FALSE;
    1279             cmp =
    1280               (Cnrs[z].ss[x].pci->date.year >
     1284            cmp = TestCDates(&bsres->pci->date, &bsres->pci->time,
     1285                             &Cnrs[z].ss[x].pci->date, &Cnrs[z].ss[x].pci->time);
     1286              /*(Cnrs[z].ss[x].pci->date.year >
    12811287               bsres->pci->date.year) ? TRUE : (Cnrs[z].ss[x].pci->date.year <
    12821288                                                bsres->pci->date.
     
    13111317                                                     seconds <
    13121318                                                     bsres->pci->time.
    1313                                                      seconds) ? FALSE : FALSE;
    1314             if (!cmp)
     1319                                                     seconds) ? FALSE : FALSE;*/
     1320            if (cmp != 1)
    13151321              Cnrs[z].ss[x].newest = FALSE;
    1316             cmp =
     1322            /*cmp =
    13171323              (Cnrs[z].ss[x].pci->date.year <
    13181324               bsres->pci->date.year) ? TRUE : (Cnrs[z].ss[x].pci->date.year >
     
    13481354                                                     seconds >
    13491355                                                     bsres->pci->time.
    1350                                                      seconds) ? FALSE : FALSE;
    1351             if (!cmp)
     1356                                                     seconds) ? FALSE : FALSE;*/
     1357            if (cmp != -1)
    13521358              Cnrs[z].ss[x].oldest = FALSE;
    13531359            cmp = 0;
  • trunk/dll/sortcnr.c

    r793 r897  
    142142
    143143    case SORT_LWDATE:
    144       ret = (pCI1->date.year < pCI2->date.year) ? 1 :
     144      ret =  TestCDates(&pCI1->date, &pCI1->time,
     145                        &pCI2->date, &pCI2->time);
     146        /*(pCI1->date.year < pCI2->date.year) ? 1 :
    145147        (pCI1->date.year > pCI2->date.year) ? -1 :
    146148        (pCI1->date.month < pCI2->date.month) ? 1 :
     
    153155        (pCI1->time.minutes > pCI2->time.minutes) ? -1 :
    154156        (pCI1->time.seconds < pCI2->time.seconds) ? 1 :
    155         (pCI1->time.seconds > pCI2->time.seconds) ? -1 : 0;
     157        (pCI1->time.seconds > pCI2->time.seconds) ? -1 : 0;*/
    156158      break;
    157159
    158160    case SORT_LADATE:
    159       ret = (pCI1->ladate.year < pCI2->ladate.year) ? 1 :
     161      ret = TestCDates(&pCI1->ladate, &pCI1->latime,
     162                       &pCI2->ladate, &pCI2->latime);
     163        /*(pCI1->ladate.year < pCI2->ladate.year) ? 1 :
    160164        (pCI1->ladate.year > pCI2->ladate.year) ? -1 :
    161165        (pCI1->ladate.month < pCI2->ladate.month) ? 1 :
     
    168172        (pCI1->latime.minutes > pCI2->latime.minutes) ? -1 :
    169173        (pCI1->latime.seconds < pCI2->latime.seconds) ? 1 :
    170         (pCI1->latime.seconds > pCI2->latime.seconds) ? -1 : 0;
     174        (pCI1->latime.seconds > pCI2->latime.seconds) ? -1 : 0;*/
    171175      break;
    172176
    173177    case SORT_CRDATE:
    174       ret = (pCI1->crdate.year < pCI2->crdate.year) ? 1 :
     178      ret = TestCDates(&pCI1->crdate, &pCI1->crtime,
     179                       &pCI2->crdate, &pCI2->crtime);
     180        /*(pCI1->crdate.year < pCI2->crdate.year) ? 1 :
    175181        (pCI1->crdate.year > pCI2->crdate.year) ? -1 :
    176182        (pCI1->crdate.month < pCI2->crdate.month) ? 1 :
     
    183189        (pCI1->crtime.minutes > pCI2->crtime.minutes) ? -1 :
    184190        (pCI1->crtime.seconds < pCI2->crtime.seconds) ? 1 :
    185         (pCI1->crtime.seconds > pCI2->crtime.seconds) ? -1 : 0;
     191        (pCI1->crtime.seconds > pCI2->crtime.seconds) ? -1 : 0;*/
    186192      break;
    187193    }
  • trunk/dll/valid.c

    r850 r897  
    2424  16 Jun 07 SHL Update for OpenWatcom
    2525  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     26  30 Dec 07 GKY Change TestDates to TestFDates can compare by filename or FDATE/FTIME data
     27  30 Dec 07 GKY Add TestCDates to compare CNRITEMs by CDATE/CTIME data
    2628
    2729***********************************************************************/
     
    7880}
    7981
    80 int TestDates(char *file1, char *file2)
     82int TestFDates(char *file1, char *file2, FDATE *datevar1, FTIME *timevar1,
     83               FDATE *datevar2, FTIME *timevar2)
     84{
     85  /*
     86   * return 1 (file2 newer than file1),
     87   * 0 (files same)
     88   * or -1 (file1 newer than file2)
     89   * Make the FILSTATUS pointers NULL if passing file names
     90   * if the FILESTATUS information is already available it can be passed instead
     91   * Make the files NULL if passing FILESTATUS buffers
     92   */
     93
     94  int comp = 0;
     95  FILESTATUS3 fs3o, fs3n;
     96
     97  if (file1){
     98    DosError(FERR_DISABLEHARDERR);
     99    DosQueryPathInfo(file1, FIL_STANDARD, &fs3o, sizeof(fs3o));
     100    datevar1 = &fs3o.fdateLastWrite;
     101    timevar1 = &fs3o.ftimeLastWrite;
     102  }
     103  if (file2) {
     104    DosError(FERR_DISABLEHARDERR);
     105    DosQueryPathInfo(file2, FIL_STANDARD, &fs3n, sizeof(fs3n));
     106    datevar2 = &fs3n.fdateLastWrite;
     107    timevar2 = &fs3n.ftimeLastWrite;
     108  }
     109  if (&datevar1 && &datevar2 && &timevar1 && &timevar2) {
     110    comp = (datevar2->year >
     111            datevar1->year) ? 1 :
     112      (datevar2->year <
     113       datevar1->year) ? -1 :
     114      (datevar2->month >
     115       datevar1->month) ? 1 :
     116      (datevar2->month <
     117       datevar1->month) ? -1 :
     118      (datevar2->day >
     119       datevar1->day) ? 1 :
     120      (datevar2->day <
     121       datevar1->day) ? -1 :
     122      (timevar2->hours >
     123       timevar1->hours) ? 1 :
     124      (timevar2->hours <
     125       timevar1->hours) ? -1 :
     126      (timevar2->minutes >
     127       timevar1->minutes) ? 1 :
     128      (timevar2->minutes <
     129       timevar1->minutes) ? -1 :
     130      (timevar2->twosecs >
     131       timevar1->twosecs) ? 1 :
     132    (timevar2->twosecs < timevar1->twosecs) ? -1 : 0;
     133  }
     134    return comp;
     135}
     136
     137int TestCDates(CDATE *datevar1, CTIME *timevar1,
     138               CDATE *datevar2, CTIME *timevar2)
    81139{
    82140  /*
     
    87145
    88146  int comp = 0;
    89   FILESTATUS3 fs3o, fs3n;
    90 
    91   DosError(FERR_DISABLEHARDERR);
    92   if (!DosQueryPathInfo(file1, FIL_STANDARD, &fs3o, sizeof(fs3o))) {
    93     DosError(FERR_DISABLEHARDERR);
    94     if (!DosQueryPathInfo(file2, FIL_STANDARD, &fs3n, sizeof(fs3n))) {
    95       comp = (fs3n.fdateLastWrite.year >
    96               fs3o.fdateLastWrite.year) ? 1 :
    97         (fs3n.fdateLastWrite.year <
    98          fs3o.fdateLastWrite.year) ? -1 :
    99         (fs3n.fdateLastWrite.month >
    100          fs3o.fdateLastWrite.month) ? 1 :
    101         (fs3n.fdateLastWrite.month <
    102          fs3o.fdateLastWrite.month) ? -1 :
    103         (fs3n.fdateLastWrite.day >
    104          fs3o.fdateLastWrite.day) ? 1 :
    105         (fs3n.fdateLastWrite.day <
    106          fs3o.fdateLastWrite.day) ? -1 :
    107         (fs3n.ftimeLastWrite.hours >
    108          fs3o.ftimeLastWrite.hours) ? 1 :
    109         (fs3n.ftimeLastWrite.hours <
    110          fs3o.ftimeLastWrite.hours) ? -1 :
    111         (fs3n.ftimeLastWrite.minutes >
    112          fs3o.ftimeLastWrite.minutes) ? 1 :
    113         (fs3n.ftimeLastWrite.minutes <
    114          fs3o.ftimeLastWrite.minutes) ? -1 :
    115         (fs3n.ftimeLastWrite.twosecs >
    116          fs3o.ftimeLastWrite.twosecs) ? 1 :
    117         (fs3n.ftimeLastWrite.twosecs < fs3o.ftimeLastWrite.twosecs) ? -1 : 0;
    118     }
    119   }
    120   return comp;
     147
     148  if (&datevar1 && &datevar2 && &timevar1 && &timevar2) {
     149    comp = (datevar2->year >
     150            datevar1->year) ? 1 :
     151      (datevar2->year <
     152       datevar1->year) ? -1 :
     153      (datevar2->month >
     154       datevar1->month) ? 1 :
     155      (datevar2->month <
     156       datevar1->month) ? -1 :
     157      (datevar2->day >
     158       datevar1->day) ? 1 :
     159      (datevar2->day <
     160       datevar1->day) ? -1 :
     161      (timevar2->hours >
     162       timevar1->hours) ? 1 :
     163      (timevar2->hours <
     164       timevar1->hours) ? -1 :
     165      (timevar2->minutes >
     166       timevar1->minutes) ? 1 :
     167      (timevar2->minutes <
     168       timevar1->minutes) ? -1 :
     169      (timevar2->seconds >
     170       timevar1->seconds) ? 1 :
     171    (timevar2->seconds < timevar1->seconds) ? -1 : 0;
     172  }
     173    return comp;
    121174}
    122175
     
    125178  /* return TRUE if file2 is newer than file1 */
    126179
    127   return (TestDates(file1, file2) > 0);
     180  return (TestFDates(file1, file2, NULL, NULL, NULL, NULL) > 0);
    128181}
    129182
     
    941994#pragma alloc_text(VALID,CheckDrive,IsRoot,IsFile,IsFullName,needsquoting)
    942995#pragma alloc_text(VALID,IsValidDir,IsValidDrive,MakeValidDir,IsVowel)
    943 #pragma alloc_text(VALID,IsFileSame,IsNewer,TestDates,RootName,MakeFullName)
     996#pragma alloc_text(VALID,IsFileSame,IsNewer,TestFDates,TestCDates,RootName,MakeFullName)
    944997#pragma alloc_text(VALID,IsExecutable,IsBinary,IsDesktop,ParentIsDesktop)
    945998#pragma alloc_text(FILLFLAGS,FillInDriveFlags,assign_ignores)
Note: See TracChangeset for help on using the changeset viewer.