apply a couple of (useful) "const" attributes

The primary reason is to avoid unnecessary merge conflicts
when merging up to newer code, which more insist on the
"const correctness" - but we may get some optimizer benefits
as well.