fix some warnings, format

This commit is contained in:
Chris Marsh 2017-07-27 13:52:37 -07:00
parent f617f3b78d
commit bfcfd10baa
5 changed files with 13 additions and 6 deletions

View file

@ -32,7 +32,9 @@ typedef struct DiscordEventHandlers {
void (*spectateGame)(const char* spectateSecret); void (*spectateGame)(const char* spectateSecret);
} DiscordEventHandlers; } DiscordEventHandlers;
void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers, int autoRegister); void Discord_Initialize(const char* applicationId,
DiscordEventHandlers* handlers,
int autoRegister);
void Discord_Shutdown(); void Discord_Shutdown();
/* checks for incoming messages, dispatches callbacks */ /* checks for incoming messages, dispatches callbacks */

View file

@ -10,6 +10,7 @@ set(BASE_RPC_SRC ${PROJECT_SOURCE_DIR}/include/discord-rpc.h discord-rpc.cpp dis
if(WIN32) if(WIN32)
add_library(discord-rpc STATIC ${BASE_RPC_SRC} connection_win.cpp) add_library(discord-rpc STATIC ${BASE_RPC_SRC} connection_win.cpp)
target_compile_options(discord-rpc PRIVATE /W4)
endif(WIN32) endif(WIN32)
if(UNIX) if(UNIX)

View file

@ -1,4 +1,3 @@
#pragma once #pragma once
void Discord_Register(const char* applicationId); void Discord_Register(const char* applicationId);

View file

@ -22,7 +22,6 @@ struct QueuedMessage {
}; };
static RpcConnection* Connection{nullptr}; static RpcConnection* Connection{nullptr};
static char ApplicationId[64]{};
static DiscordEventHandlers Handlers{}; static DiscordEventHandlers Handlers{};
static std::atomic_bool WasJustConnected{false}; static std::atomic_bool WasJustConnected{false};
static std::atomic_bool WasJustDisconnected{false}; static std::atomic_bool WasJustDisconnected{false};
@ -180,7 +179,9 @@ bool RegisterForEvent(const char* evtName)
return false; return false;
} }
extern "C" void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers, int autoRegister) extern "C" void Discord_Initialize(const char* applicationId,
DiscordEventHandlers* handlers,
int autoRegister)
{ {
if (autoRegister) { if (autoRegister) {
Discord_Register(applicationId); Discord_Register(applicationId);

View file

@ -11,7 +11,7 @@
template <size_t Len> template <size_t Len>
inline size_t StringCopy(char (&dest)[Len], const char* src) inline size_t StringCopy(char (&dest)[Len], const char* src)
{ {
if (!dest || !src || !Len) { if (!src || !Len) {
return 0; return 0;
} }
size_t copied; size_t copied;
@ -71,7 +71,11 @@ public:
assert(!originalPtr && !originalSize); assert(!originalPtr && !originalSize);
return Malloc(newSize); return Malloc(newSize);
} }
static void Free(void* ptr) { /* shrug */} static void Free(void* ptr)
{
/* shrug */
(void)ptr;
}
}; };
template <size_t Size> template <size_t Size>