From fdffcc280b33304001a430cabefadaabddbf94c4 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 10 Feb 2017 00:07:45 +0100 Subject: [PATCH] Fix compile error for ancient clangs --- panda/src/display/displayInformation.cxx | 4 ++-- panda/src/display/graphicsPipe.cxx | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/panda/src/display/displayInformation.cxx b/panda/src/display/displayInformation.cxx index ac357344a5..9bda75e0de 100644 --- a/panda/src/display/displayInformation.cxx +++ b/panda/src/display/displayInformation.cxx @@ -17,7 +17,7 @@ // For __rdtsc #ifdef _MSC_VER #include -#elif defined(__GNUC__) && !defined(__APPLE__) +#elif defined(__GNUC__) && !defined(__clang__) #include #endif @@ -529,7 +529,7 @@ get_cpu_frequency() { */ uint64_t DisplayInformation:: get_cpu_time() { -#if defined(_MSC_VER) || (defined(__GNUC__) && !defined(__APPLE__)) +#if defined(_MSC_VER) || (defined(__GNUC__) && !defined(__clang__)) return __rdtsc(); #else unsigned int lo, hi = 0; diff --git a/panda/src/display/graphicsPipe.cxx b/panda/src/display/graphicsPipe.cxx index 7bf9df67a6..5c00b204a3 100644 --- a/panda/src/display/graphicsPipe.cxx +++ b/panda/src/display/graphicsPipe.cxx @@ -141,14 +141,15 @@ GraphicsPipe() : } if (max_extended >= 0x80000004) { - string brand; + char brand[49]; get_cpuid(0x80000002, info); - brand += string(info.str, strnlen(info.str, 16)); + memcpy(brand, info.str, 16); get_cpuid(0x80000003, info); - brand += string(info.str, strnlen(info.str, 16)); + memcpy(brand + 16, info.str, 16); get_cpuid(0x80000004, info); - brand += string(info.str, strnlen(info.str, 16)); - _display_information->_cpu_brand_string = move(brand); + memcpy(brand + 32, info.str, 16); + brand[48] = 0; + _display_information->_cpu_brand_string = brand; } #if defined(IS_OSX)