summaryrefslogtreecommitdiff
path: root/protocols/Discord
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-09-21 23:08:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-09-21 23:08:34 +0300
commit8c2496120f46b59641cac79a431c51d12606a6dd (patch)
treea18dc51a5f024fcda5c7655eff9efce00bd96a0b /protocols/Discord
parentde49de5f2c3fd25902a263b047ff8c71f5d43545 (diff)
Discord: two more fixed comparisons
Diffstat (limited to 'protocols/Discord')
-rw-r--r--protocols/Discord/src/guilds.cpp6
-rw-r--r--protocols/Discord/src/proto.cpp5
-rw-r--r--protocols/Discord/src/proto.h5
3 files changed, 7 insertions, 9 deletions
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 98f5d3dcaa..bd19bca92f 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -17,16 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-int compareUsers(const CDiscordUser *p1, const CDiscordUser *p2);
-
static int compareRoles(const CDiscordRole *p1, const CDiscordRole *p2)
{
- return p1->id - p2->id;
+ return compareInt64(p1->id, p2->id);
}
static int compareChatUsers(const CDiscordGuildMember *p1, const CDiscordGuildMember *p2)
{
- return p1->userId - p2->userId;
+ return compareInt64(p1->userId, p2->userId);
}
CDiscordGuild::CDiscordGuild(SnowFlake _id)
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index 941fc5917b..7784b1f761 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -17,11 +17,6 @@ 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 compareInt64(*p1, *p2);
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index 1dd1b733b7..e052023d31 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -1,6 +1,11 @@
typedef __int64 SnowFlake;
+__forceinline int compareInt64(const SnowFlake i1, const SnowFlake i2)
+{
+ return (i1 == i2) ? 0 : (i1 < i2) ? -1 : 1;
+}
+
class CDiscordProto;
typedef void (CDiscordProto::*HttpCallback)(NETLIBHTTPREQUEST*, struct AsyncHttpRequest*);
typedef void (CDiscordProto::*GatewayHandlerFunc)(const JSONNode&);