Miscellaneous cppcheck and other fixes

Like #268 but for master, not stable-0.8. Sorry!

I'm happy to squash things if the commit history gets too detailed ;)
Ah, I thought I'd seen the other style somewhere in your code base, must have been a mistake then. I'll amend.