Revision: 7429
          http://winmerge.svn.sourceforge.net/winmerge/?rev=7429&view=rev
Author:   gerundt
Date:     2010-11-16 14:34:03 +0000 (Tue, 16 Nov 2010)
Log Message:
-----------
PATCH: #2919510 TimeSizecompare
 Submitted by Matthias Mayer
 Comparing files by size also always compared by time.
Modified Paths:
--------------
    branches/R2_14/Docs/Users/ChangeLog.txt
    branches/R2_14/Src/CompareEngines/TimeSizeCompare.cpp
Modified: branches/R2_14/Docs/Users/ChangeLog.txt
===================================================================
--- branches/R2_14/Docs/Users/ChangeLog.txt	2010-11-16 14:27:33 UTC (rev 7428)
+++ branches/R2_14/Docs/Users/ChangeLog.txt	2010-11-16 14:34:03 UTC (rev 7429)
@@ -19,6 +19,7 @@
     in status bar (#3025855)
   Bugfix: Pane headers not updated after language change (#2923684)
   Bugfix: Quick contents compare didn't ignore EOL byte differences (#2929005)
+  Bugfix: Compare by size always checked file times too (#2919510)
 
 WinMerge 2.13.20 - 2010-10-20 (r7319)
   Add missing keywords to Pascal highlighter (#2834192)
Modified: branches/R2_14/Src/CompareEngines/TimeSizeCompare.cpp
===================================================================
--- branches/R2_14/Src/CompareEngines/TimeSizeCompare.cpp	2010-11-16 14:27:33 UTC (rev 7428)
+++ branches/R2_14/Src/CompareEngines/TimeSizeCompare.cpp	2010-11-16 14:34:03 UTC (rev 7429)
@@ -40,40 +40,39 @@
  */
 int TimeSizeCompare::CompareFiles(int compMethod, const DIFFITEM &di)
 {
-	UINT code = 0;
-
-	// Compare by modified date
-	// Check that we have both filetimes
-	if (di.left.mtime != 0 && di.right.mtime != 0)
+	UINT code = DIFFCODE::SAME;
+	if ((compMethod == CMP_DATE) || (compMethod == CMP_DATE_SIZE))
 	{
-		INT64 nTimeDiff = di.left.mtime - di.right.mtime;
-		// Remove sign
-		nTimeDiff = (nTimeDiff > 0 ? nTimeDiff : -nTimeDiff);
-		if (m_ignoreSmallDiff)
+		// Compare by modified date
+		// Check that we have both filetimes
+		if (di.left.mtime != 0 && di.right.mtime != 0)
 		{
-			// If option to ignore small timediffs (couple of seconds)
-			// is set, decrease absolute difference by allowed diff
-			nTimeDiff -= SmallTimeDiff;
+			INT64 nTimeDiff =_abs64(di.left.mtime - di.right.mtime);
+			if (m_ignoreSmallDiff)
+			{
+				// If option to ignore small timediffs (couple of seconds)
+				// is set, decrease absolute difference by allowed diff
+				nTimeDiff -= SmallTimeDiff;
+			}
+			if (nTimeDiff <= 0)
+				code = DIFFCODE::SAME;
+			else
+				code = DIFFCODE::DIFF;
 		}
-		if (nTimeDiff <= 0)
-			code = DIFFCODE::SAME;
 		else
-			code = DIFFCODE::DIFF;
+		{
+			// Filetimes for item(s) could not be read. So we have to
+			// set error status, unless we have DATE_SIZE -compare
+			// when we have still hope for size compare..
+			if (compMethod == CMP_DATE_SIZE)
+				code = DIFFCODE::SAME;
+			else
+				code = DIFFCODE::CMPERR;
+		}
 	}
-	else
-	{
-		// Filetimes for item(s) could not be read. So we have to
-		// set error status, unless we have DATE_SIZE -compare
-		// when we have still hope for size compare..
-		if (compMethod == CMP_DATE_SIZE)
-			code = DIFFCODE::SAME;
-		else
-			code = DIFFCODE::CMPERR;
-	}
-
-	// This is actual CMP_DATE_SIZE method..
+	// This is actual CMP_SIZE method..
 	// If file sizes differ mark them different
-	if (compMethod == CMP_DATE_SIZE)
+	if ((compMethod == CMP_DATE_SIZE) || (compMethod == CMP_SIZE))
 	{
 		if (di.left.size != di.right.size)
 		{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |