diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-11 13:54:17 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-11 14:02:10 +0300 |
commit | b763c34e80d3b20f9a7f0a592e479e5fa7ab295f (patch) | |
tree | 0e55888e504996493313f5351204d6c1e049a5db /intern/cycles/blender/blender_util.h | |
parent | a6e582164f11c618a324dad1a2ae2c73cbc85b77 (diff) |
Cycles: Cleanup, silence strict compiler warning
There is one legit place in the code where memcpy was used as an
optimization trick. Was needed for older version of GCC, but now
it should be re-evaluated and checked if it still helps to have
that trick.
In other places it's somewhat lazy programming to zero out all
object members. That is absolutely unsafe, at the moment when
less trivial class is used as a member in that object things
will break.
Other cases were using memcpy into an object which comes from
an external library. We don't control that object, and we can
not guarantee it will always be safe for such memory tricks
and debugging bugs caused by such low level access is far fun.
Ideally we need to use more proper C++, but needs to be done with
big care, including benchmarks of each change, For now do
annoying but simple cast to void*.
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r-- | intern/cycles/blender/blender_util.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 85bff8f8323..5176f9c3b50 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -251,7 +251,7 @@ static inline Transform get_transform(const BL::Array<float, 16>& array) /* We assume both types to be just 16 floats, and transpose because blender * use column major matrix order while we use row major. */ - memcpy(&projection, &array, sizeof(float)*16); + memcpy((void *)&projection, &array, sizeof(float)*16); projection = projection_transpose(projection); /* Drop last row, matrix is assumed to be affine transform. */ |