mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-12-22 23:35:38 +00:00
Enable warnings, clang edition.
This commit is contained in:
parent
6fa00223ad
commit
990c8d4be6
|
@ -64,14 +64,14 @@ DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
|
|||
DiscordEventHandlers* handlers,
|
||||
int autoRegister,
|
||||
const char* optionalSteamId);
|
||||
DISCORD_EXPORT void Discord_Shutdown();
|
||||
DISCORD_EXPORT void Discord_Shutdown(void);
|
||||
|
||||
/* checks for incoming messages, dispatches callbacks */
|
||||
DISCORD_EXPORT void Discord_RunCallbacks();
|
||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
|
||||
|
||||
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
|
||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||
DISCORD_EXPORT void Discord_UpdateConnection();
|
||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
|
||||
|
|
|
@ -55,7 +55,19 @@ if(UNIX)
|
|||
|
||||
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC})
|
||||
target_link_libraries(discord-rpc PUBLIC pthread)
|
||||
target_compile_options(discord-rpc PRIVATE -g -Wall)
|
||||
target_compile_options(discord-rpc PRIVATE
|
||||
-g
|
||||
-Weverything
|
||||
-Wno-unknown-pragmas # pragma push thing doesn't work on clang
|
||||
-Wno-old-style-cast # it's fine
|
||||
-Wno-c++98-compat # that was almost 2 decades ago
|
||||
-Wno-c++98-compat-pedantic
|
||||
-Wno-missing-noreturn
|
||||
-Wno-padded # structure padding
|
||||
-Wno-covered-switch-default
|
||||
-Wno-exit-time-destructors # not sure about these
|
||||
-Wno-global-constructors
|
||||
)
|
||||
target_compile_options(discord-rpc PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-std=c++14>)
|
||||
|
||||
if (APPLE)
|
||||
|
|
|
@ -111,7 +111,7 @@ bool BaseConnection::Read(void* data, size_t length)
|
|||
return false;
|
||||
}
|
||||
|
||||
int res = recv(self->sock, data, length, MsgFlags);
|
||||
int res = (int)recv(self->sock, data, length, MsgFlags);
|
||||
if (res < 0) {
|
||||
if (errno == EAGAIN) {
|
||||
return false;
|
||||
|
|
|
@ -47,8 +47,8 @@ static int LastDisconnectErrorCode{0};
|
|||
static char LastDisconnectErrorMessage[256];
|
||||
static std::mutex PresenceMutex;
|
||||
static QueuedMessage QueuedPresence{};
|
||||
MsgQueue<QueuedMessage, MessageQueueSize> SendQueue;
|
||||
MsgQueue<DiscordJoinRequest, MessageQueueSize> JoinAskQueue;
|
||||
static MsgQueue<QueuedMessage, MessageQueueSize> SendQueue;
|
||||
static MsgQueue<DiscordJoinRequest, JoinQueueSize> JoinAskQueue;
|
||||
|
||||
// We want to auto connect, and retry on failure, but not as fast as possible. This does expoential
|
||||
// backoff from 0.5 seconds to 1 minute
|
||||
|
@ -70,7 +70,11 @@ static void UpdateReconnectTime()
|
|||
std::chrono::duration<int64_t, std::milli>{ReconnectTimeMs.nextDelay()};
|
||||
}
|
||||
|
||||
DISCORD_EXPORT void Discord_UpdateConnection()
|
||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||
DISCORD_EXPORT void Discord_UpdateConnection(void)
|
||||
#else
|
||||
static void Discord_UpdateConnection(void)
|
||||
#endif
|
||||
{
|
||||
if (!Connection) {
|
||||
return;
|
||||
|
@ -173,7 +177,7 @@ DISCORD_EXPORT void Discord_UpdateConnection()
|
|||
}
|
||||
|
||||
#ifndef DISCORD_DISABLE_IO_THREAD
|
||||
void DiscordRpcIo()
|
||||
static void DiscordRpcIo(void)
|
||||
{
|
||||
const std::chrono::duration<int64_t, std::milli> maxWait{500LL};
|
||||
|
||||
|
@ -186,14 +190,14 @@ void DiscordRpcIo()
|
|||
}
|
||||
#endif
|
||||
|
||||
void SignalIOActivity()
|
||||
static void SignalIOActivity()
|
||||
{
|
||||
#ifndef DISCORD_DISABLE_IO_THREAD
|
||||
WaitForIOActivity.notify_all();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RegisterForEvent(const char* evtName)
|
||||
static bool RegisterForEvent(const char* evtName)
|
||||
{
|
||||
auto qmessage = SendQueue.GetNextAddMessage();
|
||||
if (qmessage) {
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#include "discord_register.h"
|
||||
|
||||
static bool Mkdir(const char* path)
|
||||
{
|
||||
int result = mkdir(path, 0755);
|
||||
|
@ -39,7 +41,7 @@ static void RegisterCommand(const char* applicationId, const char* command)
|
|||
if (f) {
|
||||
char jsonBuffer[2048];
|
||||
int len = snprintf(jsonBuffer, sizeof(jsonBuffer), "{\"command\": \"%s\"}", command);
|
||||
fwrite(jsonBuffer, len, 1, f);
|
||||
fwrite(jsonBuffer, (size_t)len, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class MsgQueue {
|
|||
std::atomic_uint pendingSends_{0};
|
||||
|
||||
public:
|
||||
MsgQueue(){};
|
||||
MsgQueue(){}
|
||||
|
||||
ElementType* GetNextAddMessage()
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ void WriteOptionalString(JsonWriter& w, T& k, const char* value)
|
|||
}
|
||||
}
|
||||
|
||||
void JsonWriteNonce(JsonWriter& writer, int nonce)
|
||||
static void JsonWriteNonce(JsonWriter& writer, int nonce)
|
||||
{
|
||||
WriteKey(writer, "nonce");
|
||||
char nonceBuffer[32];
|
||||
|
|
Loading…
Reference in a new issue