diff --git a/include/asl/Array.h b/include/asl/Array.h index 1fbc8bf..220b7e2 100644 --- a/include/asl/Array.h +++ b/include/asl/Array.h @@ -19,6 +19,9 @@ #pragma warning(disable : 4251) #pragma warning(push) #pragma warning(disable : 4284 26451) +#else +#pragma GCC diagnostic push +//#pragma GCC diagnostic ignored "-Wnontrivial-memcall" #endif namespace asl { @@ -401,7 +404,7 @@ class Array if (i + n > m) return *this; asl_destroy(_a+i, n); - memmove(_a+i, _a+i+n, (m-i-n)*sizeof(T)); + memmove((char*)(_a + i), _a + i + n, (m - i - n)*sizeof(T)); d().n -= n; resize(m - n); return *this; @@ -590,7 +593,7 @@ class Array n--; } else - memcpy(&_a[j++], &_a[i], sizeof(T)); + memcpy((char*)&_a[j++], &_a[i], sizeof(T)); d().n = n; return *this; } @@ -633,7 +636,7 @@ Array& Array::reserve(int m) ASL_BAD_ALLOC(); b = (T*) ( p + sizeof(Data) ); int i = min(m,n), j = sizeof(T), k = i*j; - memcpy(b, _a, k); + memcpy((char*)b, _a, k); } else if(s1 != s) { @@ -684,7 +687,7 @@ Array& Array::insert(int k, const T& x) h->s=s1; } if (k < n) { - memmove((char*)_a + (k + 1) * sizeof(T), (void*)(_a + k), (n - k) * sizeof(T)); + memmove((char*)(_a + k + 1), (char*)(_a + k), (n - k) * sizeof(T)); } asl_construct_copy(_a + k, x); h->n = n+1; @@ -836,6 +839,8 @@ static asl::Array rad2deg(const asl::Array& a) } #ifdef _MSC_VER #pragma warning(pop) +#else +#pragma GCC diagnostic pop #endif #endif diff --git a/include/asl/Var.h b/include/asl/Var.h index de7ac01..e23d092 100644 --- a/include/asl/Var.h +++ b/include/asl/Var.h @@ -197,13 +197,13 @@ class ASL_API Var Var(Type t); Var(const Var& v) { - memcpy(this, &v, sizeof(v)); + memcpy((byte*)this, &v, sizeof(v)); if(!isPod()) copy(v); } void copy(const Var& v); #ifdef ASL_HAVE_MOVE - Var(Var&& v) {memcpy(this, &v, sizeof(Var)); v._type = NONE;} + Var(Var&& v) {memcpy((byte*)this, &v, sizeof(Var)); v._type = NONE;} void operator=(Var&& v) {bswap(*this, v);} #endif #ifdef ASL_HAVE_INITLIST diff --git a/include/asl/defs.h b/include/asl/defs.h index 4eb0d18..33463fb 100644 --- a/include/asl/defs.h +++ b/include/asl/defs.h @@ -233,8 +233,8 @@ inline void bswap(T& a, T& b) { char t[sizeof(T)]; memcpy(t, &a, sizeof(T)); - memcpy(&a, &b, sizeof(T)); - memcpy(&b, t, sizeof(T)); + memcpy((char*)&a, &b, sizeof(T)); + memcpy((char*)&b, t, sizeof(T)); } diff --git a/src/Var.cpp b/src/Var.cpp index 5a5ed0a..eda368f 100644 --- a/src/Var.cpp +++ b/src/Var.cpp @@ -330,7 +330,7 @@ void Var::operator=(const Var& v) if(!isPod()) free(); - memcpy(this, &v, sizeof(v)); + memcpy((byte*)this, &v, sizeof(v)); switch(_type) { case STRING: