Fix signed/unsigned comparison warnings.
Fix 'potentially unititialized local pointer' errors on Windows.
Fix random crashing on startup on Windows.
Fix calling convention errors on Windows.
Prevent lockup on exit on Windows.
Clean up to use already available local variable.
Clean up build warnings
Merge pull request #88 from pthedinger/master

Fix issues on Windows