Fix clang warnings

This patch series fixes a ton of warnings generated by clang, to be precise: by Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)

I hope most of these are uncontroversial, but the last two against AGI and LASTEXPRESS might not be the best "solutions", so let me know if I should drop them (or any other parts of this series).