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

Applied fixes discussed in feature request 1631 (http://code.opencv.org/issues/1631)
Previous pull request : https://github.com/Itseez/opencv/pull/1473