Remove trailing whitespaces in .h, .cpp, .c and .lua files.
Merge pull request #237 from mounirlamouri/trailing_whitespaces

Remove trailing whitespaces in .h, .cpp, .c and .lua files.
Various cleanups in some C++ files.
Merge pull request #234 from mounirlamouri/cpp_cleanup