[12477] Fix a VC90 compile problem. Also add some const correctness