OSDN Git Service

BUG: correcting memory allocation for Unicode build in FilepathEdit.cpp
authorLaurent Ganier <laoran@users.sourceforge.net>
Tue, 14 Oct 2003 16:34:44 +0000 (16:34 +0000)
committerLaurent Ganier <laoran@users.sourceforge.net>
Tue, 14 Oct 2003 16:34:44 +0000 (16:34 +0000)
Src/FilepathEdit.cpp
Src/readme.txt

index e20401d..6e06059 100644 (file)
@@ -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)
        }
 }
 
-
-
-
index bd5984a..9f58fb0 100644 (file)
@@ -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