Changeset 157


Ignore:
Timestamp:
May 26, 2005, 4:18:54 AM (20 years ago)
Author:
root
Message:

Rework for CNRITEM.szSubject
Rework with ULONGLONG

Location:
trunk/dll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/comp.c

    r145 r157  
    77
    88  Copyright (c) 1993-02 M. Kimes
    9   Copyright (c) 2003, 2005 Steven H.Levine
     9  Copyright (c) 2003, 2005 Steven H. Levine
    1010
    1111  16 Oct 02 MK Baseline
     
    1313  01 Aug 04 SHL Rework lstrip/rstrip usage
    1414  24 May 05 SHL Rework Win_Error usage
     15  24 May 05 SHL Rework for CNRITEM.szSubject
     16  25 May 05 SHL Rework with ULONGLONG
    1517
    1618***********************************************************************/
     
    1921#define INCL_WIN
    2022#define INCL_GPI
    21 
     23#define INCL_LONGLONG
    2224#include <os2.h>
     25
    2326#include <stdio.h>
    2427#include <stdlib.h>
     
    2730#include <share.h>
    2831#include <io.h>
     32
    2933#include "fm3dll.h"
    3034#include "fm3dlg.h"
     
    4448
    4549
    46 void SnapShot (char *path,FILE *fp,BOOL recurse) {
    47 
     50void SnapShot (char *path,FILE *fp,BOOL recurse)
     51{
    4852  FILEFINDBUF4 *fb;
    4953  char         *mask,*enddir;
     
    472476                pciO->cbFile     = pci->cbFile;
    473477                pciO->easize     = pci->easize;
    474                 *pciO->subject  = 0;
     478                *pciO->szSubject = 0;
    475479                *pci->szFileName = 0;
    476480                pci->pszFileName = pci->szFileName;
     
    543547                pciO->cbFile     = pci->cbFile;
    544548                pciO->easize     = pci->easize;
    545                 *pci->subject    = 0;
     549                *pci->szSubject  = 0;
    546550                pci->flags       = CNRITEM_EXISTS;
    547551                WinSendMsg(hwndCnrS,CM_INVALIDATERECORD,MPFROMP(&pci),
     
    9991003          pcir->rc.pszIcon = pcir->pszFileName;
    10001004          pcir->rc.hptrIcon = (HPOINTER)0;
    1001           pcir->pszSubject = pcir->subject;
    1002           pcir->pszLongname = pcir->Longname;
     1005          pcir->pszSubject = pcir->szSubject;
     1006          pcir->pszLongname = pcir->szLongname;
    10031007          pcir->pszDispAttr = pcir->szDispAttr;
    10041008          pcil->hwndCnr = hwndLeft;
     
    10071011          pcil->rc.hptrIcon = (HPOINTER)0;
    10081012          pcil->pszDispAttr = pcil->szDispAttr;
    1009           pcil->pszSubject = pcil->subject;
    1010           pcil->pszLongname = pcil->Longname;
     1013          pcil->pszSubject = pcil->szSubject;
     1014          pcil->pszLongname = pcil->szLongname;
    10111015          if((filesl && filesl[l]) && (filesr && filesr[r])) {
    10121016            x = stricmp(filesl[l]->fname,filesr[r]->fname);
     
    10151019                      (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ?
    10161020                      NullStr : "\\",filesl[l]->fname);
    1017 //              pcil->rc.hptrIcon    = hptrFile;
     1021              // pcil->rc.hptrIcon    = hptrFile;
    10181022              pcil->pszFileName    = pcil->szFileName + lenl;
    10191023              pcil->attrFile       = filesl[l]->attrFile;
     
    10841088              pcil->flags |= CNRITEM_EXISTS;
    10851089              pcir->flags |= CNRITEM_EXISTS;
    1086               cl = pcil->subject;
     1090              cl = pcil->szSubject;
    10871091              if(pcil->cbFile + pcil->easize >
    10881092                 pcir->cbFile + pcir->easize) {
     
    11131117                pcil->flags |= CNRITEM_NEWER;
    11141118                pcir->flags |= CNRITEM_OLDER;
    1115                 if(cl != pcil->subject) {
     1119                if(cl != pcil->szSubject) {
    11161120                  strcpy(cl,", ");
    11171121                  cl += 2;
     
    11351139                pcil->flags |= CNRITEM_OLDER;
    11361140                pcir->flags |= CNRITEM_NEWER;
    1137                 if(cl != pcil->subject) {
     1141                if(cl != pcil->szSubject) {
    11381142                  strcpy(cl,", ");
    11391143                  cl += 2;
  • trunk/dll/sortcnr.c

    r2 r157  
     1
     2/***********************************************************************
     3
     4  $Id$
     5
     6  Sort container items
     7
     8  Copyright (c) 1993-98 M. Kimes
     9  Copyright (c) 2005 Steven H. Levine
     10
     11  24 May 05 SHL Rework for CNRITEM.szSubject
     12  25 May 05 SHL Rework with ULONGLONG
     13
     14***********************************************************************/
     15
    116#define INCL_WIN
     17#define INCL_LONGLONG
     18#include <os2.h>
    219
    3 #include <os2.h>
    420#include <stdio.h>
    521#include <stdlib.h>
    622#include <string.h>
     23
    724#include "fm3dll.h"
    825
     
    1128
    1229SHORT APIENTRY SortTreeCnr (PMINIRECORDCORE p1,PMINIRECORDCORE p2,
    13                             PVOID pStorage) {
    14 
     30                            PVOID pStorage)
     31{
    1532  return SortCnr(p1,p2,((pStorage) ? (INT)pStorage : TreesortFlags));
    1633}
     
    1835
    1936SHORT APIENTRY SortDirCnr (PMINIRECORDCORE p1,PMINIRECORDCORE p2,
    20                            PVOID pStorage) {
    21 
     37                           PVOID pStorage)
     38{
    2239  DIRCNRDATA *dcd = WinQueryWindowPtr(((PCNRITEM)p1)->hwndCnr,0);
    2340
    2441  return SortCnr(p1,p2,((pStorage) ? (INT)pStorage :
    25                 (dcd && dcd->size == sizeof(DIRCNRDATA)) ?
    26                   dcd->sortFlags : sortFlags));
     42                (dcd && dcd->size == sizeof(DIRCNRDATA)) ?
     43                  dcd->sortFlags : sortFlags));
    2744}
    2845
    2946
    3047SHORT APIENTRY SortCollectorCnr (PMINIRECORDCORE p1,PMINIRECORDCORE p2,
    31                                  PVOID pStorage) {
    32 
     48                                 PVOID pStorage)
     49{
    3350  return SortCnr(p1,p2,((pStorage) ? (INT)pStorage : CollectorsortFlags));
    3451}
    3552
    3653
    37 SHORT SortCnr (PMINIRECORDCORE p1,PMINIRECORDCORE p2,INT SortFlags) {
    38 
    39   PCNRITEM   p = (PCNRITEM)p1,pp = (PCNRITEM)p2;
     54SHORT SortCnr (PMINIRECORDCORE pRec1,PMINIRECORDCORE pRec2,INT SortFlags)
     55{
     56  PCNRITEM   pCI1 = (PCNRITEM)pRec1;
     57  PCNRITEM   pCI2 = (PCNRITEM)pRec2;
    4058  SHORT      ret = 0;
    41   CHAR      *pext,*ppext;
     59  CHAR      *pch1,*pch2;
    4260
    4361  if(SortFlags & SORT_NOSORT)
    4462    return 0;
    45   if(SortFlags && p->szFileName[3] && pp->szFileName[3]) {
     63  if(SortFlags && pCI1->szFileName[3] && pCI2->szFileName[3]) {
    4664    if(SortFlags & SORT_DIRSFIRST) {
    47       if((p->attrFile & FILE_DIRECTORY) != (pp->attrFile & FILE_DIRECTORY))
    48         return (p->attrFile & FILE_DIRECTORY) ? -1 : 1;
     65      if((pCI1->attrFile & FILE_DIRECTORY) != (pCI2->attrFile & FILE_DIRECTORY))
     66        return (pCI1->attrFile & FILE_DIRECTORY) ? -1 : 1;
    4967    }
    5068    else if(SortFlags & SORT_DIRSLAST) {
    51       if((p->attrFile & FILE_DIRECTORY) != (pp->attrFile & FILE_DIRECTORY))
    52         return (p->attrFile & FILE_DIRECTORY) ? 1 : -1;
     69      if((pCI1->attrFile & FILE_DIRECTORY) != (pCI2->attrFile & FILE_DIRECTORY))
     70        return (pCI1->attrFile & FILE_DIRECTORY) ? 1 : -1;
    5371    }
    5472    switch(SortFlags & (~(SORT_DIRSFIRST | SORT_DIRSLAST | SORT_REVERSE))) {
    5573      case SORT_SUBJECT:
    56         if(*p->subject && *pp->subject)
    57           ret = stricmp(p->subject,pp->subject);
    58         else {
    59           ret = (*pp->subject) ? 1 : (*p->subject) ? -1 : 0;
    60           if(ret && (SortFlags & SORT_REVERSE))
    61             ret = (ret > 0) ? -1 : 1;
    62         }
    63         break;
     74        if(*pCI1->szSubject && *pCI2->szSubject)
     75          ret = stricmp(pCI1->szSubject,pCI2->szSubject);
     76        else {
     77          ret = (*pCI2->szSubject) ? 1 : (*pCI1->szSubject) ? -1 : 0;
     78          if(ret && (SortFlags & SORT_REVERSE))
     79            ret = (ret > 0) ? -1 : 1;
     80        }
     81        break;
    6482
    6583      case SORT_FILENAME:
    66         pext = strrchr(p->szFileName,'\\');
    67         ppext = strrchr(pp->szFileName,'\\');
    68         if(!pext)
    69           pext = NullStr;
    70         if(!ppext)
    71           ppext = NullStr;
    72         ret = stricmp(pext,ppext);
    73         break;
     84        pch1 = strrchr(pCI1->szFileName,'\\');
     85        pch2 = strrchr(pCI2->szFileName,'\\');
     86        if(!pch1)
     87          pch1 = NullStr;
     88        if(!pch2)
     89          pch2 = NullStr;
     90        ret = stricmp(pch1,pch2);
     91        break;
    7492
    7593      case SORT_FIRSTEXTENSION:
    76         pext = strrchr(p->szFileName,'\\');
    77         ppext = strrchr(pp->szFileName,'\\');
    78         if(!pext)
    79           pext = p->szFileName;
    80         if(!ppext)
    81           ppext = pp->szFileName;
    82         pext = strchr(pext,'.');
    83         ppext = strchr(ppext,'.');
    84         if(!pext)
    85           pext = NullStr;
    86         if(!ppext)
    87           ppext = NullStr;
    88         ret = stricmp(pext,ppext);
    89         break;
     94        pch1 = strrchr(pCI1->szFileName,'\\');
     95        pch2 = strrchr(pCI2->szFileName,'\\');
     96        if(!pch1)
     97          pch1 = pCI1->szFileName;
     98        if(!pch2)
     99          pch2 = pCI2->szFileName;
     100        pch1 = strchr(pch1,'.');
     101        pch2 = strchr(pch2,'.');
     102        if(!pch1)
     103          pch1 = NullStr;
     104        if(!pch2)
     105          pch2 = NullStr;
     106        ret = stricmp(pch1,pch2);
     107        break;
    90108
    91109      case SORT_LASTEXTENSION:
    92         pext = strrchr(p->szFileName,'\\');
    93         ppext = strrchr(pp->szFileName,'\\');
    94         if(!pext)
    95           pext = p->szFileName;
    96         if(!ppext)
    97           ppext = pp->szFileName;
    98         pext = strrchr(pext,'.');
    99         ppext = strrchr(ppext,'.');
    100         if(!pext)
    101           pext = NullStr;
    102         if(!ppext)
    103           ppext = NullStr;
    104         ret = stricmp(pext,ppext);
    105         break;
     110        pch1 = strrchr(pCI1->szFileName,'\\');
     111        pch2 = strrchr(pCI2->szFileName,'\\');
     112        if(!pch1)
     113          pch1 = pCI1->szFileName;
     114        if(!pch2)
     115          pch2 = pCI2->szFileName;
     116        pch1 = strrchr(pch1,'.');
     117        pch2 = strrchr(pch2,'.');
     118        if(!pch1)
     119          pch1 = NullStr;
     120        if(!pch2)
     121          pch2 = NullStr;
     122        ret = stricmp(pch1,pch2);
     123        break;
    106124
    107125      case SORT_SIZE:
    108         ret = (p->cbFile < pp->cbFile) ? 1 : (p->cbFile == pp->cbFile) ?
    109               0 : -1;
    110         if(!ret)
    111           ret = (p->easize < pp->easize) ? 1 : (p->easize == pp->easize) ?
    112                 0 : -1;
    113         break;
     126        ret = (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile == pCI2->cbFile) ?
     127              0 : -1;
     128        if(!ret)
     129          ret = (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize == pCI2->easize) ?
     130                0 : -1;
     131        break;
    114132
    115133      case SORT_EASIZE:
    116         ret = (p->easize < pp->easize) ? 1 : (p->easize == pp->easize) ?
    117               0 : -1;
    118         if(!ret)
    119           ret = (p->cbFile < pp->cbFile) ? 1 : (p->cbFile == pp->cbFile) ?
    120                 0 : -1;
    121         break;
     134        ret = (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize == pCI2->easize) ?
     135              0 : -1;
     136        if(!ret)
     137          ret = (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile == pCI2->cbFile) ?
     138                0 : -1;
     139        break;
    122140
    123141      case SORT_LWDATE:
    124         ret = (p->date.year < pp->date.year) ? 1 :
    125               (p->date.year > pp->date.year) ? -1 :
    126               (p->date.month < pp->date.month) ? 1 :
    127               (p->date.month > pp->date.month) ? -1 :
    128               (p->date.day < pp->date.day) ? 1 :
    129               (p->date.day > pp->date.day) ? -1 :
    130               (p->time.hours < pp->time.hours) ? 1 :
    131               (p->time.hours > pp->time.hours) ? -1 :
    132               (p->time.minutes < pp->time.minutes) ? 1 :
    133               (p->time.minutes > pp->time.minutes) ? -1 :
    134               (p->time.seconds < pp->time.seconds) ? 1 :
    135               (p->time.seconds > pp->time.seconds) ? -1 : 0;
    136         break;
     142        ret = (pCI1->date.year < pCI2->date.year) ? 1 :
     143              (pCI1->date.year > pCI2->date.year) ? -1 :
     144              (pCI1->date.month < pCI2->date.month) ? 1 :
     145              (pCI1->date.month > pCI2->date.month) ? -1 :
     146              (pCI1->date.day < pCI2->date.day) ? 1 :
     147              (pCI1->date.day > pCI2->date.day) ? -1 :
     148              (pCI1->time.hours < pCI2->time.hours) ? 1 :
     149              (pCI1->time.hours > pCI2->time.hours) ? -1 :
     150              (pCI1->time.minutes < pCI2->time.minutes) ? 1 :
     151              (pCI1->time.minutes > pCI2->time.minutes) ? -1 :
     152              (pCI1->time.seconds < pCI2->time.seconds) ? 1 :
     153              (pCI1->time.seconds > pCI2->time.seconds) ? -1 : 0;
     154        break;
    137155
    138156      case SORT_LADATE:
    139         ret = (p->ladate.year < pp->ladate.year) ? 1 :
    140               (p->ladate.year > pp->ladate.year) ? -1 :
    141               (p->ladate.month < pp->ladate.month) ? 1 :
    142               (p->ladate.month > pp->ladate.month) ? -1 :
    143               (p->ladate.day < pp->ladate.day) ? 1 :
    144               (p->ladate.day > pp->ladate.day) ? -1 :
    145               (p->latime.hours < pp->latime.hours) ? 1 :
    146               (p->latime.hours > pp->latime.hours) ? -1 :
    147               (p->latime.minutes < pp->latime.minutes) ? 1 :
    148               (p->latime.minutes > pp->latime.minutes) ? -1 :
    149               (p->latime.seconds < pp->latime.seconds) ? 1 :
    150               (p->latime.seconds > pp->latime.seconds) ? -1 : 0;
    151         break;
     157        ret = (pCI1->ladate.year < pCI2->ladate.year) ? 1 :
     158              (pCI1->ladate.year > pCI2->ladate.year) ? -1 :
     159              (pCI1->ladate.month < pCI2->ladate.month) ? 1 :
     160              (pCI1->ladate.month > pCI2->ladate.month) ? -1 :
     161              (pCI1->ladate.day < pCI2->ladate.day) ? 1 :
     162              (pCI1->ladate.day > pCI2->ladate.day) ? -1 :
     163              (pCI1->latime.hours < pCI2->latime.hours) ? 1 :
     164              (pCI1->latime.hours > pCI2->latime.hours) ? -1 :
     165              (pCI1->latime.minutes < pCI2->latime.minutes) ? 1 :
     166              (pCI1->latime.minutes > pCI2->latime.minutes) ? -1 :
     167              (pCI1->latime.seconds < pCI2->latime.seconds) ? 1 :
     168              (pCI1->latime.seconds > pCI2->latime.seconds) ? -1 : 0;
     169        break;
    152170
    153171      case SORT_CRDATE:
    154         ret = (p->crdate.year < pp->crdate.year) ? 1 :
    155               (p->crdate.year > pp->crdate.year) ? -1 :
    156               (p->crdate.month < pp->crdate.month) ? 1 :
    157               (p->crdate.month > pp->crdate.month) ? -1 :
    158               (p->crdate.day < pp->crdate.day) ? 1 :
    159               (p->crdate.day > pp->crdate.day) ? -1 :
    160               (p->crtime.hours < pp->crtime.hours) ? 1 :
    161               (p->crtime.hours > pp->crtime.hours) ? -1 :
    162               (p->crtime.minutes < pp->crtime.minutes) ? 1 :
    163               (p->crtime.minutes > pp->crtime.minutes) ? -1 :
    164               (p->crtime.seconds < pp->crtime.seconds) ? 1 :
    165               (p->crtime.seconds > pp->crtime.seconds) ? -1 : 0;
    166         break;
     172        ret = (pCI1->crdate.year < pCI2->crdate.year) ? 1 :
     173              (pCI1->crdate.year > pCI2->crdate.year) ? -1 :
     174              (pCI1->crdate.month < pCI2->crdate.month) ? 1 :
     175              (pCI1->crdate.month > pCI2->crdate.month) ? -1 :
     176              (pCI1->crdate.day < pCI2->crdate.day) ? 1 :
     177              (pCI1->crdate.day > pCI2->crdate.day) ? -1 :
     178              (pCI1->crtime.hours < pCI2->crtime.hours) ? 1 :
     179              (pCI1->crtime.hours > pCI2->crtime.hours) ? -1 :
     180              (pCI1->crtime.minutes < pCI2->crtime.minutes) ? 1 :
     181              (pCI1->crtime.minutes > pCI2->crtime.minutes) ? -1 :
     182              (pCI1->crtime.seconds < pCI2->crtime.seconds) ? 1 :
     183              (pCI1->crtime.seconds > pCI2->crtime.seconds) ? -1 : 0;
     184        break;
    167185    }
    168186
    169187    if(!ret)
    170       ret = (SHORT)stricmp(p->szFileName,pp->szFileName);
     188      ret = (SHORT)stricmp(pCI1->szFileName,pCI2->szFileName);
    171189
    172190    if(ret && (SortFlags & SORT_REVERSE))
     
    175193    return ret;
    176194  }
    177   return (SHORT)stricmp(p->szFileName,pp->szFileName);
     195  return (SHORT)stricmp(pCI1->szFileName,pCI2->szFileName);
    178196}
    179 
Note: See TracChangeset for help on using the changeset viewer.