From dc17d19cd1e0b1d90066b56fec4997dab535f9c6 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 9 Jun 2020 20:26:00 +0300 Subject: [PATCH] use snprintf() instead of itoa() --- src/pc/discord/discordrpc.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/src/pc/discord/discordrpc.c b/src/pc/discord/discordrpc.c index 870657bb..2a740bda 100644 --- a/src/pc/discord/discordrpc.c +++ b/src/pc/discord/discordrpc.c @@ -13,7 +13,6 @@ #if defined(_WIN32) #include #define DISCORDLIBEXT ".dll" -#define itoa(int, str) itoa(int, str, "10") #define dlopen(lib, flag) LoadLibrary(TEXT(lib)) #define dlerror() "" #define dlsym(handle, func) GetProcAddress(handle, func) @@ -136,35 +135,6 @@ void convertstring(const u8 *str, char* output) output[strPos] = '\0'; } -#ifndef _WIN32 -void reverse(char s[]) -{ - int i, j; - char c; - - for (i = 0, j = strlen(s)-1; i 0); - - s[i] = '\0'; - reverse(s); -} -#endif - void OnReady( const DiscordUser* user ) { discordReset(); @@ -260,7 +230,7 @@ void SetLogo() { if (lastCourseNum) { - itoa(lastCourseNum, largeImageKey); + snprintf(largeImageKey, sizeof(largeImageKey), "%d", lastCourseNum); } else strcpy(largeImageKey, "0"); @@ -268,7 +238,7 @@ void SetLogo() /* if (lastActNum) { - itoa(lastActNum, smallImageKey); + snprintf(smallImageKey, sizeof(largeImageKey), "%d", lastActNum); } else smallImageKey[0] = '\0'; */