Small fixes to the Discord integration

Removed the redundant string length checks
Closes #1066
This commit is contained in:
David Hrdlička
2020-11-12 21:27:11 +01:00
committed by GitHub
parent 118da6baac
commit 474c0dfc1d

View File

@@ -45,7 +45,7 @@ static dllimp_t discord_imports[] = {
{ NULL, NULL } { NULL, NULL }
}; };
#ifndef ENABLE_DISCORD_LOG #ifdef ENABLE_DISCORD_LOG
int discord_do_log = 1; int discord_do_log = 1;
@@ -88,16 +88,8 @@ discord_update_activity(int paused)
else else
{ {
temp = strchr(machine_getname(), ']') + 2; temp = strchr(machine_getname(), ']') + 2;
strncpy(activity.details, temp, 127);
if (strlen(temp) <= 127) strncpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name, 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);
} }
activity.timestamps.start = time(NULL); activity.timestamps.start = time(NULL);