Enable all warnings, turn the noisy ones back off, fix the others.
This commit is contained in:
parent
39ff0bf3e4
commit
6fa00223ad
6 changed files with 31 additions and 11 deletions
|
@ -29,7 +29,17 @@ if(WIN32)
|
|||
add_definitions(-DDISCORD_WINDOWS)
|
||||
set(BASE_RPC_SRC ${BASE_RPC_SRC} connection_win.cpp discord_register_win.cpp)
|
||||
add_library(discord-rpc ${RPC_LIBRARY_TYPE} ${BASE_RPC_SRC})
|
||||
target_compile_options(discord-rpc PRIVATE /W4)
|
||||
target_compile_options(discord-rpc PRIVATE /EHsc
|
||||
/Wall
|
||||
/wd4514 # unreferenced inline
|
||||
/wd4625 # copy constructor deleted
|
||||
/wd5026 # move constructor deleted
|
||||
/wd4626 # move assignment operator deleted
|
||||
/wd4710 # function not inlined
|
||||
/wd4820 # structure padding
|
||||
/wd4946 # reinterpret_cast used between related classes
|
||||
/wd5027 # move assignment operator was implicitly defined as deleted
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
if(UNIX)
|
||||
|
|
|
@ -20,7 +20,7 @@ struct Backoff {
|
|||
, maxAmount(max)
|
||||
, current(min)
|
||||
, fails(0)
|
||||
, randGenerator(time(0))
|
||||
, randGenerator((uint64_t)time(0))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
int GetProcessId()
|
||||
{
|
||||
return ::GetCurrentProcessId();
|
||||
return (int)::GetCurrentProcessId();
|
||||
}
|
||||
|
||||
struct BaseConnectionWin : public BaseConnection {
|
||||
|
|
|
@ -17,9 +17,8 @@ void Discord_RegisterW(const wchar_t* applicationId, const wchar_t* command)
|
|||
// Update the HKEY_CURRENT_USER, because it doesn't seem to require special permissions.
|
||||
|
||||
wchar_t exeFilePath[MAX_PATH];
|
||||
int exeLen = GetModuleFileNameExW(GetCurrentProcess(), nullptr, exeFilePath, MAX_PATH);
|
||||
DWORD exeLen = GetModuleFileNameExW(GetCurrentProcess(), nullptr, exeFilePath, MAX_PATH);
|
||||
wchar_t openCommand[1024];
|
||||
const auto commandBufferLen = sizeof(openCommand) / sizeof(*openCommand);
|
||||
|
||||
if (command && command[0]) {
|
||||
StringCbPrintfW(openCommand, sizeof(openCommand), L"%s", command);
|
||||
|
@ -46,14 +45,14 @@ void Discord_RegisterW(const wchar_t* applicationId, const wchar_t* command)
|
|||
}
|
||||
DWORD len;
|
||||
LSTATUS result;
|
||||
len = lstrlenW(protocolDescription) + 1;
|
||||
len = (DWORD)lstrlenW(protocolDescription) + 1;
|
||||
result =
|
||||
RegSetKeyValueW(key, nullptr, nullptr, REG_SZ, protocolDescription, len * sizeof(wchar_t));
|
||||
if (FAILED(result)) {
|
||||
fprintf(stderr, "Error writing description\n");
|
||||
}
|
||||
|
||||
len = lstrlenW(protocolDescription) + 1;
|
||||
len = (DWORD)lstrlenW(protocolDescription) + 1;
|
||||
result = RegSetKeyValueW(key, nullptr, L"URL Protocol", REG_SZ, &urlProtocol, sizeof(wchar_t));
|
||||
if (FAILED(result)) {
|
||||
fprintf(stderr, "Error writing description\n");
|
||||
|
@ -65,7 +64,7 @@ void Discord_RegisterW(const wchar_t* applicationId, const wchar_t* command)
|
|||
fprintf(stderr, "Error writing icon\n");
|
||||
}
|
||||
|
||||
len = lstrlenW(openCommand) + 1;
|
||||
len = (DWORD)lstrlenW(openCommand) + 1;
|
||||
result = RegSetKeyValueW(
|
||||
key, L"shell\\open\\command", nullptr, REG_SZ, openCommand, len * sizeof(wchar_t));
|
||||
if (FAILED(result)) {
|
||||
|
|
|
@ -129,6 +129,7 @@ bool RpcConnection::Read(JsonDocument& message)
|
|||
break;
|
||||
case Opcode::Pong:
|
||||
break;
|
||||
case Opcode::Handshake:
|
||||
default:
|
||||
// something bad happened
|
||||
lastErrorCode = (int)ErrorCode::ReadCorrupt;
|
||||
|
|
|
@ -2,10 +2,20 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma warning(push)
|
||||
|
||||
#pragma warning(disable : 4061) // enum is not explicitly handled by a case label
|
||||
#pragma warning(disable : 4365) // signed/unsigned mismatch
|
||||
#pragma warning(disable : 4464) // relative include path contains
|
||||
#pragma warning(disable : 4668) // is not defined as a preprocessor macro
|
||||
#pragma warning(disable : 6313) // Incorrect operator
|
||||
|
||||
#include "rapidjson/document.h"
|
||||
#include "rapidjson/writer.h"
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
// if only there was a standard library function for this
|
||||
template <size_t Len>
|
||||
inline size_t StringCopy(char (&dest)[Len], const char* src)
|
||||
|
@ -111,7 +121,7 @@ public:
|
|||
}
|
||||
}
|
||||
void Flush() {}
|
||||
size_t GetSize() const { return current_ - buffer_; }
|
||||
size_t GetSize() const { return (size_t)(current_ - buffer_); }
|
||||
};
|
||||
|
||||
using MallocAllocator = rapidjson::CrtAllocator;
|
||||
|
|
Loading…
Reference in a new issue