diff options
-rw-r--r-- | intern/cycles/device/device_opencl.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_string.cpp | 17 | ||||
-rw-r--r-- | intern/cycles/util/util_string.h | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_system.cpp | 14 |
4 files changed, 22 insertions, 13 deletions
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 67ed1c776f4..88c2a2f58c3 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -3416,7 +3416,7 @@ void device_opencl_info(vector<DeviceInfo>& devices) DeviceInfo info; info.type = DEVICE_OPENCL; - info.description = string(name); + info.description = string_remove_trademark(string(name)); info.num = num_base + num; info.id = string_printf("OPENCL_%d", info.num); /* we don't know if it's used for display, but assume it is */ diff --git a/intern/cycles/util/util_string.cpp b/intern/cycles/util/util_string.cpp index 8675ff3679d..66856dd8331 100644 --- a/intern/cycles/util/util_string.cpp +++ b/intern/cycles/util/util_string.cpp @@ -105,5 +105,22 @@ string string_strip(const string& s) } +void string_replace(string& haystack, const string& needle, const string& other) +{ + size_t i; + + while((i = haystack.find(needle)) != string::npos) + haystack.replace(i, needle.length(), other); +} + +string string_remove_trademark(const string &s) +{ + string result = s; + string_replace(result, "(TM)", ""); + string_replace(result, "(R)", ""); + + return string_strip(result); +} + CCL_NAMESPACE_END diff --git a/intern/cycles/util/util_string.h b/intern/cycles/util/util_string.h index fa1671fd1ee..6cb8d8df1e1 100644 --- a/intern/cycles/util/util_string.h +++ b/intern/cycles/util/util_string.h @@ -40,8 +40,10 @@ string string_printf(const char *format, ...) PRINTF_ATTRIBUTE; bool string_iequals(const string& a, const string& b); void string_split(vector<string>& tokens, const string& str, const string& separators = "\t "); +void string_replace(string& haystack, const string& needle, const string& other); bool string_endswith(const string& s, const char *end); string string_strip(const string& s); +string string_remove_trademark(const string& s); CCL_NAMESPACE_END diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 4a88ef6de76..cc88320b68e 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -16,6 +16,7 @@ #include "util_system.h" #include "util_types.h" +#include "util_string.h" #ifdef _WIN32 #if(!defined(FREE_WINDOWS)) @@ -75,14 +76,6 @@ static void __cpuid(int data[4], int selector) } #endif -static void replace_string(string& haystack, const string& needle, const string& other) -{ - size_t i; - - while((i = haystack.find(needle)) != string::npos) - haystack.replace(i, needle.length(), other); -} - string system_cpu_brand_string() { char buf[48]; @@ -98,10 +91,7 @@ string system_cpu_brand_string() string brand = buf; /* make it a bit more presentable */ - replace_string(brand, "(TM)", ""); - replace_string(brand, "(R)", ""); - - brand = string_strip(brand); + brand = string_remove_trademark(brand); return brand; } |