Applied all fixes related to translating C to C++ code

Applied fixes discussed in feature request 1631.
Previous pull request : https://github.com/Itseez/opencv/pull/1473