Changeset 1051
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/dirsize.c
r1048 r1051 33 33 29 Feb 08 GKY Use xfree where appropriate 34 34 29 Feb 08 GKY Add presparams & update appearence of "Sizes" dialog 35 07 Jul 08 GKY Fixed trap in PMCTLS (strlen) inadequate memory allocation 36 07 Jul o8 GKY Fixed trap by no longer allocating pci->pszLongName as flag but pointing isroot 37 version to NullStr and all others to NULL. 35 38 36 39 ***********************************************************************/ … … 204 207 // fixme to understand this - appears to be indirectly saving length, but why? 205 208 pci->pszDisplayName = pci->pszFileName + strlen(pci->pszFileName); 206 pci->pszLongName = pci->pszFileName; // fixme to be sure?207 209 pci->rc.pszIcon = pci->pszFileName; 208 210 pci->rc.flRecordAttr |= CRA_RECORDREADONLY; … … 211 213 else if (fForceLower) 212 214 strlwr(pci->pszFileName); 213 pci->pszDisplayName = pci->pszFileName + strlen(pci->pszFileName);214 215 memset(&ri, 0, sizeof(RECORDINSERT)); 215 216 ri.cb = sizeof(RECORDINSERT); … … 308 309 CHAR szAllDir[80]; 309 310 CHAR szBar[80]; 311 CHAR szBuf[CCHMAXPATH * 2]; 312 313 # ifdef FORTIFY 314 Fortify_EnterScope(); 315 # endif 310 316 311 317 // cbFile = currect directory usage in bytes … … 313 319 CommaFmtULL(szCurDir, sizeof(szCurDir), pci->cbFile, 'K'); 314 320 *szBar = 0; 315 321 pci->pszLongName = NULL; 316 322 if (ullTotalBytes) { 317 323 register UINT cBar; … … 319 325 if (isroot) { 320 326 FSALLOCATE fsa; 321 APIRET rc; 322 323 memset(&fsa, 0, sizeof(fsa)); 327 APIRET rc; 328 329 330 memset(&fsa, 0, sizeof(fsa)); 324 331 rc = DosQueryFSInfo(toupper(*pci->pszFileName) - '@', FSIL_ALLOC, &fsa, 325 332 sizeof(FSALLOCATE)); … … 328 335 ((float)fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector)); 329 336 } 330 // Need unique buffer 23 Jul 07 SHL 331 pci->pszLongName = xmalloc(3, pszSrcFile, __LINE__); 332 if (pci->pszLongName) { 333 pci->pszLongName[0] = 0; // Make null string 334 pci->pszLongName[1] = 1; // Flag root - hack cough 335 pci->pszLongName[2] = 0; // terminate anyway 336 } 337 // Need unique buffer 23 Jul 07 SHL 338 pci->pszLongName = NullStr; 337 339 } 338 340 else … … 355 357 CommaFmtULL(szAllDir, sizeof(szAllDir), pci->cbFile + pci->easize, 'K'); 356 358 c = pci->pszDisplayName - pci->pszFileName; 357 pci->pszFileName = xrealloc(pci->pszFileName, 358 CCHMAXPATH, 359 pszSrcFile, 360 __LINE__); // 23 Jul 07 SHL 361 sprintf(pci->pszFileName + c, 362 " %s + %s = %s (%.02lf%%%s)\r%s", 359 sprintf(szBuf, 360 "%s %s + %s = %s (%.02lf%%%s)\r%s", 361 pci->pszFileName, 363 362 szCurDir, 364 363 szSubDir, … … 366 365 fltPct, 367 366 isroot ? GetPString(IDS_OFDRIVETEXT) : NullStr, 368 szBar); 369 pci->pszFileName = xrealloc(pci->pszFileName, 370 strlen(pci->pszFileName) + 1, 371 pszSrcFile, 372 __LINE__); // 23 Jul 07 SHL 367 szBar); 368 free(pci->pszFileName); 369 pci->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__); 373 370 pci->pszDisplayName = pci->pszFileName + c; 374 371 WinSendMsg(hwndCnr, … … 673 670 if (p) { 674 671 // draw text 675 if ( *(pci->pszLongName + 1) == 1) // is root record672 if (pci->pszLongName == NullStr) // is root record 676 673 GpiSetColor(oi->hps, CLR_DARKRED); 677 674 else if (!pci->cbFile) // no size … … 759 756 // fill box with graph bar, flags is integer % 760 757 if (pci->flags) { 761 if ( *(pci->pszLongName + 1) == 1) // is root record758 if (pci->pszLongName == NullStr) // is root record 762 759 GpiSetColor(oi->hps, CLR_DARKGREEN); 763 760 else … … 771 768 772 769 // draw highlights and shadows on graph 773 if ( *(pci->pszLongName + 1) == 1)770 if (pci->pszLongName == NullStr) 774 771 GpiSetColor(oi->hps, CLR_GREEN); 775 772 else … … 788 785 ptl.x = oi->rclItem.xLeft + pci->flags * 2; 789 786 GpiLine(oi->hps, &ptl); 790 if ( *(pci->pszLongName + 1) != 1) {787 if (pci->pszLongName == NULL) { 791 788 GpiSetColor(oi->hps, CLR_DARKRED); 792 789 ptl.x = oi->rclItem.xLeft + 2; … … 839 836 } // for x 840 837 return MRFROMLONG(TRUE); 841 }838 } 842 839 } 843 840 } -
trunk/dll/filldir.c
r1039 r1051 1610 1610 free(psz); 1611 1611 } 1612 # ifdef FORTIFY 1613 Fortify_LeaveScope(); 1614 # endif 1612 1615 } 1613 1616
Note:
See TracChangeset
for help on using the changeset viewer.
