bugfix: fixed most of warnings and errors from the Microsoft Visual C++ compiler, reported by Edwin Cleton.