WRG: fix warnings declaration shadows a previous local seen with gcc 8
Fix most of the 39 warnings on pc-christophe (gcc 8):
https://dash.orfeo-toolbox.org/viewBuildError.php?type=1&buildid=332827
I've tagged the MR as 'patch' but also register the branch to the test queue to check if I did not forget any fixable warnings.