diff options
author | George Hazan <ghazan@miranda.im> | 2017-09-21 22:42:00 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-09-21 22:42:00 +0300 |
commit | de49de5f2c3fd25902a263b047ff8c71f5d43545 (patch) | |
tree | f48d40ccf455e243c4b850e2a4700883d1c67c36 /protocols/Discord/src/proto.cpp | |
parent | a487776816aacc4ee218e7acd481527362bfc7ff (diff) |
Discord: fix for guild sorting order
Diffstat (limited to 'protocols/Discord/src/proto.cpp')
-rw-r--r-- | protocols/Discord/src/proto.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index b384f34be8..941fc5917b 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -17,9 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" +__forceinline int compareInt64(const SnowFlake i1, const SnowFlake i2) +{ + return (i1 == i2) ? 0 : (i1 < i2) ? -1 : 1; +} + static int compareMessages(const SnowFlake *p1, const SnowFlake *p2) { - return *p1 - *p2; + return compareInt64(*p1, *p2); } static int compareRequests(const AsyncHttpRequest *p1, const AsyncHttpRequest *p2) @@ -29,12 +34,12 @@ static int compareRequests(const AsyncHttpRequest *p1, const AsyncHttpRequest *p int compareUsers(const CDiscordUser *p1, const CDiscordUser *p2) { - return p1->id - p2->id; + return compareInt64(p1->id, p2->id); } static int compareGuilds(const CDiscordGuild *p1, const CDiscordGuild *p2) { - return p1->id - p2->id; + return compareInt64(p1->id, p2->id); } CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : |