From 7eb7aeaa6bab0b7f2158af0100255e1d6bc1f6df Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Mon, 13 Feb 2017 16:16:52 +0100 Subject: [PATCH] Client: normalize whitespace in p_model and p_vendor entries This was already done for Mac but not Linux and Windows. It collapses multiple consecutive blanks into one blank which is then send to the server. --- client/hostinfo_unix.cpp | 20 ++------------------ client/hostinfo_win.cpp | 2 ++ lib/str_util.cpp | 19 +++++++++++++++++++ lib/str_util.h | 2 ++ 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/client/hostinfo_unix.cpp b/client/hostinfo_unix.cpp index e5bad80a82..069fe76d53 100644 --- a/client/hostinfo_unix.cpp +++ b/client/hostinfo_unix.cpp @@ -839,14 +839,6 @@ static void get_cpu_info_mac(HOST_INFO& host) { #endif host.p_model[p_model_size-1] = 0; - char *in = host.p_model + 1; - char *out = in; - // Strip out runs of multiple spaces - do { - if ((!isspace(*(in-1))) || (!isspace(*in))) { - *out++ = *in; - } - } while (*in++); // This returns an Apple hardware model designation such as "MacPro3,1". // One source for converting this to a common model name is: @@ -1069,7 +1061,6 @@ int get_network_usage_totals( total_sent += ifmsg->ifm_data.ifi_obytes; #endif } - return 0; } @@ -1400,14 +1391,6 @@ int HOST_INFO::get_cpu_info() { #elif HAVE_SYS_SYSTEMINFO_H sysinfo(SI_PLATFORM, p_vendor, sizeof(p_vendor)); sysinfo(SI_ISALIST, p_model, sizeof(p_model)); - for (unsigned int i=0; i