Remove redundant and c style casts
Only reinterpret cast was needed for: reinterpret_cast<qptrdiff>(doc)