fix inconsistent naming of symbols

improve code and increase const-correctness

code improvements that avoid warnings on higher warning levels

(0) -100 -30 -10 -3 +3 tip

mercurial