Changeset 897 for trunk/dll/rename.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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) :
Note: See TracChangeset for help on using the changeset viewer.