*/
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)
{