Changeset 731 for trunk/dll/dirsize.c
- Timestamp:
- Jul 24, 2007, 1:18:39 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/dirsize.c
r730 r731 78 78 } 79 79 80 static BOOL ProcessDir(HWND hwndCnr, CHAR * pszFileName, 80 static BOOL ProcessDir(HWND hwndCnr, 81 CHAR *pszFileName, 81 82 PCNRITEM pciParent, 82 CHAR * pchStopFlag, BOOL top, 83 CHAR *pchStopFlag, 84 BOOL top, 83 85 PULONGLONG pullTotalBytes) 84 86 { … … 97 99 RECORDINSERT ri; 98 100 PCNRITEM pCI; 99 CHAR *f = 0;100 101 101 102 // fixme to report errors … … 147 148 else 148 149 DosError(FERR_DISABLEHARDERR); 150 // fixme to not double free when pointers match 149 151 pCI->pszLongname = pCI->pszFileName; 150 152 pCI->rc.hptrIcon = hptrDir; 151 153 *pCI->szDispAttr = 0; 152 154 pCI->attrFile = 0; 153 pCI->pszLongname = xstrdup(f, pszSrcFile, __LINE__); 154 pCI->pszSubject = xstrdup(f, pszSrcFile, __LINE__); 155 pCI->pszSubject = xstrdup(NullStr, pszSrcFile, __LINE__); 155 156 } 156 157 else { … … 183 184 strcat(pp, sp); 184 185 } 185 pCI->pszFileName = pCI->pszFileName + strlen(pCI->pszFileName);186 186 pCI->rc.pszIcon = pCI->pszLongname; 187 187 pCI->rc.flRecordAttr |= CRA_RECORDREADONLY; … … 190 190 else if (fForceLower) 191 191 strlwr(pCI->pszFileName); 192 // fixme to work - code is hiding file name from container but... 23 Jul 07 SHL 193 pCI->pszFileName = pCI->pszFileName + strlen(pCI->pszFileName); 192 194 memset(&ri, 0, sizeof(RECORDINSERT)); 193 195 ri.cb = sizeof(RECORDINSERT); … … 197 199 ri.cRecordsInsert = 1L; 198 200 ri.fInvalidateRecord = TRUE; 199 //printf("CM_INSERTRECORD\n");200 201 if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pCI), MPFROMP(&ri))) { 201 //printf("Insert failed\n");202 202 free(pFFB); 203 203 return FALSE; … … 205 205 hdir = HDIR_CREATE; 206 206 nm = 1L; 207 //printf("FIND2\n");208 207 rc = DosFindFirst(maskstr, &hdir, 209 208 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | … … 302 301 ((float)fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector)); 303 302 } 303 // Need unique buffer 23 Jul 07 SHL 304 pCI->pszLongname = xmalloc(2, pszSrcFile, __LINE__); 305 pCI->pszLongname[0] = 0; // Make null string 304 306 pCI->pszLongname[1] = 1; // Flag root - hack cough 305 307 } … … 322 324 CommaFmtULL(szSubDir, sizeof(szSubDir), pCI->easize, 'K'); 323 325 CommaFmtULL(szAllDir, sizeof(szAllDir), pCI->cbFile + pCI->easize, 'K'); 324 sprintf(&pCI->pszFileName[strlen(pCI->pszFileName)], 326 pCI->pszFileName = xrealloc(pCI->pszFileName, strlen(pCI->pszFileName) + 100, 327 pszSrcFile, 328 __LINE__); // 23 Jul 07 SHL 329 sprintf(pCI->pszFileName + strlen(pCI->pszFileName), 325 330 " %s + %s = %s (%.02lf%%%s)\r%s", 326 331 szCurDir, … … 747 752 case CN_ENTER: 748 753 if (mp2) { 749 750 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;751 CHAR pszFileName[CCHMAXPATH],szTemp[CCHMAXPATH];754 PCNRITEM pci = (PCNRITEM)((PNOTIFYRECORDENTER)mp2)->pRecord; 755 CHAR szFileName[CCHMAXPATH]; // 23 Jul 07 SHL 756 CHAR szTemp[CCHMAXPATH]; 752 757 753 758 if (pci) { 754 * pszFileName = 0;759 *szFileName = 0; 755 760 while (pci && (INT) pci != -1) { 756 761 memset(szTemp, 0, sizeof(szTemp)); … … 758 763 pci->pszFileName - pci->pszFileName); 759 764 strrev(szTemp); 760 if (* pszFileName && *szTemp != '\\')761 strcat( pszFileName, "\\");762 strcat( pszFileName, szTemp);765 if (*szFileName && *szTemp != '\\') 766 strcat(szFileName, "\\"); 767 strcat(szFileName, szTemp); 763 768 pci = WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_QUERYRECORD, 764 769 MPFROMP(pci), 765 770 MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER)); 766 771 } 767 strrev( pszFileName);772 strrev(szFileName); 768 773 if (!fVTreeOpensWPS) 769 774 OpenDirCnr((HWND) 0, 770 775 (hwndMain) ? hwndMain : HWND_DESKTOP, 771 hwnd, FALSE, pszFileName);776 hwnd, FALSE, szFileName); 772 777 else { 773 778 … … 780 785 (PVOID) & flWindowAttr, &size); 781 786 if (flWindowAttr & CV_DETAIL) { 782 if (IsRoot( pszFileName))787 if (IsRoot(szFileName)) 783 788 strcpy(s, "TREE"); 784 789 else 785 790 strcpy(s, "DETAILS"); 786 791 } 787 OpenObject( pszFileName, s, hwnd);792 OpenObject(szFileName, s, hwnd); 788 793 } 789 794 } … … 826 831 else { 827 832 828 CHAR pszFileName[CCHMAXPATH];833 CHAR szFileName[CCHMAXPATH]; 829 834 FILE *fp; 830 835 831 save_dir2( pszFileName);832 sprintf(& pszFileName[strlen(pszFileName)], "\\%csizes.Rpt",836 save_dir2(szFileName); 837 sprintf(&szFileName[strlen(szFileName)], "\\%csizes.Rpt", 833 838 (pState) ? toupper(*pState->szDirName) : '+'); 834 if (export_filename(hwnd, pszFileName, FALSE) && *pszFileName) {835 if (stricmp( pszFileName, "PRN") &&836 strnicmp( pszFileName, "\\DEV\\LPT", 8) &&837 !strchr( pszFileName, '.'))838 strcat( pszFileName, ".RPT");839 fp = fopen( pszFileName, "a+");839 if (export_filename(hwnd, szFileName, FALSE) && *szFileName) { 840 if (stricmp(szFileName, "PRN") && 841 strnicmp(szFileName, "\\DEV\\LPT", 8) && 842 !strchr(szFileName, '.')) 843 strcat(szFileName, ".RPT"); 844 fp = fopen(szFileName, "a+"); 840 845 if (!fp) { 841 846 saymsg(MB_CANCEL, 842 847 hwnd, 843 848 GetPString(IDS_ERRORTEXT), 844 GetPString(IDS_COMPCANTOPENTEXT), pszFileName);849 GetPString(IDS_COMPCANTOPENTEXT), szFileName); 845 850 } 846 851 else {
Note:
See TracChangeset
for help on using the changeset viewer.