Dhairya Malhotra 6 years ago
parent
commit
9b7e685365
2 changed files with 4 additions and 3 deletions
  1. 3 2
      include/sctl/mem_mgr.txx
  2. 1 1
      include/sctl/stacktrace.h

+ 3 - 2
include/sctl/mem_mgr.txx

@@ -522,7 +522,7 @@ template <class ValueType> inline Iterator<ValueType> memcopy(Iterator<ValueType
     SCTL_UNUSED(source[num - 1]     );
 #endif
     if (std::is_trivially_copyable<ValueType>::value) {
-      memcpy(&destination[0], &source[0], num * sizeof(ValueType));
+      memcpy((void*)&destination[0], (const void*)&source[0], num * sizeof(ValueType));
     } else {
       for (Long i = 0; i < num; i++) destination[i] = source[i];
     }
@@ -536,7 +536,8 @@ template <class ValueType> inline Iterator<ValueType> memset(Iterator<ValueType>
     SCTL_UNUSED(ptr[0]      );
     SCTL_UNUSED(ptr[num - 1]);
 #endif
-    ::memset(&ptr[0], value, num * sizeof(ValueType));
+    SCTL_ASSERT(std::is_trivially_copyable<ValueType>::value);
+    ::memset((void*)&ptr[0], value, num * sizeof(ValueType));
   }
   return ptr;
 }

+ 1 - 1
include/sctl/stacktrace.h

@@ -35,7 +35,7 @@ inline void print_stacktrace(FILE* out = stderr, int skip = 1) {
   // Print
   for (int i = skip; i < addrlen; i++) {
     // Get command
-    char cmd[10240];
+    char cmd[10240+256+43];
 #ifdef __APPLE__
     sprintf(cmd, "atos -o %s %p 2> /dev/null", fname, addrlist[i]); // on mac
 #elif __linux__