From c4b849f5be02b7ce86dd7d13036ce630948a6745 Mon Sep 17 00:00:00 2001 From: Laurent Ganier Date: Tue, 14 Oct 2003 16:34:44 +0000 Subject: [PATCH] BUG: correcting memory allocation for Unicode build in FilepathEdit.cpp --- Src/FilepathEdit.cpp | 16 ++++++++++------ Src/readme.txt | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Src/FilepathEdit.cpp b/Src/FilepathEdit.cpp index e20401d9b..6e0605968 100644 --- a/Src/FilepathEdit.cpp +++ b/Src/FilepathEdit.cpp @@ -220,8 +220,11 @@ LPCTSTR CFilepathEdit::GetUpdatedTipText(CDC * pDC, int maxWidth) return (LPCTSTR) toolTipString; } -// use this when we want to copy from the wholeText -// the standard Copy function works with the windowText +/** + * @brief retrieve text from the wholeText + * + * @note The standard Copy function works with the (compacted) windowText + */ void CFilepathEdit::CustomCopy(int iBegin, int iEnd /*=-1*/) { if (iEnd == -1) @@ -234,7 +237,7 @@ void CFilepathEdit::CustomCopy(int iBegin, int iEnd /*=-1*/) return; // insert text into clipboard - HGLOBAL hData = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, iEnd-iBegin + 1); + HGLOBAL hData = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, (iEnd-iBegin + 1)*sizeof(TCHAR)); if (hData == NULL) return; LPTSTR pszData = (LPTSTR)::GlobalLock (hData); @@ -295,6 +298,10 @@ void CFilepathEdit::OnContextMenu(CWnd*, CPoint point) } break; case ID_EDITOR_COPY_PATH: + // pass the heading "*" for modified files + if (wholeText.GetAt(0) == '*') + iBegin = 2; + else iBegin = 0; break; } @@ -303,6 +310,3 @@ void CFilepathEdit::OnContextMenu(CWnd*, CPoint point) } } - - - diff --git a/Src/readme.txt b/Src/readme.txt index bd5984acf..9f58fb0e5 100644 --- a/Src/readme.txt +++ b/Src/readme.txt @@ -1,4 +1,6 @@ 2003-10-14 Laoran + BUG: correcting memory allocation for Unicode build in FilepathEdit.cpp + editlib: FilepathEdit.cpp BUG: [ 822844 ] Drag & Drop crashes on Unicode build (correcting memory allocation) editlib: ccrystaltextview.cpp -- 2.11.0