This commit contains the following changes: * Reduces scope of variables where possible, joining declaration and assignment where necessary. * Uses const for parameters and local variables where possible. * Uses static_cast or reinterpret_cast where possible. Pull Request: https://projects.blender.org/blender/blender/pulls/130487