Compatible with Py3k, fixed cpp code warning and styles

* Compatible with Py3k. Tested on Mac OS X 10.9 with Python 3.4.0 and Python 2.7.5.

* Fix cpp code compile warnings.

* Use `cppcheck` to format cpp code with Google CPP code style.