Multi-platform compile errors

All unused variables, or missing type casts have been added, as per
stricter compilers than VS 2010 Express