Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Subaric <deadmeu@gmail.com>2018-02-11 13:29:13 +0300
committerAlex Subaric <deadmeu@gmail.com>2018-02-11 13:29:13 +0300
commit9382f770f8e3448707ef2ac819070415f327b40a (patch)
treea1293113436f177ebec73b5b2e331670443d7352
parent6698163e8ac5eebf265eeef040c639c95ec26ebe (diff)
Corrected the implementation of the operator< overload and improved the formatting of the operator== overload to make it more readable.
-rw-r--r--windirstat/item.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/windirstat/item.h b/windirstat/item.h
index abb635c..2624779 100644
--- a/windirstat/item.h
+++ b/windirstat/item.h
@@ -66,18 +66,14 @@ inline bool IsLeaf(ITEMTYPE t) { return ((t == IT_FILE) | (t == IT_FREESPACE) |
// Compare FILETIMEs
inline bool operator< (const FILETIME& t1, const FILETIME& t2)
{
- // FIXME: it is *not* appropriate to cast like this due to alignment issues
- // see <http://blogs.msdn.com/b/oldnewthing/archive/2004/08/25/220195.aspx>
- ULONGLONG& u1 = (ULONGLONG&)t1;
- ULONGLONG& u2 = (ULONGLONG&)t2;
-
- return (u1 < u2);
+ return (t1.dwHighDateTime < t2.dwHighDateTime)
+ || (t1.dwHighDateTime == t2.dwHighDateTime) && (t1.dwLowDateTime < t2.dwLowDateTime);
}
// Compare FILETIMEs
-inline bool operator == (const FILETIME& t1, const FILETIME& t2)
+inline bool operator== (const FILETIME& t1, const FILETIME& t2)
{
- return t1.dwLowDateTime == t2.dwLowDateTime && t1.dwHighDateTime == t2.dwHighDateTime;
+ return (t1.dwLowDateTime == t2.dwLowDateTime) && (t1.dwHighDateTime == t2.dwHighDateTime);
}
//