From 5751ea57271a76e95a8cbfbaf3c96f380b0732b9 Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Wed, 23 Nov 2016 22:02:02 +0000 Subject: [PATCH] Better parameter searching; remove parameter value instead of overriding it with X --- cheevos.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/cheevos.c b/cheevos.c index 9c98181141..d2ea641dbc 100644 --- a/cheevos.c +++ b/cheevos.c @@ -309,28 +309,53 @@ static void cheevos_log_url(const char* format, const char* url) #else char copy[256]; char* aux; + char* next; strncpy(copy, url, sizeof(copy)); copy[sizeof(copy) - 1] = 0; - aux = strstr(copy, "p="); + aux = strstr(copy, "?p="); + + if (aux == NULL) + aux = strstr(copy, "&p="); if (aux != NULL) { - aux += 2; + aux += 3; + next = strchr(aux, '&'); - while (*aux != 0 && *aux != '&') - *aux++ = 'X'; + if (next != NULL) + { + do + { + *aux++ = *next++; + } + while (next[-1] != 0); + } + else + *aux = 0; } - aux = strstr(copy, "t="); + aux = strstr(copy, "?t="); + + if (aux == NULL) + aux = strstr(copy, "&t="); if (aux != NULL) { - aux += 2; + aux += 3; + next = strchr(aux, '&'); - while (*aux != 0 && *aux != '&') - *aux++ = 'X'; + if (next != NULL) + { + do + { + *aux++ = *next++; + } + while (next[-1] != 0); + } + else + *aux = 0; } RARCH_LOG(format, copy);