Strip trailing whitespace.
Use a variable as const ref instead of const.

Issue found by cppcheck.