TS-2891: Optimiize if block for status code
TS-2891: Change status code usage to int to avoid clang warning