diff options
| -rw-r--r-- | hardinfo2/arch/common/printers.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/filesystem.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/resources.h | 4 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/storage.h | 2 | ||||
| -rw-r--r-- | hardinfo2/benchmark.c | 34 | ||||
| -rw-r--r-- | hardinfo2/hardinfo.h | 3 | ||||
| -rw-r--r-- | hardinfo2/shell.c | 2 | ||||
| -rw-r--r-- | hardinfo2/util.c | 13 | 
8 files changed, 51 insertions, 11 deletions
| diff --git a/hardinfo2/arch/common/printers.h b/hardinfo2/arch/common/printers.h index 2f221252..75b6e84a 100644 --- a/hardinfo2/arch/common/printers.h +++ b/hardinfo2/arch/common/printers.h @@ -234,7 +234,7 @@ __scan_printers(void)                  } else {                    if (temp) {                      /* FIXME Do proper escaping */ -                    temp = g_strdup(strreplace(temp, "&=", ' ')); +                    temp = g_strdup(strreplacechr(temp, "&=", ' '));                    } else {                      temp = g_strdup("Unknown");                    } diff --git a/hardinfo2/arch/linux/common/filesystem.h b/hardinfo2/arch/linux/common/filesystem.h index 1eff0818..48cbbd51 100644 --- a/hardinfo2/arch/linux/common/filesystem.h +++ b/hardinfo2/arch/linux/common/filesystem.h @@ -77,7 +77,7 @@ scan_filesystems(void)  		    g_free(strhash);  		} -		strreplace(tmp[0], "#", '_'); +		strreplacechr(tmp[0], "#", '_');  		strhash = g_strdup_printf("[%s]\n"  					  "Filesystem=%s\n" diff --git a/hardinfo2/arch/linux/common/resources.h b/hardinfo2/arch/linux/common/resources.h index 20db65e9..acfbe377 100644 --- a/hardinfo2/arch/linux/common/resources.h +++ b/hardinfo2/arch/linux/common/resources.h @@ -38,12 +38,12 @@ static gchar *_resource_obtain_name(gchar *name)      if (g_regex_match(_regex_pci, name, 0, NULL)) {        temp = module_call_method_param("devices::getPCIDeviceDescription", name);        if (temp) { -          return temp; +          return g_strdup_printf("<b><small>PCI</small></b> %s", (gchar *)idle_free(temp));        }      } else if (g_regex_match(_regex_module, name, 0, NULL)) {        temp = module_call_method_param("computer::getKernelModuleDescription", name);        if (temp) { -          return temp; +          return g_strdup_printf("<b><small>Module</small></b> %s", (gchar *)idle_free(temp));        }      } diff --git a/hardinfo2/arch/linux/common/storage.h b/hardinfo2/arch/linux/common/storage.h index 06593a09..7caf1d96 100644 --- a/hardinfo2/arch/linux/common/storage.h +++ b/hardinfo2/arch/linux/common/storage.h @@ -239,7 +239,7 @@ __scan_ide_devices(void)                             }    	               } else if ((strstr(buf, "read") || strstr(buf, "write")) && strstr(buf, "kB/s")) {    	                   speed = g_strconcat(speed ? speed : "", -  	                                       strreplace(g_strstrip(buf), ":", '='), +  	                                       strreplacechr(g_strstrip(buf), ":", '='),    	                                       "\n", NULL);    	               } else if (strstr(buf, "Device seems to be")) {    	                   driver = g_strdup_printf("Driver=%s\n", strchr(buf, ':') + 1); diff --git a/hardinfo2/benchmark.c b/hardinfo2/benchmark.c index 97796b37..7189a37e 100644 --- a/hardinfo2/benchmark.c +++ b/hardinfo2/benchmark.c @@ -155,6 +155,32 @@ gdouble benchmark_parallel_for(guint start, guint end,      return elapsed_time;  } +static gchar *clean_cpuname(gchar *cpuname) +{ +    gchar *ret = NULL, *tmp; +    gchar *remove[] = { +        "(R)", "(r)", "(TM)", "(tm)", "Processor", +        "Technology", "processor", "CPU", +        NULL +    }; +    gint i; +     +    ret = g_strdup(cpuname); +    for (i = 0; remove[i]; i++) { +      tmp = strreplace(ret, remove[i], ""); +      g_free(ret); +      ret = tmp; +    } +     +    ret = strend(ret, '@'); +    ret = g_strstrip(ret); +     +    tmp = g_strdup(ret); +    g_free(ret); + +    return tmp; +} +  static gchar *__benchmark_include_results(gdouble result,  					  const gchar * benchmark,  					  ShellOrderType order_type) @@ -177,12 +203,14 @@ static gchar *__benchmark_include_results(gdouble result,      machines = g_key_file_get_keys(conf, benchmark, NULL, NULL);      for (i = 0; machines && machines[i]; i++) { -	gchar *value; +	gchar *value, *cleaned_machine;  	value   = g_key_file_get_value(conf, benchmark, machines[i], NULL); -	results = g_strconcat(results, machines[i], "=", value, "\n", NULL); -	 +	cleaned_machine = clean_cpuname(machines[i]); +	results = h_strconcat(results, cleaned_machine, "=", value, "\n", NULL); +  	g_free(value); +	g_free(cleaned_machine);      }      g_strfreev(machines); diff --git a/hardinfo2/hardinfo.h b/hardinfo2/hardinfo.h index 6ac25bec..2fe955fe 100644 --- a/hardinfo2/hardinfo.h +++ b/hardinfo2/hardinfo.h @@ -68,7 +68,8 @@ struct _ModuleAbout {  inline void  remove_quotes(gchar *str);  inline char *strend(gchar *str, gchar chr);  inline void  remove_linefeed(gchar *str); -gchar       *strreplace(gchar *string, gchar *replace, gchar new_char); +gchar       *strreplacechr(gchar *string, gchar *replace, gchar new_char); +gchar       *strreplace(gchar *string, gchar *replace, gchar *replacement);  /* Widget utility functions */  void widget_set_cursor(GtkWidget *widget, GdkCursorType cursor_type); diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index 2fb36010..c33be0ef 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -1074,7 +1074,7 @@ static void update_progress()              tmp = g_strdup_printf("%.2f", floatval);          } -        tmp = strreplace(tmp, ",", '.'); +        tmp = strreplacechr(tmp, ",", '.');  	gtk_tree_store_set(store, &iter, INFO_TREE_COL_PROGRESS, cur,                                           INFO_TREE_COL_VALUE, tmp, -1);          g_free(tmp); diff --git a/hardinfo2/util.c b/hardinfo2/util.c index ac2ad3b5..dd89e199 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -493,7 +493,7 @@ void open_url(gchar * url)  }  /* Copyright: Jens Låås, SLU 2002 */ -gchar *strreplace(gchar * string, gchar * replace, gchar new_char) +gchar *strreplacechr(gchar * string, gchar * replace, gchar new_char)  {      gchar *s;      for (s = string; *s; s++) @@ -503,6 +503,17 @@ gchar *strreplace(gchar * string, gchar * replace, gchar new_char)      return string;  } +gchar *strreplace(gchar *string, gchar *replace, gchar *replacement) +{ +    gchar **tmp, *ret; +     +    tmp = g_strsplit(string, replace, 0); +    ret = g_strjoinv(replacement, tmp); +    g_strfreev(tmp); +     +    return ret; +} +  static GHashTable *__module_methods = NULL;  static void module_register_methods(ShellModule * module) | 
