Browse Source

Fix compile error for ancient clangs

rdb 8 years ago
parent
commit
fdffcc280b
2 changed files with 8 additions and 7 deletions
  1. 2 2
      panda/src/display/displayInformation.cxx
  2. 6 5
      panda/src/display/graphicsPipe.cxx

+ 2 - 2
panda/src/display/displayInformation.cxx

@@ -17,7 +17,7 @@
 // For __rdtsc
 #ifdef _MSC_VER
 #include <intrin.h>
-#elif defined(__GNUC__) && !defined(__APPLE__)
+#elif defined(__GNUC__) && !defined(__clang__)
 #include <x86intrin.h>
 #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;

+ 6 - 5
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)