[Winmerge-svn] SF.net SVN: winmerge: [5545] trunk/Src
Windows visual diff and merge for files and directories
Brought to you by:
christianlist,
grimmdp
From: <mar...@us...> - 2008-06-30 01:45:27
|
Revision: 5545 http://winmerge.svn.sourceforge.net/winmerge/?rev=5545&view=rev Author: marcelgosselin Date: 2008-06-29 18:45:21 -0700 (Sun, 29 Jun 2008) Log Message: ----------- Use bool instead of BOOL and String instead of CString and LPCTSTR Modified Paths: -------------- trunk/Src/Common/ClipBoard.cpp trunk/Src/Common/ClipBoard.h trunk/Src/DirView.cpp Modified: trunk/Src/Common/ClipBoard.cpp =================================================================== --- trunk/Src/Common/ClipBoard.cpp 2008-06-30 01:16:38 UTC (rev 5544) +++ trunk/Src/Common/ClipBoard.cpp 2008-06-30 01:45:21 UTC (rev 5545) @@ -11,25 +11,25 @@ /** * @brief Copies string to clipboard. - * @param [in] pszText Text to copy to clipboard. + * @param [in] text Text to copy to clipboard. * @param [in] currentWindowHandle Handle to current window. * @return TRUE if text copying succeeds, FALSE otherwise. */ -BOOL PutToClipboard(LPCTSTR pszText, HWND currentWindowHandle) +bool PutToClipboard(const String & text, HWND currentWindowHandle) { - if (pszText == NULL || _tcslen(pszText) == 0) - return FALSE; + if (text.empty()) + return false; CWaitCursor wc; - BOOL bOK = FALSE; + bool bOK = false; if (OpenClipboard(currentWindowHandle)) { EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, (_tcslen(pszText)+1) * sizeof(TCHAR)); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, (text.length()+1) * sizeof(TCHAR)); if (hData != NULL) { LPTSTR pszData = (LPTSTR)::GlobalLock(hData); - _tcscpy(pszData, pszText); + _tcscpy(pszData, text.c_str()); GlobalUnlock(hData); UINT fmt = GetClipTcharTextFormat(); bOK = SetClipboardData(fmt, hData) != NULL; @@ -45,9 +45,9 @@ * @param [in] currentWindowHandle Handle to current window. * @return TRUE if retrieving the clipboard text succeeds, FALSE otherwise. */ -BOOL GetFromClipboard(CString & text, HWND currentWindowHandle) +bool GetFromClipboard(String & text, HWND currentWindowHandle) { - BOOL bSuccess = FALSE; + bool bSuccess = false; if (OpenClipboard(currentWindowHandle)) { UINT fmt = GetClipTcharTextFormat(); @@ -59,7 +59,7 @@ { text = pszData; GlobalUnlock(hData); - bSuccess = TRUE; + bSuccess = true; } } CloseClipboard(); @@ -71,8 +71,8 @@ * @brief Checks if the clipboard allows Unicode format. * @return TRUE if Unicode is supported, FALSE otherwise. */ -BOOL TextInClipboard() +bool TextInClipboard() { UINT fmt = GetClipTcharTextFormat(); - return IsClipboardFormatAvailable(fmt); + return IsClipboardFormatAvailable(fmt) != FALSE; } Modified: trunk/Src/Common/ClipBoard.h =================================================================== --- trunk/Src/Common/ClipBoard.h 2008-06-30 01:16:38 UTC (rev 5544) +++ trunk/Src/Common/ClipBoard.h 2008-06-30 01:45:21 UTC (rev 5545) @@ -9,8 +9,10 @@ #ifndef _CLIPBOARD_H_ #define _CLIPBOARD_H_ -BOOL PutToClipboard(LPCTSTR pszText, HWND currentWindowHandle); -BOOL GetFromClipboard(CString & text, HWND currentWindowHandle); -BOOL TextInClipboard(); +#include "UnicodeString.h" +bool PutToClipboard(const String & text, HWND currentWindowHandle); +bool GetFromClipboard(String & text, HWND currentWindowHandle); +bool TextInClipboard(); + #endif // _CLIPBOARD_H_ Modified: trunk/Src/DirView.cpp =================================================================== --- trunk/Src/DirView.cpp 2008-06-30 01:16:38 UTC (rev 5544) +++ trunk/Src/DirView.cpp 2008-06-30 01:45:21 UTC (rev 5545) @@ -2736,7 +2736,7 @@ strPaths += _T("\r\n"); } } - PutToClipboard(strPaths.c_str(), AfxGetMainWnd()->GetSafeHwnd()); + PutToClipboard(strPaths, AfxGetMainWnd()->GetSafeHwnd()); } /** @@ -2761,7 +2761,7 @@ strPaths += _T("\r\n"); } } - PutToClipboard(strPaths.c_str(), AfxGetMainWnd()->GetSafeHwnd()); + PutToClipboard(strPaths, AfxGetMainWnd()->GetSafeHwnd()); } /** @@ -2796,7 +2796,7 @@ strPaths += _T("\r\n"); } } - PutToClipboard(strPaths.c_str(), AfxGetMainWnd()->GetSafeHwnd()); + PutToClipboard(strPaths, AfxGetMainWnd()->GetSafeHwnd()); } /** @@ -2816,7 +2816,7 @@ strPaths += _T("\r\n"); } } - PutToClipboard(strPaths.c_str(), AfxGetMainWnd()->GetSafeHwnd()); + PutToClipboard(strPaths, AfxGetMainWnd()->GetSafeHwnd()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |