Fixed CC and CPPCheck Warnings