Fixes for issue #224

* Not tested on Windows.
* Defines _CRT_SECURE_NO_DEPRECATE for all MSVC versions above 1500
* Previously was done only for version = 1500
* Usual warnings on new code (casts and signed comparisons), fixed.