codecompletionmodel: fix C style cast

fix some cppcheck warnings about C style pointer casting.
REVIEW: 121585