Revision: 5754
http://winmerge.svn.sourceforge.net/winmerge/?rev=5754&view=rev
Author: marcelgosselin
Date: 2008-08-08 02:11:51 +0000 (Fri, 08 Aug 2008)
Log Message:
-----------
Use std::swap instead of home-made swap
Modified Paths:
--------------
trunk/Src/Common/coretools.h
trunk/Src/DiffList.cpp
trunk/Src/MergeDoc.cpp
Modified: trunk/Src/Common/coretools.h
===================================================================
--- trunk/Src/Common/coretools.h 2008-08-07 23:19:10 UTC (rev 5753)
+++ trunk/Src/Common/coretools.h 2008-08-08 02:11:51 UTC (rev 5754)
@@ -47,15 +47,6 @@
/******** function protos ********/
template <class T>
-void swap(T *a,T *b)
-{
- T tmp;
- tmp=*a;
- *a=*b;
- *b=tmp;
-}
-
-template <class T>
void selection_sort(T *ary, UINT cnt)
{
register int i,j,smallest;
Modified: trunk/Src/DiffList.cpp
===================================================================
--- trunk/Src/DiffList.cpp 2008-08-07 23:19:10 UTC (rev 5753)
+++ trunk/Src/DiffList.cpp 2008-08-08 02:11:51 UTC (rev 5754)
@@ -22,41 +22,15 @@
// ID line follows -- this is updated by SVN
// $Id$
-#include "stdafx.h"
+#include "StdAfx.h"
#include "DiffList.h"
#include "DiffWrapper.h"
#include "coretools.h"
-using namespace std;
+using std::swap;
+using std::vector;
-static void swap(int &a, int &b);
-static void swap(UINT &a, UINT &b);
-
/**
- * @brief Swap two integers.
- * @param [in] a First integer.
- * @param [in] b Second integer.
- */
-static void swap(int &a, int &b)
-{
- int tmp = a;
- a = b;
- b = tmp;
-}
-
-/**
- * @brief Swap two UINTs.
- * @param [in] a First UINT.
- * @param [in] b Second UINT.
- */
-static void swap(UINT &a, UINT &b)
-{
- UINT tmp = a;
- a = b;
- b = tmp;
-}
-
-/**
* @brief Swap diff sides.
*/
void DIFFRANGE::swap_sides()
Modified: trunk/Src/MergeDoc.cpp
===================================================================
--- trunk/Src/MergeDoc.cpp 2008-08-07 23:19:10 UTC (rev 5753)
+++ trunk/Src/MergeDoc.cpp 2008-08-08 02:11:51 UTC (rev 5754)
@@ -27,23 +27,23 @@
// ID line follows -- this is updated by SVN
// $Id$
-#include "stdafx.h"
-#include <Shlwapi.h> // PathCompactPathEx()
+#include "StdAfx.h"
+#include <shlwapi.h> // PathCompactPathEx()
#include "UnicodeString.h"
#include "Merge.h"
#include "MainFrm.h"
#include "DiffTextBuffer.h"
#include "Environment.h"
#include "Ucs2Utf8.h"
-#include "diffcontext.h" // FILE_SAME
+#include "DiffContext.h" // FILE_SAME
#include "MovedLines.h"
-#include "getopt.h"
-#include "fnmatch.h"
+#include "GETOPT.H"
+#include "FNMATCH.H"
#include "coretools.h"
#include "MergeEditView.h"
#include "MergeDiffDetailView.h"
-#include "childFrm.h"
-#include "dirdoc.h"
+#include "ChildFrm.h"
+#include "DirDoc.h"
#include "files.h"
#include "WaitStatusCursor.h"
#include "FileTransform.h"
@@ -69,6 +69,8 @@
static char THIS_FILE[] = __FILE__;
#endif
+using std::swap;
+
/** @brief Max len of path in caption. */
static const UINT CAPTION_PATH_MAX = 50;
@@ -2528,13 +2530,13 @@
m_pDetailView[1]->SetDlgCtrlID(nLeftDetailViewId);
// Swap buffers and so on
- swap<CDiffTextBuffer *>(&m_ptBuf[0], &m_ptBuf[1]);
- swap<CMergeEditView *>(&m_pView[0], &m_pView[1]);
- swap<CMergeDiffDetailView *>(&m_pDetailView[0], &m_pDetailView[1]);
- swap<DiffFileInfo *>(&m_pSaveFileInfo[0], &m_pSaveFileInfo[1]);
- swap<DiffFileInfo *>(&m_pRescanFileInfo[0], &m_pRescanFileInfo[1]);
- swap<BUFFERTYPE>(&m_nBufferType[0], &m_nBufferType[1]);
- swap<BOOL>(&m_bEditAfterRescan[0], &m_bEditAfterRescan[1]);
+ swap(m_ptBuf[0], m_ptBuf[1]);
+ swap(m_pView[0], m_pView[1]);
+ swap(m_pDetailView[0], m_pDetailView[1]);
+ swap(m_pSaveFileInfo[0], m_pSaveFileInfo[1]);
+ swap(m_pRescanFileInfo[0], m_pRescanFileInfo[1]);
+ swap(m_nBufferType[0], m_nBufferType[1]);
+ swap(m_bEditAfterRescan[0], m_bEditAfterRescan[1]);
m_strDesc[0].swap(m_strDesc[1]);
m_filePaths.Swap();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|