From 474c0dfc1d3c2436b267e337c0ffbb61284e37bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 12 Nov 2020 21:27:11 +0100 Subject: [PATCH] Small fixes to the Discord integration Removed the redundant string length checks Closes #1066 --- src/win/win_discord.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/win/win_discord.c b/src/win/win_discord.c index ec379ea9f..60d8cf0fe 100644 --- a/src/win/win_discord.c +++ b/src/win/win_discord.c @@ -45,7 +45,7 @@ static dllimp_t discord_imports[] = { { NULL, NULL } }; -#ifndef ENABLE_DISCORD_LOG +#ifdef ENABLE_DISCORD_LOG int discord_do_log = 1; @@ -88,16 +88,8 @@ discord_update_activity(int paused) else { temp = strchr(machine_getname(), ']') + 2; - - if (strlen(temp) <= 127) - strcpy(activity.details, temp); - else - strncpy(activity.details, temp, 127); - - if (strlen(machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name) <= 127) - strcpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name); - else - strncpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name, 127); + strncpy(activity.details, temp, 127); + strncpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name, 127); } activity.timestamps.start = time(NULL);