From: Kimmo Varis Date: Tue, 4 May 2010 18:11:48 +0000 (+0000) Subject: PATCH: #2919510 TimeSizecompare X-Git-Tag: 2.16.4+-jp-10~1406^2~53 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=db5b289911884269c5819ad4a280fdff12e5dfad;p=winmerge-jp%2Fwinmerge-jp.git PATCH: #2919510 TimeSizecompare Submitted by Matthias Mayer Comparing files by size also always compared by time. --- diff --git a/Docs/Users/ChangeLog.txt b/Docs/Users/ChangeLog.txt index 4895ad22b..cbfda6a45 100644 --- a/Docs/Users/ChangeLog.txt +++ b/Docs/Users/ChangeLog.txt @@ -6,6 +6,7 @@ http://winmerge.org/tracker/[tracker-id] WinMerge 2.13.13 Installer: Embed MS runtime files installer for x64 (r7150) Allow DOS-style pattern matching in Open-dialog filters (#2988369) + Bugfix: Compare by size always checked file times too (#2919510) WinMerge 2.13.12 - 2010-04-29 (r7148) Update copyright year to 2010 diff --git a/Src/CompareEngines/TimeSizeCompare.cpp b/Src/CompareEngines/TimeSizeCompare.cpp index d92716a45..9a72dd230 100644 --- a/Src/CompareEngines/TimeSizeCompare.cpp +++ b/Src/CompareEngines/TimeSizeCompare.cpp @@ -40,40 +40,39 @@ void TimeSizeCompare::SetAdditionalOptions(bool ignoreSmallDiff) */ 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; - } - 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; + { + // 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) {