laf
laf copied to clipboard
Fix strict-alias warnings
reinterpret_cast on pointers break strict-aliasing rule (-Wstrict-aliasing). Implemented internal function copy_reinterpret_cast that memcpy pointer into type, that can be converted to desired type.
Closes https://github.com/aseprite/aseprite/issues/4413
I agree that my contributions are licensed under the MIT License. You can find a copy of this license at https://opensource.org/licenses/MIT
clang-tidy review says "All clean, LGTM! :+1:"
Thanks @winterheart, I've just tested and this change segfaults one of our userdata_codec.lua tests where these functions are used:
Testing scripts...
Running scripts/userdata_codec.lua
run-tests.sh: line 69: 1690 Segmentation fault $ASEPRITE -b --script $script > $t/tmp 2>&1