improve code and increase const-correctness

code improvements that avoid warnings on higher warning levels

remove unnecessary casts

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

mercurial