Various fixes for CppCheck warnings.

Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
Another windows build fix
Merge remote-tracking branch 'ace/win-fix'