discord-rpc: Formatting
This commit is contained in:
13
3rdparty/discord-rpc/src/backoff.h
vendored
13
3rdparty/discord-rpc/src/backoff.h
vendored
@@ -18,22 +18,15 @@ struct Backoff {
|
|||||||
double rand01() { return randDistribution(randGenerator); }
|
double rand01() { return randDistribution(randGenerator); }
|
||||||
|
|
||||||
Backoff(int64_t min, int64_t max)
|
Backoff(int64_t min, int64_t max)
|
||||||
: minAmount(min)
|
: minAmount(min), maxAmount(max), current(min), fails(0), randGenerator(static_cast<uint64_t>(time(0))) {
|
||||||
, maxAmount(max)
|
|
||||||
, current(min)
|
|
||||||
, fails(0)
|
|
||||||
, randGenerator(static_cast<uint64_t>(time(0)))
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset() {
|
||||||
{
|
|
||||||
fails = 0;
|
fails = 0;
|
||||||
current = minAmount;
|
current = minAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t nextDelay()
|
int64_t nextDelay() {
|
||||||
{
|
|
||||||
++fails;
|
++fails;
|
||||||
int64_t delay = static_cast<int64_t>(static_cast<double>(current) * 2.0 * rand01());
|
int64_t delay = static_cast<int64_t>(static_cast<double>(current) * 2.0 * rand01());
|
||||||
current = std::min(current + delay, maxAmount);
|
current = std::min(current + delay, maxAmount);
|
||||||
|
|||||||
1
3rdparty/discord-rpc/src/connection_unix.cpp
vendored
1
3rdparty/discord-rpc/src/connection_unix.cpp
vendored
@@ -119,4 +119,3 @@ bool BaseConnection::Read(void *data, size_t length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace discord_rpc
|
} // namespace discord_rpc
|
||||||
|
|
||||||
|
|||||||
1
3rdparty/discord-rpc/src/connection_win.cpp
vendored
1
3rdparty/discord-rpc/src/connection_win.cpp
vendored
@@ -123,4 +123,3 @@ bool BaseConnection::Read(void *data, size_t length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace discord_rpc
|
} // namespace discord_rpc
|
||||||
|
|
||||||
|
|||||||
@@ -101,4 +101,3 @@ extern "C" void Discord_RegisterSteamGame(const char *applicationId,
|
|||||||
sprintf(command, "xdg-open steam://rungameid/%s", steamId);
|
sprintf(command, "xdg-open steam://rungameid/%s", steamId);
|
||||||
Discord_Register(applicationId, command);
|
Discord_Register(applicationId, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -180,4 +180,3 @@ extern "C" void Discord_RegisterSteamGame(const char *applicationId,
|
|||||||
|
|
||||||
Discord_RegisterW(appId, command);
|
Discord_RegisterW(appId, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
3rdparty/discord-rpc/src/discord_rpc.cpp
vendored
4
3rdparty/discord-rpc/src/discord_rpc.cpp
vendored
@@ -346,8 +346,7 @@ extern "C" void Discord_Shutdown(void) {
|
|||||||
extern "C" void Discord_UpdatePresence(const DiscordRichPresence *presence) {
|
extern "C" void Discord_UpdatePresence(const DiscordRichPresence *presence) {
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(PresenceMutex);
|
std::lock_guard<std::mutex> guard(PresenceMutex);
|
||||||
QueuedPresence.length = JsonWriteRichPresenceObj(
|
QueuedPresence.length = JsonWriteRichPresenceObj(QueuedPresence.buffer, sizeof(QueuedPresence.buffer), Nonce++, Pid, presence);
|
||||||
QueuedPresence.buffer, sizeof(QueuedPresence.buffer), Nonce++, Pid, presence);
|
|
||||||
UpdatePresence.exchange(true);
|
UpdatePresence.exchange(true);
|
||||||
}
|
}
|
||||||
SignalIOActivity();
|
SignalIOActivity();
|
||||||
@@ -476,4 +475,3 @@ extern "C" void Discord_UpdateHandlers(DiscordEventHandlers *newHandlers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace discord_rpc
|
} // namespace discord_rpc
|
||||||
|
|
||||||
|
|||||||
6
3rdparty/discord-rpc/src/msg_queue.h
vendored
6
3rdparty/discord-rpc/src/msg_queue.h
vendored
@@ -17,8 +17,7 @@ class MsgQueue {
|
|||||||
public:
|
public:
|
||||||
MsgQueue() {}
|
MsgQueue() {}
|
||||||
|
|
||||||
ElementType* GetNextAddMessage()
|
ElementType *GetNextAddMessage() {
|
||||||
{
|
|
||||||
// if we are falling behind, bail
|
// if we are falling behind, bail
|
||||||
if (pendingSends_.load() >= QueueSize) {
|
if (pendingSends_.load() >= QueueSize) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -29,8 +28,7 @@ public:
|
|||||||
void CommitAdd() { ++pendingSends_; }
|
void CommitAdd() { ++pendingSends_; }
|
||||||
|
|
||||||
bool HavePendingSends() const { return pendingSends_.load() != 0; }
|
bool HavePendingSends() const { return pendingSends_.load() != 0; }
|
||||||
ElementType* GetNextSendMessage()
|
ElementType *GetNextSendMessage() {
|
||||||
{
|
|
||||||
auto index = (nextSend_++) % QueueSize;
|
auto index = (nextSend_++) % QueueSize;
|
||||||
return &queue_[index];
|
return &queue_[index];
|
||||||
}
|
}
|
||||||
|
|||||||
1
3rdparty/discord-rpc/src/rpc_connection.cpp
vendored
1
3rdparty/discord-rpc/src/rpc_connection.cpp
vendored
@@ -130,4 +130,3 @@ bool RpcConnection::Read(JsonDocument &message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace discord_rpc
|
} // namespace discord_rpc
|
||||||
|
|
||||||
|
|||||||
1
3rdparty/discord-rpc/src/rpc_connection.h
vendored
1
3rdparty/discord-rpc/src/rpc_connection.h
vendored
@@ -61,4 +61,3 @@ struct RpcConnection {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace discord_rpc
|
} // namespace discord_rpc
|
||||||
|
|
||||||
|
|||||||
1
3rdparty/discord-rpc/src/serialization.cpp
vendored
1
3rdparty/discord-rpc/src/serialization.cpp
vendored
@@ -246,4 +246,3 @@ size_t JsonWriteJoinReply(char *dest, size_t maxLen, const char *userId, int rep
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace discord_rpc
|
} // namespace discord_rpc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user