Replace C-style casts to static_cast and reinterpret_cast (#5930)

* Replace C-style casts to static_cast and reinterpret_cast

Signed-off-by: cyy <cyyever@outlook.com>

* style: pre-commit fixes

---------

Signed-off-by: cyy <cyyever@outlook.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
13 files changed