Changeset 1833 for trunk/dll/misc.c
- Timestamp:
- Jul 14, 2015, 1:07:26 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/misc.c
r1829 r1833 72 72 12 Nov 11 GKY Fixed HelpViewer's failure to open help files and subsequent failure with files with spaces. 73 73 28 Jun 14 GKY Fix errors identified with CPPCheck 74 12 Jul 15 GKY Fix CN_REALLOCPSZ file name editing code to: 1) Actually reallocate the buffer. 75 2) Point pci->pszDisplayName into the new buffer 3) Eliminate the possibility 76 of updating the container before CN_ENDEDIT is called. 4) Only call RemoveCnrItems 74 12 Jul 15 GKY Fix CN_REALLOCPSZ file name editing code to: 1) Eliminate the possibility of 75 updating the container before CN_ENDEDIT is called. 2) Don't call RemoveCnrItems 77 76 for tree container and collector. 78 77 … … 979 978 Runtime_Error(pszSrcFile, __LINE__, "bad name"); 980 979 else { 981 DIRCNRDATA *dcd;982 FILEFINDBUF4L ffb;983 HDIR hDir = HDIR_CREATE;984 ULONG nm = 1;985 CHAR *p;986 987 980 if (DosQueryPathInfo(testname, //Why does this return 0 when the file doesn't exist? 988 981 FIL_QUERYFULLNAME, // No new directory creation? … … 993 986 oldname, sizeof(oldname))) 994 987 strcpy(oldname, pci->pszFileName); 995 psz = xrealloc(pci->pszFileName, sizeof(oldname), pszSrcFile, __LINE__);996 if (psz)997 pci->pszFileName = psz;998 else {999 xfree(pci->pszFileName, pszSrcFile, __LINE__);1000 pci->pszFileName = NullStr;1001 return FALSE; // out of memory1002 }1003 if (!dcd) // Point pci->pszDisplayName into the realloc pci->pszFileName1004 dcd = INSTDATA(hwnd);1005 rc = xDosFindFirst(pci->pszFileName,1006 &hDir,1007 FILE_NORMAL | FILE_DIRECTORY |1008 FILE_ARCHIVED | FILE_READONLY |1009 FILE_HIDDEN | FILE_SYSTEM,1010 &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);1011 if (!rc) { // file exists1012 DosFindClose(hDir);1013 if (dcd->type == DIR_FRAME || dcd->type == TREE_FRAME) {1014 p = strrchr(pci->pszFileName, '\\');1015 if (!p) {1016 p = strrchr(pci->pszFileName, ':');1017 if (!p)1018 p = pci->pszFileName;1019 else1020 p++;1021 }1022 else if ((dcd && dcd->type == TREE_FRAME) ||1023 !(ffb.attrFile & FILE_DIRECTORY) || !*(p + 1))1024 p++;1025 if (!*p)1026 p = pci->pszFileName;1027 }1028 else1029 p = pci->pszFileName;1030 pci->pszDisplayName = p;1031 }1032 else1033 return FALSE; // nothing to rename1034 988 WinSetWindowText(hwndMLE, oldname); 1035 989 if (strcmp(oldname, newname)) { … … 1076 1030 free(filename); 1077 1031 } 1078 if (dcd && (dcd->type == TREE_FRAME || dcd->type == COLLECTOR_FRAME))1079 PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci));1080 1032 filename = xstrdup(newname, pszSrcFile, __LINE__); 1081 1033 if (filename) {
Note:
See TracChangeset
for help on using the changeset viewer.