Changeset 751 for trunk/dll/dirsize.c
- Timestamp:
- Aug 3, 2007, 1:05:48 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/dirsize.c
r739 r751 85 85 { 86 86 CHAR maskstr[CCHMAXPATH]; 87 CHAR szBuf[CCHMAXPATH]; 87 88 CHAR *pEndMask; 88 89 register char *p; … … 113 114 114 115 hdir = HDIR_CREATE; 115 nm = 1 L;116 nm = 1; 116 117 memset(pffb, 0, sizeof(FILEFINDBUF4)); 117 118 DosError(FERR_DISABLEHARDERR); … … 135 136 return FALSE; 136 137 } 137 pci = WinSendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(EXTRA_RECORD_BYTES 2),138 MPFROMLONG(1 L));138 pci = WinSendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(EXTRA_RECORD_BYTES), 139 MPFROMLONG(1)); 139 140 if (!pci) { 140 141 free(pffb); … … 148 149 DosError(FERR_DISABLEHARDERR); 149 150 pci->rc.hptrIcon = hptrDir; 150 *pci->szDispAttr = 0;151 151 pci->attrFile = 0; 152 pci->pszSubject = xstrdup(NullStr, pszSrcFile, __LINE__); 152 pci->pszDispAttr = NullStr; 153 pci->pszSubject = NullStr; 153 154 } 154 155 else { … … 163 164 164 165 if (strlen(pszFileName) < 4 || top) 165 pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__);166 pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__); 166 167 else { 167 168 p = strrchr(pszFileName, '\\'); … … 170 171 else 171 172 p++; // After last backslash 172 // Handle quoted names? 173 // Handle quoted names 174 // fixme to understand this - why lose path prefix? 173 175 sp = strchr(pszFileName, ' ') != NULL ? "\"" : NullStr; 174 pci->pszFileName = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__); // fixme to optimize alloc 175 pp = pci->pszFileName; 176 if (*sp) { 177 *pp = *sp; // Need quotes 178 pp++; 179 *pp = 0; 180 } 176 pp = szBuf; 177 if (*sp) 178 *pp++ = *sp; // Need quotes 181 179 strcpy(pp, p); 182 180 if (*sp) 183 181 strcat(pp, sp); 184 } 185 pci->pszLongname = pci->pszFileName; 186 pci->rc.pszIcon = pci->pszLongname; 182 pci->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); 183 } 184 // fixme to know why - it appears to be indirectly saving length, but why? 185 pci->pszDisplayName = pci->pszFileName + strlen(pci->pszFileName); 186 pci->pszLongname = pci->pszFileName; // fixme to be sure? 187 pci->rc.pszIcon = pci->pszFileName; 187 188 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; 188 189 if (fForceUpper) … … 196 197 ri.pRecordParent = (PRECORDCORE) pciParent; 197 198 ri.zOrder = (USHORT) CMA_TOP; 198 ri.cRecordsInsert = 1 L;199 ri.cRecordsInsert = 1; 199 200 ri.fInvalidateRecord = TRUE; 200 201 if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { … … 203 204 } 204 205 hdir = HDIR_CREATE; 205 nm = 1 L;206 nm = 1; 206 207 rc = DosFindFirst(maskstr, &hdir, 207 208 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | … … 216 217 priority_normal(); 217 218 //printf("Found %lu\n",nm); 218 for (x = 0 L; x < nm; x++) {219 for (x = 0; x < nm; x++) { 219 220 pffbFile = (FILEFINDBUF4 *) fb; 220 221 //printf("%s\n",pffbFile->achName); … … 247 248 if (*pchStopFlag) 248 249 break; 249 DosSleep( 0L);250 nm = 1 L; /* FilesToGet */250 DosSleep(1); 251 nm = 1; /* FilesToGet */ 251 252 rc = DosFindNext(hdir, pffb, sizeof(FILEFINDBUF4), &nm); 252 253 } // while more found … … 276 277 277 278 float fltPct = 0.0; 279 USHORT c; 278 280 CHAR szCurDir[80]; 279 281 CHAR szSubDir[80]; … … 301 303 } 302 304 // Need unique buffer 23 Jul 07 SHL 303 305 pci->pszLongname = xmalloc(2, pszSrcFile, __LINE__); 304 306 pci->pszLongname[0] = 0; // Make null string 305 307 pci->pszLongname[1] = 1; // Flag root - hack cough … … 323 325 CommaFmtULL(szSubDir, sizeof(szSubDir), pci->easize, 'K'); 324 326 CommaFmtULL(szAllDir, sizeof(szAllDir), pci->cbFile + pci->easize, 'K'); 325 pci->pszFileName = xrealloc(pci->pszFileName, strlen(pci->pszFileName) + 100, 327 c = pci->pszDisplayName - pci->pszFileName; 328 pci->pszFileName = xrealloc(pci->pszFileName, 329 CCHMAXPATH, 326 330 pszSrcFile, 327 331 __LINE__); // 23 Jul 07 SHL 328 sprintf(pci->pszFileName + strlen(pci->pszFileName),332 sprintf(pci->pszFileName + c, 329 333 " %s + %s = %s (%.02lf%%%s)\r%s", 330 334 szCurDir, 331 335 szSubDir, 332 336 szAllDir, 333 fltPct, isroot ? GetPString(IDS_OFDRIVETEXT) : NullStr, szBar); 337 fltPct, 338 isroot ? GetPString(IDS_OFDRIVETEXT) : NullStr, 339 szBar); 340 pci->pszFileName = xrealloc(pci->pszFileName, 341 strlen(pci->pszFileName) + 1, 342 pszSrcFile, 343 __LINE__); // 23 Jul 07 SHL 344 pci->pszDisplayName = pci->pszFileName + c; 334 345 WinSendMsg(hwndCnr, 335 346 CM_INVALIDATERECORD, MPFROMP(&pci), MPFROM2SHORT(1, 0)); … … 377 388 CMA_ITEMORDER)); 378 389 while (pci && (INT) pci != -1) { 379 DosSleep( 0L);390 DosSleep(1); 380 391 PrintToFile(hwndCnr, indent + 1, pci, fp); 381 392 pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci), … … 462 473 dirsize->pszFileName = pState->szDirName; 463 474 dirsize->hwndCnr = WinWindowFromID(hwnd, DSZ_CNR); 464 if (_beginthread(FillCnrThread, NULL, 122880L * 5 L, (PVOID)dirsize) ==475 if (_beginthread(FillCnrThread, NULL, 122880L * 5, (PVOID)dirsize) == 465 476 -1) { 466 477 Runtime_Error(pszSrcFile, __LINE__, … … 489 500 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO))); 490 501 cnri.cyLineSpacing = 0; 491 cnri.cxTreeIndent = 12 L;502 cnri.cxTreeIndent = 12; 492 503 cnri.flWindowAttr = CV_TREE | CV_FLOW | CA_TREELINE | CA_OWNERDRAW; 493 504 WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_SETCNRINFO, MPFROMP(&cnri), … … 760 771 memset(szTemp, 0, sizeof(szTemp)); 761 772 strncpy(szTemp, pci->pszFileName, 762 pci->psz FileName - pci->pszFileName);773 pci->pszDisplayName - pci->pszFileName); 763 774 strrev(szTemp); 764 775 if (*szFileName && *szTemp != '\\') … … 771 782 strrev(szFileName); 772 783 if (!fVTreeOpensWPS) 773 OpenDirCnr((HWND) 0, 774 (hwndMain) ? hwndMain : HWND_DESKTOP, 775 hwnd, FALSE, szFileName); 784 OpenDirCnr((HWND)0, 785 hwndMain ? hwndMain : HWND_DESKTOP, 786 hwnd, 787 FALSE, 788 szFileName); 776 789 else { 777 790 … … 908 921 if (pState) 909 922 pState->chStopFlag = (BYTE)0xff; 910 DosSleep(1 L);923 DosSleep(1); 911 924 break; 912 925 … … 917 930 if (pState->hptr) 918 931 WinDestroyPointer(pState->hptr); 919 DosSleep(33 L);932 DosSleep(33); 920 933 free(pState); // Let's hope no one is still looking 921 934 }
Note:
See TracChangeset
for help on using the changeset viewer.